[ltp] Ejecting Cardbus pc cards

Pablo Vera linux-thinkpad@linux-thinkpad.org
Fri, 19 Jan 2007 18:58:19 -0600


Daniel Skorka wrote:
> On Fri, Jan 19, 2007 at 01:01:05PM -0600, Pablo Vera wrote:
>> Is there a way to power down a Cardbus pc card before unplugging it ?, 
>> is it really necessary ?
>>
>> I know that I can "eject" a pcmcia card with:
>>
>>   pccardctl eject
>>
>> but this utility does not "eject" a Cardbus card, since it is not 
>> pcmcia, but pci.
> 
> You mean it refuses to do so? I vaguely remember from back when I used
> PCMCIA, that I did something like 'cardctl eject' before unplugging my
> ethernet card, which I believe was 32 bit.
> 
> If this method really doesn't work try digging around under /sys for the
> device and see if there is a file for ejecting it.

My mistake, "pccardctl eject" does power down the Cardbus card, but it 
needs to be run as root.  Anyway, after digging through /sys, I found 
the following folder:

   /sys/class/pcmcia_socket/pcmcia_socket0

which has the following files:

   card_eject
   card_insert
   ... and many more ...

If I type:

   echo 1 >/sys/class/pcmcia_socket/pcmcia_socket0/card_eject

the card powers down.  And with:

   echo 1 >/sys/class/pcmcia_socket/pcmcia_socket0/card_insert

the card powers up again as if I had just inserted it.


Thanks for the advice, and I hope this can be useful to someone else.

Pablo