Hotplugging improved

Still at Dalwallinu! It's Friday morning and I'm at the Telecentre again, waiting for my car to be ready.

I have done some more work on the new hotplugging support for Puppy4.

I have had to make some decisions about not supporting backwards compatibility:

1. Kernels that require the old pcmcia-cs package will not be supported. This includes the 2.6.21.7 kernel used in 4.00 and 3.01 -- it would have to be recompiled to support the new pcmcia system.
2. It requires too much clumsy if-else code to keep supporting the old /proc/ide system (in which IDE drives show up as /dev/hd*). Now moving to the unified /dev/sd* and /dev/sr* PATA/SATA system.

I mentioned in my previous post that I had to stay overnight at Dalwallinu, and the mechanic provided a couch to sleep on. He is very interested in Puppy Linux, and of course I had to give a demonstration... now, that turned out to be a very pleasant surprise. He has an Acer Travelmate 2350 laptop, and he is on Internet dialup. Everything worked, even the modem. I prepared him by saying that there was only a 1 in 5 chance that his modem would work, it being internal to the laptop -- but much to my surprise, it worked right off, fully autodetected and setup by Puppy. Amazing!

The Windows installation on his laptop is really sick. It takes ages to do anything. He said that it was faster once upon a time.

Anyway, I digress. This morning I have been sitting at a desk, still in Dalwallinu, working on my laptop. The mechanic also runs the local freight deliveries, meaning more delay, but I'm hoping that he can finish my car early afternoon ...if those darn head bolts have arrived!

All prior puppies only had "coldplugging", module loading at bootup, except for PCMCIA which had a daemon that could detect an inserted card and load an appropriate module. Now, I have implemented true hotplugging, for anything that the kernel generates a "uevent" for. As a really basic example, say that the 'usb-storage' module is not loaded, so there is no support for drives on the USB bus. With the new system, plug in a USB drive, and the 'usb-storage' driver is automatically loaded.

This is achieved by the /sbin/pup_eventd daemon, which receives uevents from the kernel via the /sbin/hotplug2stdout program.

However, there is one hiccup in nice scheme. The kernel does not generate a uevent for insertion of a CD or DVD. I want Puppy to know immediately when a CD/DVD is inserted, and place an icon in the tray and also bring up Pmount. The only way that I know how to do it is with a periodic polling loop, so in this one case that's what I've done. The pup_eventd script checks the optical drives every 2 seconds. Except if Gxine or Mplayer are running, as apparently the probe of the optical drive can cause a flicker if playing a DVD video.

The end result of all of this is intended to offer equivalent behaviour to other major distros and Windows. When a Windows user plugs in a CD, DVD or any external device, something happens. A window comes up asking what do you want to do with this. In some cases, an icon appears in the tray. In all prior puppies, you plug something in ...and nothing happens. Now, for any kind of storage device, an appropriate icon appears in the tray, and Pmount pops up with the appropriate drive on the top tab.

I could probably offer to open an appropriate application also. For example, a DVD with video on it, popup Pmount with also a button to start the media player. That's for the future.

Posted on 16 May 2008, 11:52


Comments:

Posted on 16 May 2008, 12:19 by AlphaSurfer
Amazing Work!
Barry,
I wish I was good at all that technical/programing stuff. Your doing excellent work and I can't wait to test drive a alpha/beta version. Thanks for your dedication to puppy. I fell in love with puppylinux a few years back and I read your blog daily.

Best Wishes From Milwaukee, Wisconsin (USA)

AlphaSurfer


Posted on 16 May 2008, 12:45 by dogone
Avoiding "Windowisms"
Barry, hot-plugging in general is certainly the way to go. Windows has set the bar in this regard. But Windows pop-ups can also be very annoying and careful thought must go into how best to handle these events.

Personally, I prefer to be alerted to the event - only - without the OS trying to guess my intentions. That seems a good compromise. Tell me you've recognized the disk (for example) and let me take it from there.

Windows makes good use of tray icons in this regard but this too must be managed carefully. Perhaps temporary panel alerts would suffice - ignored, they go away.


Posted on 16 May 2008, 15:27 by BarryK
Windows popups
I'm posting from home ...finally.

Oh boy, Windows popups are incredibly annoying. Don't worry, I'm very aware of this and will keep it to the absolute minimum.

One of my relatives has disabled Windows auto-updating, but it keeps popping up a message telling her that auto-updating is turned off and that would she like to turn it on. So many other stupid little things keep popping up -- worldwide, the loss of productivity due to people clicking the close buttons on those things must be incredible.


Posted on 16 May 2008, 17:28 by armandol
puppylize win, instead!
oh please no stupid "waow!pop-ups "ala win$!" that are always in the way, disturbing attention and eating power as much as productivity!

I'm obliged to have XP on an other partition, and believe me I try to "puppylize" it as much as possible, work as fast as on puppylinux (2.14...).

