How to identify SD-cards and flash sticks as being such?

Looking at the usbmount package. I see that it includes the text: "USBmount is intended as a lightweight solution which is independent of a desktop environment. Users which would like an icon to appear when an USB device is plugged in should use the pmount and hal packages instead."

I really don't want to break normal operation. Never mind. Since udev (and HAL unless it's been merged into udev) is standard on recent distros, the log search method should be robust. I'll just include a prompt to re-insert the device (if it was left in during reboot or something).

#!/bin/bash # burn specified iso to usb flash (verifies that it IS on USB) fail() { echo Error: $*; exit 1; } [[ -z $(grep '\bdisk\b' < &1 | grep ID_BUS=usb) ]] \ && fail Please re-insert the USB device mod=$(udevadm info /dev/$dv | grep 'ID_MODEL=' | sed 's/.*ID_MODEL=//') read -p "Burn $1 into \"$mod\" at /dev/$dv [Yn]" yn [[ "$yn" == [nN]* ]] && exit 1 [[ "$1" == ?(*.zip|*.gz) ]] && fz=funzip || fz='tee' pv -tpreb "$1" | $fz | dd bs=1M oflag=dsync of="/dev/$dv"

Reply to
Dave Farrance
Loading thread data ...

Yes... but what if user plugs in USB device that is not recognized for some reason? Like deffective device. I received one USB card reader that only lights up its LEDs and does nothing more. No info in logs. It is not detected. Well... as you've mentioned... at the end user has to decide. :)

Reply to
Nikolaj Lazic

One could make use of the kernel time in dmesg output. e.g. ignore block devices attached within 2 minutes after system start...

Still applies though

Reply to
Stefan Enzinger

Yes. If you look at my second version of the script that I put in a reply to Rob, you'll see that if the last inserted /dev/sd? device isn't a USB device, you'll get a prompt to re-insert it. Then the user is prompted with the device model name as a final check.

I think that's better that giving the user a deadline to complete an action, given the holdups that are normally encountered when you're developing things with computers, and in any case, uptime comparisons are awkward to parse and would require several extra lines of code.

Reply to
Dave Farrance

Perhaps one thing to consider is that a lot of built in SD card readers on laptops aren't USB. My Dell Latitude at work for example shows a "Standard Compliant SD Host Controller" connected to PCI Express.

Reply to
Anssi Saari

OK. The one internal SD reader that I tried (on an Acer Revo mini-PC) did show up as USB.

Reply to
Dave Farrance

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.