Re: USB key is 2.0 or 3.0

From: Matthias Apitz <guru_at_unixarea.de>
Date: Sat, 20 Jan 2024 07:53:58 UTC
El día viernes, enero 19, 2024 a las 02:24:19p. m. +0000, Gary Jennejohn escribió:

> You could try running usbdump(8).  Be aware that you need device bpf and
> perhaps options DEV_BPF in your kernel config file if you aren't running a
> GENERIC kernel.
> 
> usbdump has to be run as root.
> 
> I tried it with a USB3 and a USB2 thumb drive, plugging both into a USB3
> port.
> 
> I used this command line: usbdump -d ugenX.Y -s 256 -w /tmp/USB{2,3} to
> save the output and then usbdump -r /tmp/USB{2,3} to get the user
> readable text.
> 
> You'll probably want to use different names for the -w file names.
> 
> I simply plugged in and unplugged each thumb drive and then stopped
> usbdump.
> 
> The USB3 thumb drive always showed SPD=SUPER and the USB2 thumb drive
> always showed SPD=HIGH in the user readable text.
> 
> So, if your disk shows SPD=SUPER and the thumb drives show SPD=HIGH
> then the thumb drives are NOT USB3.

I did the above tests with the 'hama' USB key; it shows:

$ tail -5 hama.dmp.txt
08:15:12.873247 usbus0.4 DONE-BULK-EP=00000002,SPD=HIGH,NFR=1,SLEN=0,IVAL=0,ERR=0
08:15:12.873254 usbus0.4 SUBM-BULK-EP=00000081,SPD=HIGH,NFR=1,SLEN=0,IVAL=0
08:15:12.874636 usbus0.4 DONE-BULK-EP=00000081,SPD=HIGH,NFR=1,SLEN=36,IVAL=0,ERR=0
08:15:12.874642 usbus0.4 SUBM-BULK-EP=00000081,SPD=HIGH,NFR=1,SLEN=0,IVAL=0
08:15:12.874884 usbus0.4 DONE-BULK-EP=00000081,SPD=HIGH,NFR=1,SLEN=16,IVAL=0,ERR=0

Then I used an extrernal Western Digital USB disk, which presents itself
in /var/log/messages as:

Jan 20 08:36:07 c720-1400094 kernel: usb_msc_auto_quirk: UQ_MSC_NO_GETMAXLUN set for USB mass storage device Western Digital Elements 2621 (0x1058:0x2621)
Jan 20 08:36:07 c720-1400094 kernel: usb_msc_auto_quirk: UQ_MSC_NO_TEST_UNIT_READY set for USB mass storage device Western Digital Elements 2621 (0x1058:0x2621)
Jan 20 08:36:09 c720-1400094 kernel: usb_msc_auto_quirk: UQ_MSC_NO_SYNC_CACHE set for USB mass storage device Western Digital Elements 2621 (0x1058:0x2621)
Jan 20 08:36:09 c720-1400094 kernel: usb_msc_auto_quirk: UQ_MSC_NO_PREVENT_ALLOW set for USB mass storage device Western Digital Elements 2621 (0x1058:0x2621)
Jan 20 08:36:09 c720-1400094 kernel: usb_msc_auto_quirk: UQ_MSC_NO_TEST_UNIT_READY set for USB mass storage device Western Digital Elements 2621 (0x1058:0x2621)
Jan 20 08:36:09 c720-1400094 kernel: usb_msc_auto_quirk: UQ_MSC_NO_START_STOP set for USB mass storage device Western Digital Elements 2621 (0x1058:0x2621)
Jan 20 08:36:09 c720-1400094 kernel: ugen0.4: <Western Digital Elements 2621> at usbus0
Jan 20 08:36:09 c720-1400094 kernel: umass0 on uhub0
Jan 20 08:36:09 c720-1400094 kernel: umass0: <Western Digital Elements 2621, class 0/0, rev 3.10/10.26, addr 4> on usbus0
Jan 20 08:36:09 c720-1400094 kernel: umass0:  SCSI over Bulk-Only; quirks = 0xc105
Jan 20 08:36:09 c720-1400094 kernel: umass0:1:0: Attached to scbus1
Jan 20 08:36:10 c720-1400094 kernel: da0 at umass-sim0 bus 0 scbus1 target 0 lun 0
Jan 20 08:36:10 c720-1400094 kernel: da0: <WD Elements 2621 1026> Fixed Direct Access SPC-4 SCSI device
Jan 20 08:36:10 c720-1400094 kernel: da0: Serial Number 57584B314132394152334B33
Jan 20 08:36:10 c720-1400094 kernel: da0: 400.000MB/s transfers
Jan 20 08:36:10 c720-1400094 kernel: da0: 1907697MB (3906963456 512 byte sectors)
Jan 20 08:36:10 c720-1400094 kernel: da0: quirks=0x2<NO_6_BYTE>
Jan 20 08:36:17 c720-1400094 kernel: ugen0.4: <Western Digital Elements 2621> at usbus0 (disconnected)

and the usbdump shows:

$ tail -5 WD.dmp.txt
08:36:10.663903 usbus0.4 DONE-BULK-EP=00000002,SPD=SUPER,NFR=1,SLEN=0,IVAL=0,ERR=0
08:36:10.663906 usbus0.4 SUBM-BULK-EP=00000081,SPD=SUPER,NFR=1,SLEN=0,IVAL=0
08:36:10.664158 usbus0.4 DONE-BULK-EP=00000081,SPD=SUPER,NFR=1,SLEN=512,IVAL=0,ERR=0
08:36:10.664161 usbus0.4 SUBM-BULK-EP=00000081,SPD=SUPER,NFR=1,SLEN=0,IVAL=0
08:36:10.664411 usbus0.4 DONE-BULK-EP=00000081,SPD=SUPER,NFR=1,SLEN=16,IVAL=0,ERR=0

Thanks in advance for further comments

	matthias

-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub

I am not at war with Russia.
Я не воюю с Россией.
Ich bin nicht im Krieg mit Russland.