Briefly, I think automounting must be balanced by an auto-UN-mounting, which is not the case anywhere.
If it can be achieved, it'll be ideal, otherwise, I prefer to have the possibility at least to keep this action 'symmetrical', and avoid running/polling processes in the background.

thanks, and keep on the good work Barry


Posted on 16 May 2008, 17:34 by coolpup
Linux Kernel 2.6.25.4
The latest stable version of the Linux kernel.
http://www.kernel.org/


Posted on 16 May 2008, 17:38 by urban soul
os x
How does apple handle hotpluging?
- When a storage device is plugged in nothing happens, but it is automounted (must-have!) and to show this an icon is shown in the finder.
- However, when a DVD is inserted it starts playing back subito.
- When I plug in a network device it tries to connect to the internet.

But NO POPUPS. You cannot learn good GUI programming from M$. No. Simply not possible.


Posted on 16 May 2008, 17:51 by DonT
Digression
Barry, another pleasant digression, if you don't mind.

I'm an American traveling in the northern, somewhat remote, part of Thailand. Early one morning the guesthouse computer would not boot into Windows. Damaged hard drive! ...Several guests badly needing email and search!! What to do? ...Booted Puppy. ... Two months, now. (New hard drive still hasn't arrived.) Guest's comments have been broad ranged, from positive to incredulous. The owner's teen-aged daughter is now very proficient in Puppy. And, she selected the big-eyed, cuddly puppy to display on the screen. It warms the heart of all travelers that sit down to do their email.

Great work, Mr Kauler. You're appreciated around the world.




Posted on 16 May 2008, 17:51 by armandol
pop-up
On ubuntu, as an example, when a device is plugged in, an icon appears on the desktop, no pop-up.
But still, imposed pop-ups are annoying, like 'updates are available" etc...




Posted on 16 May 2008, 18:39 by capoverde
Puppy's quality level.
Barry, if even *You* were amazed at how well Puppy worked in Dalwallinu, the quality level reached by your wonderful creature is clearly beyond words!

Just some more well-done localization, and Puppy can become the top-candidate worldwide free OS. Who can resist a Puppy's charm?


Posted on 16 May 2008, 19:00 by BarryK
No auto-mounting
I still have reservations about automounting, so that is not done.

My first implementation was the lowest level of intrusion. You plug in a drive, and an icon appears in the tray. If some clicks on this icon, Pmount will popup. However after playing with this awhile, I decided it is not quite enough.

Puppy needs to be be just a little bit more proactive, as well as the icon, Pmount also starts up. So Puppy is not doing anything behind-your-back, no automounting, just providing what you would most likely do anyway, start Pmount, or refresh Pmount.


Posted on 16 May 2008, 19:13 by coolpup
re No Auto-Mounting
Perfect!


Posted on 16 May 2008, 20:27 by orlando_ombzzz
exchange
"He is very interested in Puppy Linux, and of course I had to give a demonstration"

why don't you exchange a puppy for the expenses of your car fix ?

:-))


Posted on 16 May 2008, 20:41 by Bosco Bearbank
a request and a question
I fully understand the need to move to the 2.6.25 kernel; I'd like to request that you continue to include the old rt2500 and ath_pci (madwifi) wireless drivers so I can continue to connect my puppy-running laptop and desktop machines to the Internet.

And now for a question - does polling the optical drive(s) every two seconds take up significantly less time than polling the optical drive(s) and the usb ports?


Posted on 16 May 2008, 21:27 by jcoder24
starting pmount
can this be made configurable so you disable starting pmount when hotplugging?


Posted on 16 May 2008, 22:33 by puppyfan
hotplugging
..my old hardware loves puppy and i love my old hardware...

..hotplugging would be nice to have as long as you can turn it completely off. At least for me it has no benefit at all, cause i like to keep control over my system.

anyway...Barry, if there would be a nobel-prize for "creative computing", you should get it.




Posted on 16 May 2008, 23:39 by kirk
pup_eventd
Does your new hotplugging setup keep fstab updated?




Posted on 17 May 2008, 2:08 by Prit1
Old Kernel?
Barry,

Sounds like this does not work for the kernel in 4.00. My laptops work flawlessly only in the this kernel.

Prit


Posted on 17 May 2008, 8:15 by BarryK
Replies
jcoder24,
yes, that's a thought. I'll see if I can make that switchable.

kirk,
fstab, no. But it could be made to do so.

prit1,
Well, the new hotplugging will work with the 2.6.21.7 kernel used in 3.01 and 4.00. The kernel would have to be recompiled to support pcmciautils (the new pcmcia system) rather than pcmcia-cs, and as far as the old /dev/hd* drive support... maybe I can keep supporting that awhile longer... we will see how compatible the 2.6.25.4 kernel is on old hardware when the alpha comes out before I decide to keep the old 2.6.21.7 kernel alive.