Skip to contentSkip to conversation

ENV{MODALIAS}=="?*"->ONLY modprobe????,how to trap kernel events

DISCUSSION janusz borowski 2 participants 3 messages Feb 16, 2006 – Feb 17, 2006

lore
Share & tools
lore
#0 lore raw

Hi,
I have changed the original line (in z55_hotplug.rules):
ENV{MODALIAS}="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
to "my line":
ENV{MODALIAS}="?*", RUN+="/usr/local/lib/udev/t52.sh"
and the t52.sh is:
#!/bin/sh
echo "********t2********">>/usr/local/lib/udev/wyn52 set>>/usr/local/lib/udev/wyn52
echo "********end t2********">>/usr/local/lib/udev/wyn52 However,
1)after booting with "my line" the wyn52 is empty (and of course modules are not loaded)
2)after booting with "original line" modules are loaded (so the rule ENV{MODALIAS}="?*" "detects" events)
3)when the boot process is ended "my rule" works ok (eg.: I have information in wyn52 after plugging a usb-modem).
My question is:
WHY MY "DIAGNOSTIC TOOL" DOES NOT WORK DURING BOOT?
I have tried similar "trap":
KERNEL="?*" -> "log %k". This time my diagnostic file is not empty after booting,
however it contains mostly information about /dev/vcs*, usb buses and almost nothing about pci devices - I do not believe that ALL kernel events were registered.
Why?

What kind of rule could give information about pci devices (during boot time)?I would like to know how to log to a file ALL %k, %b considering by udevd during boot time
(to take appropriate action for my device like d-link pci wifi card or usb modem,... - I do not want to do this by configuring modprobe).

I am using udev 0.084-4 (not 0.085 yet), kernel 2.6.15, debian unstable. (udev_log="info or debug" gives only messages to console, one cannot read them, and system crash after a few minutes - I must start another linux and change back to udev_log="err"....)
Thanks in advance
janusz

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw

Re: ENV{MODALIAS}=="?*"->ONLY modprobe????,how to trap kernel events during boot

Quoted 11 lines · janusz borowski

Hi,
I have changed the original line (in z55_hotplug.rules):
ENV{MODALIAS}="?*", RUN+="/sbin/modprobe $env{MODALIAS}"
to "my line":
ENV{MODALIAS}="?*", RUN+="/usr/local/lib/udev/t52.sh" and the t52.sh is:
#!/bin/sh
echo "********t2********">>/usr/local/lib/udev/wyn52 set>>/usr/local/lib/udev/wyn52
echo "********end t2********">>/usr/local/lib/udev/wyn52 However,

Quoted 8 lines

1)after booting with "my line" the wyn52 is empty (and of course modules are not loaded)
2)after booting with "original line" modules are loaded (so the rule ENV{MODALIAS}="?*" "detects" events)
3)when the boot process is ended "my rule" works ok (eg.: I have information in wyn52 after plugging a usb-modem).
My question is:
WHY MY "DIAGNOSTIC TOOL" DOES NOT WORK DURING BOOT?

Is /usr/local/lib/udev mounted at this time?

thanks,

greg k-h

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to janusz borowski
Quoted 7 lines · Greg KH

Is /usr/local/lib/udev mounted at this time?

thanks,

greg k-h

Thanks for your remark.
Yes, it is mounted (/usr/local/lib/udev is a part of the partition where the whole debian was installed and my rule starts working after booting).

I have tried much more rough test (because I thought that in this moment the writing to disk is not starting yet).
I have changed RUN+=... to:
RUN+="/bin/sh -c 'K=%k; K=$$; printf $${K} '"
(and this line was taken and carefully changed from the "original working rule"
- at this moment I knew that is not so easy with udev....). Nothing (and original rule in my computer loads about 15 modules, like pci-bttv, snd *1394,...so should be more than 15 "printf's"). Next I have changed to:
RUN+="/bin/sh -c 'K=%k; printf YYYYYaaaaaa'" (easy seen string) Nothing.

(At this time I did not believe in syslog, which should log everything, so I have added in 3 scripts in /etc/init.d:
/sbin/lsmod
echo "name of script"
read bleble
Now, the boot process was stopping 3 times, and very easy I could read all messages using Shift PgUp.
I am sure that my rule did not give any messages to console).

The only succeses in my "investigations" were as follows:
I have looked at /sys for ID connected with modules loaded by original rule (not so clear for me but possible)
I have applied rules:
ID="something", OPTIONS+="last_rule".
Success - udev did not load any modules (so udev see all pci-events!!; eg. bttv).
But when I try:
ID="something",RUN+="a test", OPTIONS+="last_rule"
the polite udev ignores any test (>>file, printf, echo, ...).

I have tried:
RUN <-> PROGRAM
test rules on the beginning of rules list, on the end, near original (z55) - z52, z57
changing original rule or adding new
NOTHING - udev keep his secrets .....

Maybe I try to catch too much events?
Maybe it was possible to divide "trap procedure" into parts (but I do not know
the names of all events (eg. SUBSYTEM's) and I do not know which set of rules
could give full information).

Maybe my problems are caused by "some time-like" effects?

Maybe someone has a source of "a test demon", which could be started before udev and catch everything in his large buffer a
nd when the system is started it could save this buffer to a file ?

Thanks in advance
janusz

Quoted 5 lines

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel