Alternate 4.1alpha3 with udev
July 01, 2008 —
BarryK
My 'pup_event_backend_d' daemon has much of the same functionality as 'udevd', so I could test udevd as an alternative.
For me this has been a great learning experience, tackling kernel uevents at the grass-roots level, having implemented my own replacement for udev I understand pretty much how udev works. Which is an improvement on a month or two ago when I didn't have a clue.
I think that I can write udev rules to call a script whenever there is a uevent that I want to pass onto the pup_event_frontend_d.
This will be a very interesting exercise, a worthy comparison. I reckon I'll do this over the next few days.
Comments
Farm animalsUsername: Ted Dog
Since you talked about chickens, I've noticed that escaped cows run on the road on the same side and direction with traffic, on the right. What about other places, same direction as traffic? Oh and LZMA!
Wild and escaped animals
Username: ANOSage
"Yes. Of course, most of the world drives on the correct side of the road, but, yes, our deer, horses, ponies, cows do tend to keep left. Had to Google for chooks - never heard that one before. Escaped chickens and pigs seem to be the exceptions, don't observe the Highway Code - all over the shop. I suppose we need a view from India (left) to get a better guide to animal behaviour.
udev
Username: Dougal
"It just struck me! It is in fact very simple. There's no need for any special rules or anything -- udevd can be run normally. What udevd does is run "/sbin/modprobe --use-blacklist $env{MODALIAS}", to load the modules matching the alias. So all that's needed is for the modprobe script to do the selective blacklisting done by rc.modules (or replace /sbin/modprobe in the rules with /sbin/modprobe.sh that will do so)! That way udevd will handle all the backend and the frontend can just use hotplug2stdout. (Alternately, you can add to the end of the udev rules something like: ACTION=="add", KERNEL=="fd[0-9]|sr[0-9]*|[sh]d[a-z]*|mmcblk[0-9]", \ RUN+="some-script.sh add %k%n" ACTION=="remove", KERNEL=="fd[0-9]|sr[0-9]*|[sh]d[a-z]*|mmcblk[0-9]", \ RUN+="some-script.sh remove %k%n" which *should* handle it...) Note that you need to modify snapmergepuppy and rc.shutdown so they do NOT dave /dev.
Re: udevd
Username: BarryK
"Yes indeed, it turns out that udevd is extremely easy to put in. I've got it running right now. I created one small rules file in /etc/udev/rules.d, with this in it: [i]# kernel firmware loader SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" # Module autoloading #ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/pup_event_backend_modprobe $env{MODALIAS}" ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \ RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'"[/i] udevd exports all the variables MODALIAS, ACTION, MAJOR, MINOR, SUBSYSTEM, etc., so they are all usable inside the /sbin/pup_event_backend_modprobe script. So far that script just executes /sbin/modprobe, but we can now do anything we want. I don't know about that firmware entry above. That was in the original udev rules, but I don't understand it. "firmware.sh" -- where is that? That last one with "allow_func_id_match" is important. For my PCMCIA modem, GLOBETROTTER.cis would not load and the modem did not work, but that above rule allows the modem to work regardless.
Re: Chooks
Username: BarryK
"Ha Ha :happy: yes, "chooks" is an Australian and New Zealand slang word for chickens.
firmware.sh
Username: Dougal
"Debian has "firmware.agent", if I'm not mistaken, so it must be something that loads the right firmware. Maybe it's among the extras you can enable when compiling udev? there are all the extra apps that go in /lib/udev.
firmware.sh
Username: Bosco Bearbank
"From Fedora: [code] /lib/udev$ cat firmware.sh #!/bin/sh -e FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware" err() { echo "$@" >&2 logger -t "${0##*/}[$$]" "$@" 2>/dev/null || true } if [ ! -e /sys$DEVPATH/loading ]; then err "udev firmware loader misses sysfs directory" exit 1 fi for DIR in $FIRMWARE_DIRS; do [ -e "$DIR/$FIRMWARE" ] || continue echo 1 > /sys$DEVPATH/loading cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data echo 0 > /sys$DEVPATH/loading exit 0 done echo -1 > /sys$DEVPATH/loading err "Cannot find firmware file '$FIRMWARE'" exit 1 [/code]
extra header
Username: Subito Piano
"Say, i notice that the "Barry;s Blog" logo and avatar often show up multiple times on a page -- right over text, say halfway down. I wonder why? Also -- why does Dillo not render puppylinux.com pages correctly? Seems with puppy's emphasis on speed and on Dillo, they ought to be laid out the same as in SeaMonkey, etc....
Tags: puppy