pccard woes (probably rcNG buglet)

Emiel Kollof coolvibe at hackerheaven.org
Tue Oct 7 03:22:18 PDT 2003

Emiel Kollof wrote:

> Matthew Dillon wrote:


>> :Test case:
>> :
>> :1. Boot up, leave network pcmcia card out of the slot.
>> :2. Insert card, hear some nice beeps. Tail /var/log/messages to see if
>> :it gets detected and stuff.
>> :3. Monitor ifconfig to see if it gets an IP number (either from dhclient
>> :or otherwise).
>> :
>> :With a world/kernel as of last friday afternoon (CEST), the interface
>> :doesn't come up *at all*.
>>     Hmm.  The RC stuff could simply be some RCNG hookups that we haven't
>>     made.  Does it start pccardd up?  If not try starting it manually.

I've been poking around in some source and config files and the following is
what I found out:

Short version: 

/etc/pccard_ether has a few bugs

Long version:

pccardd is not to blame. It works fine, and parses /etc/defaults/pccard.conf
fine. I went looking in there to see what it does next. Observe this entry
(which is incindently for my 3com pcmcia card):

# 3Com Megahertz 574B same as 3Com Fast Etherlink 3C574B
card "3Com" "Megahertz 574B"
        config  auto "ep" ? 0x1
        insert  /etc/pccard_ether $device start
        remove  /etc/pccard_ether $device stop

Allright, so it starts up /etc/pccard_ether ep0 start. And lo and behold,
when I try to initialize my ep0 card with that script, it doesn't work.
Examining the file shows that I have to use some vars in rc.conf I never
seen before. Browsing through the rc.conf manpage I saw I need to set
'removable_interfaces' and 'pccard_ifconfig'.

I have to note that the pccard_ether script is somewhat buggy in places. It
doesn't kill dhclient correctly on ejection, for example. This is because
there's a bug in the dhcp_kill function in the pccard_ether script. Lines
35 to 38 in that script don't get executed, so it just starts a plain
dhclient with no interface specific pidfile. The attached patch fixes the
dhcp_stop function, albeit in a slightly hackish way. It just detects the
default dhclient pidfile and uses the pid in that to kill dhclient. It
still doesn't take the interface down properly, but that's a bit of a
non-issue, since on ejection the interface is gone anyway.

So, in conclusion, to get pcmcia network cards to work, one needs to set the
following in rc.conf:

removable_interfaces="<interface name>"
pccard_ifconfig="inet bla.bla.bla.bla netmask bla.bla.bla"

Which is different from the "old way" with which you just set
ifconfig_<interface> and was done with it. Oh well... 

I liked the old way better though, but I'm just an old fart that fears
change (just kidding) ;)

Emiel--- /usr/src/etc/pccard_ether	Thu Jul 24 08:35:32 2003
+++ pccard_ether	Tue Oct  7 12:17:38 2003
@@ -11,6 +11,8 @@
 stop_dhcp() {
 	if [ -s /var/run/dhclient.${interface}.pid ]; then
+	elif [ -s /var/run/dhclient.pid ]; then
+		pidfile="/var/run/dhclient.pid"
 	elif [ -s /var/run/dhcpc.${interface}.pid ]; then

More information about the Submit mailing list