10

I have a headless debian (3.2.0-3-686-pae) to which I wanted to attach a standalone card reader to automatically process my pictures. The idea is that the reader will be plugged in all the time and I would just insert the SD card.

Unfortunately the card is not detected when I insert it.

  • the card reader is correctly recognized
  • when I connect the card reader with the SD card already inserted both are correctly recognized and the card is automatically mounted.

Therefore this is the action of inserting the card into a working card reader which is not recognized. There are no messages in /var/log/messages (nor anywhere else). When the card reader is inserted the messages are correct:

Aug  4 14:25:03 server kernel: [711743.411320] usb 1-6: USB disconnect, device number 5
Aug  4 14:25:12 server kernel: [711751.964021] usb 1-6: new high-speed USB device number 6 using ehci_hcd
Aug  4 14:25:12 server kernel: [711752.097364] usb 1-6: New USB device found, idVendor=058f, idProduct=6366
Aug  4 14:25:12 server kernel: [711752.097369] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Aug  4 14:25:12 server kernel: [711752.097373] usb 1-6: Product: Mass Storage Device
Aug  4 14:25:12 server kernel: [711752.097375] usb 1-6: Manufacturer: Generic
Aug  4 14:25:12 server kernel: [711752.097377] usb 1-6: SerialNumber: 058F63666433
Aug  4 14:25:12 server kernel: [711752.098062] scsi4 : usb-storage 1-6:1.0
Aug  4 14:25:13 server kernel: [711753.224612] scsi 4:0:0:0: Direct-Access     Multiple Card  Reader     1.00 PQ: 0 ANSI: 0
Aug  4 14:25:14 server kernel: [711753.810820] sd 4:0:0:0: [sdc] 1984000 512-byte logical blocks: (1.01 GB/968 MiB)
Aug  4 14:25:14 server kernel: [711753.811559] sd 4:0:0:0: [sdc] Write Protect is off
Aug  4 14:25:14 server kernel: [711753.829719]  sdc: sdc1
Aug  4 14:25:14 server kernel: [711753.840025] sd 4:0:0:0: [sdc] Attached SCSI removable disk

I was wondering if I am missing something somewhere (the behavior above is out of the box - I did not need to configure anything) -or- that the insertion of a card into an already-connected card reader is simply not recognized by design.


EDIT: While fora discussions claim that the lack of message is normal, it obviously works for some (thanks Piskvor nad darnir for the comments). I will leave the question unanswered and file a bug with Debian - updating this post if there is any progress.

EDIT: filed Bug#684306 (bugs.debian.org)

4
  • I can't find the original mails atm, but a year ago there was a discussion about this on a the FreeBSD mailing lists. The answer was that insertion can not be detected by the hardware. (or as you write: not recognized by design). The only workaround was to poll the device.
    – Hennes
    Aug 4, 2012 at 14:42
  • Hmmm...the card insertion event generates a "detected capacity change from 0 to 123456789" line in syslog for me (where 123456789 is card capacity in bytes, IIRC); not sure what is generating this (logged as "kernel"). Aug 8, 2012 at 13:42
  • @Piskvor: ah this is interesting. Which kernel are you on? I log everything and do not see this kind of message
    – WoJ
    Aug 8, 2012 at 14:02
  • @WoJ: 3.2.0-27; I currently don't have a SD card to try this and post the exact message. Aug 8, 2012 at 15:04

3 Answers 3

4

Here's how I've solved this problem:

  1. Install the udisks package
  2. Run udisks --poll-for-media

Via a udev rule I then trigger a script that takes care of downloading the data from my CF card automatically.

2
  • udisks does not exists anymore in most linux OS distros. Feb 2, 2023 at 12:15
  • @AdrianMaire it exists on Fedora, just installed it.
    – jcubic
    Oct 22, 2023 at 15:37
1

I suspect that polling for block devices are disabled.

check this value

cat /sys/module/block/parameters/events_dfl_poll_msecs

is its 0, make it 2000

echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs

Now run time detection should work.

Usually, the udev rules contain attributes to write 2000 at this node. So if that udev package is missing, install it.

0

EDIT: please disregard (see edit in the main question). I leave the "answer" so that the comments can refer to something)

Well, after having done a round through various fora it looks like that this is currently not possible. It looks like there is, technically, a way to have it done (as the insertion generates specific HW events) but this is not implemented. This is quite unfortunate as there are plenty of possible applications. In my case this is not too bad as the card reader is standalone but it gest tricky for built-in ones (though maybe in that case this is handled differently, I do not know as I do no have one)

3
  • I tried it on Arch and I have an entry in dmesg on card insertion/removal with the reader already plugged in. So, it is possible, out-of-the-box on the vanilla kernel.
    – darnir
    Aug 8, 2012 at 13:40
  • @darnir: what message do you get? Something similar to Piskvor's one (above)
    – WoJ
    Aug 8, 2012 at 14:03
  • dmesg output: [ 4366.893775] r592: IRQ: card removed [ 4375.765801] r592: IRQ: card added [ 4376.519845] memstick0: switching to 4-bit parallel mode [ 4376.523049] mspblk0: p1
    – darnir
    Aug 8, 2012 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .