Jika Anda ingin mendeteksi bagaimana perangkat USB sedang dimuat - dengan granularity yang sangat baik - berikut adalah (2) cara:
udevadm monitor
: Ini akan menunjukkan kepada Anda perangkat USB sedang dimuat saat USB Bus melihatnya .
udevadm
adalah bagian dari paket default udev
pada 18.04 LTS; tidak perlu menginstalnya.
Jalankan udevadm monitor
SEBELUM Anda memasukkan perangkat USB.
Output spesimen memuat flash drive USB yang ditunjukkan di bawah ini. Lewati ke baris terakhir dan Anda bahkan dapat melihat perangkat apa yang dimuatnya ( sda1 ):
udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent
KERNEL[969.010067] add /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
KERNEL[969.010367] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
KERNEL[969.018769] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0 (scsi)
KERNEL[969.018849] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/scsi_host/host0 (scsi_host)
KERNEL[969.018934] bind /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
KERNEL[969.019049] bind /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
UDEV [969.024995] add /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
UDEV [969.031390] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
UDEV [969.036362] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0 (scsi)
UDEV [969.041258] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/scsi_host/host0 (scsi_host)
UDEV [969.046202] bind /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
UDEV [969.051734] bind /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
KERNEL[970.051706] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0 (scsi)
KERNEL[970.052068] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
KERNEL[970.052215] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0 (scsi_disk)
KERNEL[970.052435] bind /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
KERNEL[970.052585] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0 (scsi_device)
KERNEL[970.052774] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_generic/sg0 (scsi_generic)
KERNEL[970.052963] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 (bsg)
UDEV [970.060833] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0 (scsi)
KERNEL[970.061634] add /devices/virtual/bdi/8:0 (bdi)
UDEV [970.069006] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
UDEV [970.071467] add /devices/virtual/bdi/8:0 (bdi)
UDEV [970.075852] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0 (scsi_disk)
KERNEL[970.079839] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda (block)
KERNEL[970.079989] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda/sda1 (block)
UDEV [970.083556] bind /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
UDEV [970.091288] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0 (scsi_device)
UDEV [970.091755] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_generic/sg0 (scsi_generic)
UDEV [970.106807] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 (bsg)
UDEV [970.339976] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda (block)
UDEV [970.519549] add /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda/sda1 (block)
.
dmesg
(yang mencetak buffer cincin Kernel) juga akan memberi Anda visibilitas granular ke dalam pemuatan perangkat USB Anda.
Namun, dmesg
berbeda dengan udevadm monitor
menunjukkan kepada Anda bagaimana memuat perangkat USB eksternal Anda dari perspektif Kernel
Output spesimen dari- dmesg
kali ini dari drive CD eksternal USB- ditunjukkan di bawah ini. " 1-2 " mengacu pada lokasinya di bus USB: Bus pertama, port kedua. Jika saya menghubungkan drive CD ke port lain, itu akan melaporkan " 1-1 ":
[ 55.296482] usb 1-2: new high-speed USB device number 4 using xhci_hcd
[ 55.453715] usb 1-2: New USB device found, idVendor=1c6b, idProduct=a222
[ 55.453730] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 55.453740] usb 1-2: Product: Mass Storage Device
[ 55.453749] usb 1-2: Manufacturer: USB2.0 External
[ 55.453758] usb 1-2: SerialNumber: 2010100500000000174
[ 55.525860] usb-storage 1-2:1.0: USB Mass Storage device detected
[ 55.527273] scsi host0: usb-storage 1-2:1.0
[ 55.530031] usbcore: registered new interface driver usb-storage
[ 55.545215] usbcore: registered new interface driver uas
[ 56.553073] scsi 0:0:0:0: CD-ROM slimtype eTDU108 1 SL46 PQ: 0 ANSI: 0