[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Retrieving the signal while plugging a USB key



In <[🔎] 4A0052F6.2000909@gmail.com>, User Debian wrote:
>I would like to know if there is a command I can type with Debian to
>detect if a USB key has physically connected to the computer.

Check dmesg or /var/log/messages.  When I plugged in my USB key I got this 
appended:
usb 5-3: new high speed USB device using ehci_hcd and address 2
usb 5-3: configuration #1 chosen from 1 choice
usb 5-3: New USB device found, idVendor=0930, idProduct=6544
usb 5-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 5-3: Product: USB Flash Memory
usb 5-3: Manufacturer:
usb 5-3: SerialNumber: 001D92A5F83FC8B0C31F0AD1
Initializing USB Mass Storage driver...
scsi2 : SCSI emulation for USB Mass Storage devices
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
scsi 2:0:0:0: Direct-Access              USB Flash Memory 1.00 PQ: 0 ANSI: 2
sd 2:0:0:0: [sdb] 15646656 512-byte hardware sectors: (8.01GB/7.45GiB)
sd 2:0:0:0: [sdb] Write Protect is off
sd 2:0:0:0: [sdb] Mode Sense: 65 44 09 30
sd 2:0:0:0: [sdb] Assuming drive cache: write through
sd 2:0:0:0: [sdb] 15646656 512-byte hardware sectors: (8.01GB/7.45GiB)
sd 2:0:0:0: [sdb] Write Protect is off
sd 2:0:0:0: [sdb] Mode Sense: 65 44 09 30
sd 2:0:0:0: [sdb] Assuming drive cache: write through
 sdb: sdb1
sd 2:0:0:0: [sdb] Attached SCSI removable disk
sd 2:0:0:0: Attached scsi generic sg2 type 0
usb-storage: device scan complete

KDE4 and Gnome both have stuff happen in response to a new device being 
plugged, so I would assume you could "use the Source" and see what they are 
triggering off of.  (Maybe hald?  Maybe udev + dbus?)

ISTR udev is capable of running arbitrary commands in response to the kernel 
detecting a new piece of hardware so you might do that.
-- 
Boyd Stephen Smith Jr.           	 ,= ,-_-. =.
bss@iguanasuicide.net            	((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy 	 `-'(. .)`-'
http://iguanasuicide.net/        	     \_/

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: