Skip to contentSkip to conversation

efficient usb plug in notification

Buildroot shaleh at speakeasy.net 2 participants 3 messages Aug 6, 2008 – Aug 8, 2008

lore
Share & tools
lore
#1 lore raw
Quoted 6 lines

You can replace /sbin/hotplug with a shell script/program of your choice. This gets called by the kernel for every plug event. Just have your version of hotplug react to the plug events you care about. Then you "just" need to figure out how to interact between the hotplug script and your user space libraries, programs, etc.

Given the power concerns that we have, this may be the best idea. I'll have to look into what's passed to the hotplug script/program and see if we can get all the information from that. Thanx so much for this tip!

I'm moderately familiar with udev/dbus/hal but I have some reservations about using them due to the extra cycles taken up.

This hotplyg approach seems promising for power conscious platforms
assuming it provides enough information. A named pipe to our
application should solve this problem.

Thanx everyone for sharing your experience!

-Chris

author
#2 lore raw
Quoted 12 lines · Christopher Taylor
Quoted 6 lines

You can replace /sbin/hotplug with a shell script/program of your choice. This gets called by the kernel for every plug event. Just have your version of hotplug react to the plug events you care about. Then you "just" need to figure out how to interact between the hotplug script and your user space libraries, programs, etc.

Given the power concerns that we have, this may be the best idea. I'll have to look into what's passed to the hotplug script/program and see if we can get all the information from that. Thanx so much for this tip!

Quoted 7 lines

I'm moderately familiar with udev/dbus/hal but I have some reservations about using them due to the extra cycles taken up.

This hotplyg approach seems promising for power conscious platforms
assuming it provides enough information. A named pipe to our
application should solve this problem.

Everything comes in via the environment, so look there. Should have everything you need.

mdev just adds a /dev/$node and then calls a script with $MDEV=/dev/$node. Definitely not enough info and it depends on the device actually have an entry in /dev -- the usb devices I use do not.

I had our custom hotplug script call mdev when it is done so all of the device nodes get created correctly.