# PCMCIA not loading nor unloading the modules!

## kirill

1st: everything is working, I get the modules loaded by hands...

2nd: my pcmcia is actually a pcmcia-pci bridge, so this is not so laptop

the problem is that when /etc/init.d/pcmcia , no modules get loaded and starting of pcmcia failes

also, after I load the modules by hands, start the pcmcia and stop it, it doesn't unload the modules   :Sad: 

here is how my /etc/conf.d/pcmcia looks like:

```
# more /etc/conf.d/pcmcia

# Should be either i82365 or tcic

PCMCIA=yes

PCIC=i82365

# Put socket driver timing parameters here

PCIC_OPTS="fast_pci=1 irq_mode=1"

# Put pcmcia_core options here

CORE_OPTS=

# Put cardmgr options here

CARDMGR_OPTS=

# To set the PCMCIA scheme at startup...

SCHEME=

```

as I said, it's all fixed now, my pcmcia works, but it was really a pain in my a*s before I got it worked out. I had to append some options to PCIC_OPTS and it didn't work, cause pcmcia startup script didn't seem to look the conf.d/pcmcia file   :Surprised: 

is there any fix to this? how to get modules loaded when pcmcia is start up?

...and sorry my bad english    :Confused: 

----------

## masseya

Did you add the lines 

```
depend() {

   need pcmcia

}
```

to your /etc/conf.d/pcmcia file as mentioned in the Installation Guide?  I didn't see it there, but I thought I would ask.

----------

## kirill

The Installation guide tells you to add need pcmcia to a net.ethx -file.

I'm using my wlan-card through pcmcia, but the problem is that it's PCMCIA which gets loaded first, and after it initialized my wlan-card with cardmgr -f, it attempts to run /etc/init.d/net.wlan0...

I didn't even have that file (net.wlan0), and just made a copy of my net.eth0.

There are the following lines on the top of my net.wlan0:

```

#for pcmcia users. note that pcmcia must be added to the same

#runlevel as the net.* script that needs it.

depend() {

        use pcmcia

}

```

I dont think changing this to need pcmcia would help either, cause it's pcmcia that gets loaded before net.wlan0 in the 1st place  :Sad: 

I also added this line into /etc/conf.d/net:

```
iface_wlan0="dhcp"
```

...so that the net.wlan0 -script actually works.

Now, because /etc/init.d/pcmcia tries to execute my /etc/init.d/net.wlan0, it's really pointless to rc-update add net.wlan0 default  :Sad: 

This whole d*mn pcmcia-setup really bothers me. Why not to let pcmcia just use it's own /etc/pcmcia/networks.opts to set up network connections?  :Confused: 

On the other hand, it would be nice, if I could just add my net.wlan0 to the default runlevel, and, when executed, it would use/need pcmcia, and that one would load the appropriate modules.

P.S. I actually haven't yet tried the last way  :Wink: 

----------

## masseya

Sorry for the confusion.  I was trying to ask if you had added it to your net.whatever file in /etc/init.d/ and got messed up.    :Embarassed: 

I would try that last way.  I think I see your reasoning, but I don't know why your pcmcia file would try and start /etc/init.d/net.wlan0.  I would think that it should be the other way around, especially if /etc/init.d/net.wlan0 depends on having pcmcia.  Maybe if you add it to the default runlevel this will happen and all will be right with the world?

----------

## kirill

