usb card reader. Which event is generated when medium is inserted?

From: Andy Richardson (andy_at_mrbumpy.co.uk)
Date: 10/31/05

  • Next message: General Schvantzkoph: "Re: suggested motherboards for Opteron 175"
    Date: Mon, 31 Oct 2005 12:16:27 +0000
    
    

    Hi folks. I have been set a task which I can complete but I'd like to
    know if there is a more elegant way.

    I have been asked to provide a simple camera card viewer for a
    photography shop.
    The aim is for the customer to plug in the card into a usb lots-in-1
    card reader and this launches a window showing thumbnails of any images
    on their card.

    I need to know if there is any event generated when a card is inserted.

    Easy with a pen drive, dmesg tells me when a usb pendrive has been
    plugged in and tells me the device name to use (e.g. /dev/sde1 )

    Unfortunately nothing seems to show when a card is put into the reader.
    I usually try a series of mount commands until one doesn't give a "no
    medium found" error.
    Even /proc/partitions seems no use because it knows nothing until after
    I have checked for the medium myself anyway.

    autofs doesn't seem to do what I'm after. It mounts a device only when
    you go looking for it.

    udev is more about detecting your different pendrives and mounting them
    differently depending on which device you have plugged in.

    At the moment I'm thinking of writing a script which continually
    attempts to mount a series of /dev/sd? until one succeeds and then
    search for images etc..
    Alternatively I could use autofs and keep trying to view the directories
    until eventually one is not empty.. and succeeds.

    In short....... is there a more elegant solution?
    I'm running VectorLinux with kernel 2.6.14
    thanks

    -- 
    Andy Richardson
    Never criticize a man 'til you've walked a mile in his shoes.
    After that, you can say what you like..
    'cos you're a mile away and you've got his shoes.
    

  • Next message: General Schvantzkoph: "Re: suggested motherboards for Opteron 175"

    Relevant Pages

    • usb card reader. Which event is generated when medium is inserted?
      ... know if there is a more elegant way. ... The aim is for the customer to plug in the card into a usb lots-in-1 ... I usually try a series of mount commands until one doesn't give a "no ... Never criticize a man 'til you've walked a mile in his shoes. ...
      (comp.os.linux.misc)
    • Re: Focus on Design: Card Tricks Sep 07
      ... is the elegant and simple Card Tricks Block. ... Several quilters here have commented that it is a simple block to make ... great Card Tricks block so they can only make blah blocks at best, ...
      (rec.crafts.textiles.quilting)
    • bash script strange behaviour on card-reader mounting
      ... If I insert the card before running the script, ... Any ideas why the mount command doesn't work once it has failed once ... Never criticize a man 'til you've walked a mile in his shoes. ...
      (comp.os.linux.misc)
    • Re: 2.6.0-test9 VFAT problem
      ... and report whatever goes wrong in that case. ... I start the system insert my 64mb Olympus SM into my Belkin SM reader ... mount my 16mb Olympus SM card in my Belkin reader. ... If I try to mount my 64mb card I get 'no media found'. ...
      (Linux-Kernel)
    • Re: PCMCIA cards in laptops: do they need to be mounted/unmounted when installed/removed?
      ... mount/umount are file system management commands. ... mount - mount a file system ... If in need to check the current status of that PC card 1 I ...
      (Debian-User)