Puppy event management

PRELIMINARY: This page for Puppy 4.1alpha4+ only, updated July 17, 2008
Puppy Linux has sophisticated mechanisms for loading the correct
kernel modules at bootup, and also when hotplugging removable hardware. The
overall name given to these mechanisms is pup_event_backend.
The complement of this is pup_event_frontend, which mainly concerns how hardware events get presented on the desktop and to the user.
The latter, pup_event_frontend, is the main focus on this page. To
learn the fundamentals and the introduction to pup_event_backend,
especially how modules are loaded, please first read this web page:

Having read the page on module loading at bootup, this page is the
situation of a running Puppy and appropriate handling of "events" from the user's perspective. By
the word "event" I mean something that has happened at a hardware or
systems level. In particular what we call a "hotplug" event.

An example of a hotplug event is when you plug in a USB pen drive. Or,
what if you plugin a PCMCIA network card? Obviously, Puppy needs to be
able to respond to these events and handle them appropriately.

Puppy has his own unique way of managing events, called pup_event,
which can be split into backend and a frontend components. The backend
is mostly concered with loading of modules, the frontend with
presenting hardware events to the user.

pup_event

This picture gives an overview how pup_event_backend and pup_event_frontend work together:

The Linux kernel is aware of certain hardware events, such as plugging
in or removing of a USB drive. This is called "hotplugging". The kernel
sends a 'uevent' message to pup_event_backend that a hotplug event has occurred, and
the script responds according to the message.

Pup_event_frontend is essentially a single script,
/sbin/pup_event_frontend_d, which is a daemon that starts when X starts
and quits when X quits.

basically, the backend sends messages to the frontend when anything
happens that the user should know about. For example, you plug in a USB
pen drive, a pen-drive-icon appears on the desktop -- it is this latter
operation that is performed by the frontend.

Idle loop

There are some events though that the kernel does not detect, and it is
up to pup_event_frontend_d to execute an "idle time loop" to scan for those
events. They are:

Puppy has a display in the tray, that shows how much memory is
available for use. This will start to flash when it gets low. A warning
message will also appear at the top of the screen when free memory gets
very low.

When Puppy has booted off a Flash drive, Puppy works as much as
possible in RAM only, saving to the Flash drive periodically. This is
done to conserve the life of the Flash drive (Flash memory has very
limited number of write cycles before it will fail).

If you insert a CD or DVD, you would like it if Puppy recognises and
responds in some appropriate way. As a minimum, Puppy will put a CD
icon on the desktop. You may also configure so that the Puppy drive
mounter application (Pmount) pops up.

Event Manager

There are some aspects of frontend event handling that you might like to
configure, from the user pespective. This is made simple with a little
GUI application named "Puppy Event Manager" that is selected from the
"System" menu (also via right-click menu on a desktop drive icon):

The GUI window is pretty much self-explanatory. These settings are read by the pup_eventd daemon.

The next part of this web-page describes desktop drive icons. These are
part of the event management system and configured from the Puppy Event
Manager. There are two relevant tabs in the Event Manager GUI:

Again, these settings should be self-explanatory. The next section
shows how the icons look on the desktop and how they are used:

Desktop drive icons

Block devices (meaning hard-drive, floppy, Zip, LS120, CD/DVD and
memory cards) will appear as icons on the desktop. This happens in
realtime: when a pluggable block device is
inserted, an appropriate icon will appear
on the desktop, if a pluggable device is removed, the icon will
disappear. This snapshot shows four icons:

The four devices are, from left to right: an internal hard drive, USB
Flash pen drive, a CD, and a SD card. The last one is in the
card-reader slot in my laptop. You can see the matching icons in each
case. A click on one of these icons opens Pmount, with appropriate
drive showing "on top". If I mount any partition in one of these
drives, a big "MNTD" displays on the deskop icon.

Note though, there is a checkbox in the Event Manager (see 2nd-above
picture) to turn on auto-launch of an appropriate target application,
for example run the Gxine multimedia player if media is a DVD-video.

Notice the color-coding of the "MNTD" text. The reason for this is to
show you at-a-glance if a drive is mounted but cannot be unmounted. In
the above snapshot, I have booted Puppy from a USB Flash drive and it
is being used by the system, hence the yellow color. On the otherhand,
I manually mounted the SD card so it shows up as green text -- meaning
that I should unmount it before removing it.

This snapshot shows Pmount, the Puppy drive mounter, after clicking on the SD 'card' icon:

If I unmount the SD card, the icon on the desktop will immediately
lose its "MNTD" tag. Also, the desktop icon will disappear if the
device is unplugged, similarly Pmount will refresh.

The desktop drive icons are highly configurable, by means of checkboxes
in the Puppy Event manager. In the above snapshot, there is one icon
for each drive, but you can configure for one icon for each partition,
and you can immediately mount a partition and launch ROX-Filer just by
clicking on an icon. There is also mouse-over information and a
right-click menu. This snapshot shows individual icons for each
partition and a mouse-over information (on sda2, but the mouse-pointer
did not show up in the screen snapshot):

At the time of writing, the default configuration is to display an
icon for each partition and to immediately mount and launch ROX-Filer
upon a mouse-click, which is probably the most friendly for
Windows-refugees. Note that a right-click on an icon is a quick way of
unmounting it.