FW: how to deal with plug & unplug SD card

David Zeuthen david at fubar.dk
Thu Jul 7 08:04:15 PDT 2005


Hi,

Sorry for the lag,


> Hello All:
> 
>          I am writing a storage driver for the chip of our company,
> which can access the SD card.
> 
> It is a pci chip. The framework of the driver just like that of
> usb-storage driver, 
> 
> The question is how to deal with such case, when we load the driver
> before the SD card was inserted into
> 
> the slot, then we insert the SD card, how to let “hald” to check media
> change.

Right. So, the way this works under Linux (and other UNIX-like systems I
believe) is that the driver shall return ENOMEDIUM when user space does
the open(2). Basically, user space will have to poll for changes mostly
because some devices can only let the host initiate commands. Indeed,
hald polls for media changes, see hald/linux2/addons/addon-storage.c for
details.

HTH,
David

> 

_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list