Skip to contentSkip to conversation

Is there any docs or design guides for adding hotplugablity to drivers?

DISCUSSION Mark Atwood 5 participants 5 messages Jul 1, 2002 – Jul 2, 2002

lore
Share & tools
lore
#0 lore raw

Other than just reading the source, of course.

I'm working on a Linux appliance, and I feel that using hotplug events to signal things like moving in range of an 802.11 access point, getting carrier on an ethernet port, and someone plugging a cable into the serial port, would make a lot of stuff much much easier.

I suspect that a lot of this would be useful out in the "regular linux" world as well. Especially the ethernet carrier detect. (Windows can do it, and will invoke DHCP when you plug in an ethernet cable, it would be nice if Linux can do the same.)

Signature · 13 lines
Mark Atwood   | Well done is better than well said.
[email protected] | 
http://www.pobox.com/~mra


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#1 lore raw

Re: Is there any docs or design guides for adding hotplugablity to

Quoted 1 line · Mark Atwood

Other than just reading the source, of course.

Start there, and then ask questions. The docs that exist are on the http://linux-hotplug.sf.net website, and in the source code for the various subsystems that do hotplugging.

Inside the kernel, one basically invokes the program identified by /proc/sys/kernel/hotplug, using a simple convention (only argv[1] is standard) with call_usermodehelper() to report those events. Normally one wants the events to be reported by some subsystem/framework code, rather than individual drivers, since it's a lose to expect every driver be changed.

Quoted 9 lines

I'm working on a Linux appliance, and I feel that using hotplug events to signal things like moving in range of an 802.11 access point, getting carrier on an ethernet port, and someone plugging a cable into the serial port, would make a lot of stuff much much easier.

I suspect that a lot of this would be useful out in the "regular linux" world as well. Especially the ethernet carrier detect. (Windows can do it, and will invoke DHCP when you plug in an ethernet cable, it would be nice if Linux can do the same.)

I agree that carrier detect would be good to report through hotplug, since that's actually the relevant event. Since the network drivers don't actually agree on an initialization model (some register before going "up", others don't -- see the special casing in the /etc/hotplug/net.agent script for a start), some of the basic issues there relate to the networking stack.

Last I looked, the network stack didn't actually treat carrier detect as an interesting event, which makes such changes be unduly complex. If you're interested in updating the 2.5 stack to do such things, I'd suggest discussing this on the netdev list and shipping code before the planned feature freeze on Hallowe'en... :)

- Dave

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Mark Atwood

Date: 01 Jul 2002 14:00:19 -0700
From: Mark Atwood <[email protected]>

Other than just reading the source, of course.

I'm working on a Linux appliance, and I feel that using hotplug events to signal things like moving in range of an 802.11 access point, getting carrier on an ethernet port, and someone plugging a cable into the serial port, would make a lot of stuff much much easier.

I suspect that a lot of this would be useful out in the "regular linux" world as well. Especially the ethernet carrier detect. (Windows can do it, and will invoke DHCP when you plug in an ethernet cable, it would be nice if Linux can do the same.)

I'm working on this. I've already implemented code to do carrier detect, although this only works on NICs that support MII. (Unfortunately the Lucent Prism II doesn't support MII; if anyone knows how to do carrier detect on non-MII NICs, I'd appreciate learning how.) See the Debian package "laptop-net" for details:

http://packages.debian.org/unstable/admin/laptop-net.html

This package also handles configuration and so forth.

However, there are N such Debian packages, each with a different set of features and a different configuration interface. What I'm currently working on is an event daemon to allow the functionality in these packages to be modularized. I plan to use this to provide a uniform event-signalling mechanism for all sorts of things, including networking and APM. The immediate application is a project underway here at MIT to improve our laptop infrastructure. But the mechanism is general enough to handle any kind of event.

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Mark Atwood
Quoted 15 lines · Chris Hanson

Date: 01 Jul 2002 14:00:19 -0700
From: Mark Atwood <[email protected]>

Other than just reading the source, of course.

I'm working on a Linux appliance, and I feel that using hotplug events to signal things like moving in range of an 802.11 access point, getting carrier on an ethernet port, and someone plugging a cable into the serial port, would make a lot of stuff much much easier.

I suspect that a lot of this would be useful out in the "regular linux" world as well. Especially the ethernet carrier detect. (Windows can do it, and will invoke DHCP when you plug in an ethernet cable, it would be nice if Linux can do the same.)

Quoted 5 lines

I'm working on this. I've already implemented code to do carrier detect, although this only works on NICs that support MII. (Unfortunately the Lucent Prism II doesn't support MII; if anyone knows how to do carrier detect on non-MII NICs, I'd appreciate learning how.) See the Debian package "laptop-net" for details:

The concept of carrier detect is a bit marginal on a non-wired links. Normally you need to associate to be considered on the link.

Note that most newish network cards do support carrier detect in some form. We even support it for most of the USB networking devices. You can see this using a proggie like ethtool (http://www.sf.net/projects/gkernel).

The way it works is that the driver does whatever magic it needs, and then signals to the networking stack using netif_carrier_on() and netif_carrier_off. The trivial solution is to add a call_usermodehelper() to the netif_carrier_[off,on] routines (in <linux/netdevice.h>. Unfortunately the call_usermodehelper() needs process context, and you can't assume that for the netif_carrier_[on|off] calls.

Brad

Signature · 11 lines
http://conf.linux.org.au. 22-25Jan2003. Perth, Australia. Birds in Black.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#4 lore raw
In reply to Mark Atwood
Quoted 2 lines · Mark Atwood

Other than just reading the source, of course.

Read the docs on the web site.
There was an older article in Linux Journal that detailed the subsystem quite well. And there was a paper presented at the 2001 Ottawa Linux Symposium that had much the same information.

Quoted 9 lines

I'm working on a Linux appliance, and I feel that using hotplug events to signal things like moving in range of an 802.11 access point, getting carrier on an ethernet port, and someone plugging a cable into the serial port, would make a lot of stuff much much easier.

I suspect that a lot of this would be useful out in the "regular linux" world as well. Especially the ethernet carrier detect. (Windows can do it, and will invoke DHCP when you plug in an ethernet cable, it would be nice if Linux can do the same.)

Ethtool can do much of what you are looking for it sounds like.

Hope this helps,

greg k-h

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel