Alternate 4.1alpha3 with udev

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.

Busy today though. Driving home from Perth. Also have to pickup some chooks.

Posted on 1 Jul 2008, 8:36


Posted on 1 Jul 2008, 9:51 by Ted Dog
Farm animals
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!

Posted on 1 Jul 2008, 11:30 by ANOSage
Wild and escaped animals
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.

Posted on 2 Jul 2008, 3:29 by playdayz
Watch our for hal & dbus
all together, as I understand it, your puppy_event programs are/will be a replacement for hal and dbus too. Good! I have tested this on gentoo and arch--when I install either hal and/or dbus things slow way down. It is amazing and almost unbelievable how much they slow down. deliver us from hal & dbus!

Posted on 2 Jul 2008, 4:43 by Bosco Bearbank
Cows vs. traffic
Two-lane road along the west side of Flaming Gorge Reservoir, Wyoming. July 6, 2006. Cows to our right (off the road), cows to our left (both on and off the road), and cows dead ahead on the road, all moving in the opposite direction to our direction of travel. I've got photos to back up this claim

Posted on 2 Jul 2008, 5:32 by 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
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/ that will do so)!

That way udevd will handle all the backend and the frontend can just use
(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+=" add %k%n"
ACTION=="remove", KERNEL=="fd[0-9]|sr[0-9]*|[sh]d[a-z]*|mmcblk[0-9]", \
RUN+=" remove %k%n"
which *should* handle it...)

Note that you need to modify snapmergepuppy and rc.shutdown so they do
NOT dave /dev.

Posted on 2 Jul 2008, 9:40 by BarryK
Re: udevd
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:

# kernel firmware loader
SUBSYSTEM=="firmware", ACTION=="add", RUN+=""

# 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'"

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. "" -- 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.

Posted on 2 Jul 2008, 9:56 by BarryK
Re: Chooks
Ha Ha yes, "chooks" is an Australian and New Zealand slang word for chickens.

Posted on 2 Jul 2008, 15:57 by nic2109
Cows & Traffic
I guess it also depends on how busy the road is since herds and flocks tend to move together. If there's no "leader" (i.e. a moving vehicle) then they'll all just head whichever way one of them likes.

Posted on 2 Jul 2008, 16:30 by 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.

Posted on 2 Jul 2008, 20:53 by Bosco Bearbank
From Fedora:

/lib/udev$ cat
#!/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

[ -e "$DIR/$FIRMWARE" ] || continue
echo 1 > /sys$DEVPATH/loading
cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data
echo 0 > /sys$DEVPATH/loading
exit 0

echo -1 > /sys$DEVPATH/loading
err "Cannot find firmware file '$FIRMWARE'"
exit 1

Posted on 3 Jul 2008, 4:00 by Subito Piano
extra header
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 pages correctly? Seems with puppy's emphasis on speed and on Dillo, they ought to be laid out the same as in SeaMonkey, etc....

Posted on 3 Jul 2008, 16:37 by Dougal
it's actually in the "extras" directory in the udev package and every distro takes it and renames it to suit itself...