I tried it now, this is how it goes (with need pcmcia in net.wlan0:

```

# modprobe i82365

Aug 14 19:47:01 cinderella kernel: Linux PCMCIA Card Services 3.1.33

Aug 14 19:47:01 cinderella kernel:   kernel build: 2.4.19 #1 Thu Aug 8 13:39:11 EEST 2002

Aug 14 19:47:01 cinderella kernel:   options:  [pci] [cardbus]

Aug 14 19:47:01 cinderella kernel: Intel ISA/PCI/CardBus PCIC probe:

Aug 14 19:47:01 cinderella kernel: PCI: Found IRQ 9 for device 00:12.0

Aug 14 19:47:01 cinderella kernel:   Cirrus PD6729 rev 00 PCI-to-PCMCIA at slot 00:12, port 0x6600

Aug 14 19:47:01 cinderella kernel:     host opts [0]: [ring] [pci irq 9] [1/5/0] [1/20/0]

Aug 14 19:47:01 cinderella kernel:     host opts [1]: [ring] [pci irq 9] [1/5/0] [1/20/0]

Aug 14 19:47:01 cinderella kernel:     PCI card interrupts, PCI status changes

# modprobe ds

# /etc/init.d/net.wlan0 start

 * Starting pcmcia...

cardmgr[15619]: watching 2 sockets                                          [ ok ]

 * Bringing wlan0 up...

 * Failed to bring wlan0 up                                                 [ !! ]

Aug 14 19:48:49 cinderella cardmgr[15619]: watching 2 sockets

Aug 14 19:48:49 cinderella cardmgr[15620]: starting, version is 3.1.33

Aug 14 19:48:49 cinderella kernel: cs: memory probe 0x0d0000-0x0dffff: clean.

Aug 14 19:48:49 cinderella cardmgr[15620]: socket 0: Samsung SWL2000-N 11Mb/s 802.11b WLAN Card

Aug 14 19:48:49 cinderella modprobe: modprobe: Can't locate module wlan0

Aug 14 19:48:49 cinderella dhcpcd[15625]: dhcpStart: ioctl SIOCGIFHWADDR: No such device

Aug 14 19:48:49 cinderella cardmgr[15620]: executing: 'modprobe prism2_cs'

Aug 14 19:48:49 cinderella kernel: init_module: prism2_cs.o: 0.1.15-pre1 Loaded

Aug 14 19:48:49 cinderella kernel: init_module: dev_info is: prism2_cs

Aug 14 19:48:49 cinderella cardmgr[15620]: executing: './wlan-ng start wlan0'

Aug 14 19:48:49 cinderella kernel: cs: IO port probe 0x0100-0x04ff: excluding 0x170-0x177 0x370-0x37f 0x

3c0-0x3df 0x4d0-0x4d7

Aug 14 19:48:49 cinderella kernel: cs: IO port probe 0x0178-0x036f: clean.

Aug 14 19:48:49 cinderella kernel: cs: IO port probe 0x0380-0x03bf: clean.

Aug 14 19:48:49 cinderella kernel: cs: IO port probe 0x03e0-0x04cf: clean.

Aug 14 19:48:49 cinderella kernel: cs: IO port probe 0x04d8-0x04ff: clean.

Aug 14 19:48:49 cinderella kernel: cs: IO port probe 0x0800-0x08ff: clean.

Aug 14 19:48:49 cinderella kernel: cs: IO port probe 0x0a00-0x0aff: excluding 0xa20-0xa37

Aug 14 19:48:49 cinderella kernel: cs: IO port probe 0x0a38-0x0aff: clean.

Aug 14 19:48:49 cinderella kernel: cs: IO port probe 0x0c00-0x0cff: clean.

Aug 14 19:48:49 cinderella kernel: prism2_cs: index 0x01: Vcc 3.3, irq 9, io 0x0100-0x013f

Aug 14 19:48:49 cinderella kernel: ident: nic h/w: id=0x8002 1.0.1

Aug 14 19:48:49 cinderella kernel: ident: pri f/w: id=0x15 0.3.0

Aug 14 19:48:49 cinderella kernel: ident: sta f/w: id=0x1f 0.8.3

Aug 14 19:48:49 cinderella kernel: MFI:SUP:role=0x00:id=0x01:var=0x01:b/t=1/1

Aug 14 19:48:49 cinderella kernel: CFI:SUP:role=0x00:id=0x02:var=0x01:b/t=1/1

Aug 14 19:48:49 cinderella kernel: PRI:SUP:role=0x00:id=0x03:var=0x01:b/t=1/2

Aug 14 19:48:49 cinderella kernel: STA:SUP:role=0x00:id=0x04:var=0x01:b/t=1/6

Aug 14 19:48:49 cinderella kernel: PRI-CFI:ACT:role=0x01:id=0x02:var=0x01:b/t=1/1

Aug 14 19:48:49 cinderella kernel: STA-CFI:ACT:role=0x01:id=0x02:var=0x01:b/t=1/1

Aug 14 19:48:49 cinderella kernel: STA-MFI:ACT:role=0x01:id=0x01:var=0x01:b/t=1/1

Aug 14 19:48:49 cinderella kernel: Prism2 card SN: 99SA01000000

Aug 14 19:48:49 cinderella cardmgr[15620]: + message=lnxreq_hostwep

Aug 14 19:48:49 cinderella cardmgr[15620]: +   decrypt=false

Aug 14 19:48:49 cinderella cardmgr[15620]: +   encrypt=false

Aug 14 19:48:50 cinderella cardmgr[15620]: + stty: standard input: Invalid argument

Aug 14 19:48:50 cinderella cardmgr[15620]: +  ^[[32;01m*^[[0m Bringing wlan0 up...

Aug 14 19:48:51 cinderella cardmgr[15620]: + ^[[A^[[-7G  ^[[34;01m[ ^[[32;01mok ^[[34;01m]^[[0m

```

Still I need to load the modules by hand or /etc/init.d/net.wlan0 would just fail with a bunch of errors  :Sad: 

----------

## rac

Do you have an entry in /etc/modules.d/aliases for wlan0?

----------

## kirill

 *rac wrote:*   

> Do you have an entry in /etc/modules.d/aliases for wlan0?

 

No I don't, cause I think it's pcmcia's job to probe for the card and load the apropriate modules (which it does...)

----------

## rac

I saw this line:  *Quote:*   

> Aug 14 19:48:49 cinderella modprobe: modprobe: Can't locate module wlan0

 

...and I thought that might be the problem.  Which modules do you have to load by hand?

----------

## kirill

It looks like I didnt explain everything clearly   :Laughing: 

Here is what I load by hands (the pcmcia-modules)

 *kirill wrote:*   

> I tried it now, this is how it goes (with need pcmcia in net.wlan0:
> 
> ```
> 
> # modprobe i82365
> ...

 

wlan-card's modules get loaded by pcmcia:

```

Aug 14 19:48:49 cinderella cardmgr[15620]: executing: 'modprobe prism2_cs' 

Aug 14 19:48:49 cinderella kernel: init_module: prism2_cs.o: 0.1.15-pre1 Loaded 

```

prism2_cs is the module for my wlan card. It's from the linux-wlan package by AbsoluteValue Systems (www.linux-wlan.org)   :Exclamation: 

----------

## rac

 *kirill wrote:*   

> Here is what I load by hands (the pcmcia-modules)
> 
> ```
> 
> # modprobe i82365
> ...

 

How about if you added these to /etc/modules.autoload, or is this not what you want either?  It still wouldn't unload them, I guess, but it might make your life a little easier.

 *Quote:*   

> prism2_cs is the module for my wlan card. It's from the linux-wlan package by AbsoluteValue Systems (www.linux-wlan.org)  

 

Cool - the only time I did any kernel hacking that actually got used by anybody.  I doubt it's still listed, because it's ancient history now, but I went to a presentation Mark Matthews did at the first LinuxWorld in San Francisco, was instantly hooked on the idea, ordered two ZoomAir cards, picked up a 486 laptop from a company that was throwing them away for about US $100, turned it into a wireless/wired bridge, and then discovered that it didn't work on my Thinkpad and didn't work with kernel 2.2 (only supported 2.0 at that time).  So I was sufficiently motivated to learn how Linux device drivers work and I fixed it and sent him patches, and was gratified to see my name in a driver changelog.

----------

## kirill

 *rac wrote:*   

> 
> 
> ```
> 
> # modprobe i82365
> ...

 

Actually that's what I did, since I couldn't come up with any better solution.

Anyway my original question was that it (pcmcia) doesn't load the modules when starting the init-script, doesn't load modules as it does in other distros. The problem with loading some modules by hand (or using /etcmodules.autoload), is that you'll also need to specify any extra options into /etc/modules.conf. Those options belong (in pcmcia's case) into /etc/conf.d/pcmcia, which doesn't get loaded (at least here).

The reason why pcmcia's startup-config-file (/etc/conf.d/pcmcia) should get read by the pcmcia, is because when you read the PCMCIA-HOWTO or some other documents, they're all telling you to modify your distro's specific startup-config-file  :Wink: 

 *rac wrote:*   

> 
> 
>  *kirill wrote:*   prism2_cs is the module for my wlan card. It's from the linux-wlan package by AbsoluteValue Systems (www.linux-wlan.org)   
> 
> Cool - the only time I did any kernel hacking that actually got used by anybody.  I doubt it's still listed, because it's ancient history now, but I went to a presentation Mark Matthews did at the first LinuxWorld in San Francisco, was instantly hooked on the idea, ordered two ZoomAir cards, picked up a 486 laptop from a company that was throwing them away for about US $100, turned it into a wireless/wired bridge, and then discovered that it didn't work on my Thinkpad and didn't work with kernel 2.2 (only supported 2.0 at that time).  So I was sufficiently motivated to learn how Linux device drivers work and I fixed it and sent him patches, and was gratified to see my name in a driver changelog.

 

Nice, the driver is working great here. thanks for your job guys  :Smile: 

----------

## rac

Perhaps a very basic and pointless question, but are you using the kernel's pcmcia code or pcmcia-cs?  A forum search for "pcmcia and modules" turned up 70 threads, among which were this, this, this, and this, in case any of these are of some use to you.

----------

## kirill

I'm using the pcmcia-cs package, together with the linux-wlan package for my card. All the kernel stuff is naturally disabled, as I've been told it's the best to do in many thousand docs  :Wink: 

Still, in all those threads people are talking about modprobe i82365..., putting the pcmcia modules into /etc/modules.autoload.

But I think (and I really believe) that pcmcia should be able to load the modules by itself because I've seen this happening before.

I've used LFS and the modules got loaded by the init.d -script and the options I've put as PCIC_OPTS into /etc/sysconfig/pcmcia were applied to the i82365 module. LFS doesnt really have any own mechanisms, which would help pcmcia with the modules. I just did the make config, make all, make install when installing pcmcia-cs, and used the init.d -scripts that came with the pcmcia-cs package...

NOT that I couldn't live without that now in Gentoo, since everything really is working. I'm just wondering if anyone else is/was having problems with this issue, because they need some extra options for their pcmcia-bridges.

----------

## rac

 *kirill wrote:*   

> But I think (and I really believe) that pcmcia should be able to load the modules by itself because I've seen this happening before.

 

Well, then you might want to consider filing a bug report against pcmcia-cs on bugs.gentoo.org.  I think that if you reference this thread, you will certainly be able to demonstrate that you have researched the issue thoroughly.  :Smile: 

----------

## kirill

I queried on bugs.gentoo.org for the first time today   :Cool:  and found this:

https://bugs.gentoo.org/show_bug.cgi?id=6838 which seems to be commited just yesterday. It contains patches to the pcmcia init.d script.

Works for me!

----------

