Usb
核心辨識 USB 設備,但我在 /sys 或 /dev 中找不到它
當我將三星 390G(一款便宜的手機!)連接到 Ubuntu 13.04 時,dmesg 似乎表明其上的儲存設備是可辨識的:
[Sun Dec 29 01:26:10 2013] scsi16 : usb-storage 2-1.2:1.0 [Sun Dec 29 01:26:11 2013] scsi 16:0:0:0: Direct-Access SAMSUNG MMC Storage 2.31 PQ: 0 ANSI: 2 [Sun Dec 29 01:26:11 2013] sd 16:0:0:0: Attached scsi generic sg2 type 0 [Sun Dec 29 01:26:11 2013] sd 16:0:0:0: [sdb] 61497344 512-byte logical blocks: (31.4 GB/29.3 GiB) [Sun Dec 29 01:26:11 2013] sd 16:0:0:0: [sdb] Write Protect is off [Sun Dec 29 01:26:11 2013] sd 16:0:0:0: [sdb] Mode Sense: 0f 0e 00 00 [Sun Dec 29 01:26:11 2013] sd 16:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [Sun Dec 29 01:26:11 2013] sdb: sdb1 [Sun Dec 29 01:26:11 2013] sd 16:0:0:0: [sdb] Attached SCSI removable disk [Sun Dec 29 01:26:11 2013] sd 16:0:0:0: [sdb] Synchronizing SCSI cache
但問題是沒有設備為此顯示(即沒有/dev/sdb 或/dev/sdb1)。我推測我需要在這裡做一些 udev 規則制定,但我不需要能夠在 /sys 中找到父節點嗎?而且我什麼也找不到——不完全確定去哪裡找,但到目前為止,我的合理猜測還沒有產生任何結果。
請注意,該設備確實作為驅動器安裝在 Windows 資源管理器中,因此我確信手機可以按預期工作。
您可能需要添加 UDEV 規則來檢測此設備的存在。一旦檢測到設備,UDEV 就可以創建相應的設備
/dev/sdb1
以配合它。這些來自 OpenSUSE 的文件應該可以幫助您開始創建此規則。
關於你的問題:
“……但是我不需要能夠在 /sys 中找到父節點嗎?而且我找不到任何東西……”
我希望,如果核心已成功檢測到
/dev/sdb1
,自從您在dmesg
日誌中收到這些消息以來它已經成功檢測到,那麼您將在/sys
.我會進行
/sys
更徹底的調查,可能有一個設備句柄隱藏在其中,對應於/dev/sdb1
. 您可以使用此命令在樹中四處走動:udevadm info -a -p /sys/class/...
您需要在適當的設備上添加以代替點 (...
)。例子
$ udevadm info -a -p /sys/class/ata_device/dev1.0 Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device. looking at device '/devices/pci0000:00/0000:00:1f.2/ata1/link1/dev1.0/ata_device/dev1.0': KERNEL=="dev1.0" SUBSYSTEM=="ata_device" DRIVER=="" ATTR{gscr}=="" ATTR{class}=="ata" ATTR{ering}=="[4294667.658000000]Unknown" ATTR{spdn_cnt}=="0" ATTR{pio_mode}=="XFER_UDMA_7, XFER_UDMA_6, XFER_UDMA_5, XFER_UDMA_4, XFER_MW_DMA_4, XFER_PIO_6, XFER_PIO_5, XFER_PIO_4, XFER_PIO_3, XFER_PIO_2, XFER_PIO_1, XFER_PIO_0" ATTR{dma_mode}=="XFER_UDMA_7, XFER_UDMA_6, XFER_UDMA_5, XFER_UDMA_4, XFER_UDMA_3, XFER_UDMA_2, XFER_UDMA_1, XFER_UDMA_0, XFER_MW_DMA_4, XFER_MW_DMA_3, XFER_MW_DMA_2, XFER_SW_DMA_2, XFER_PIO_6, XFER_PIO_5, XFER_PIO_4, XFER_PIO_3, XFER_PIO_2" ATTR{xfer_mode}=="XFER_UDMA_7, XFER_UDMA_6, XFER_UDMA_5, XFER_UDMA_4, XFER_UDMA_3, XFER_UDMA_2, XFER_UDMA_1, XFER_UDMA_0, XFER_MW_DMA_4, XFER_MW_DMA_3, XFER_MW_DMA_2, XFER_SW_DMA_2, XFER_PIO_6, XFER_PIO_5, XFER_PIO_4, XFER_PIO_3, XFER_PIO_2" looking at parent device '/devices/pci0000:00/0000:00:1f.2/ata1/link1/dev1.0': KERNELS=="dev1.0" SUBSYSTEMS=="" DRIVERS=="" looking at parent device '/devices/pci0000:00/0000:00:1f.2/ata1/link1': KERNELS=="link1" SUBSYSTEMS=="" DRIVERS=="" looking at parent device '/devices/pci0000:00/0000:00:1f.2/ata1': KERNELS=="ata1" SUBSYSTEMS=="" DRIVERS=="" looking at parent device '/devices/pci0000:00/0000:00:1f.2': KERNELS=="0000:00:1f.2" SUBSYSTEMS=="pci" DRIVERS=="ahci" ATTRS{irq}=="40" ATTRS{subsystem_vendor}=="0x17aa" ATTRS{broken_parity_status}=="0" ATTRS{class}=="0x010601" ATTRS{consistent_dma_mask_bits}=="64" ATTRS{dma_mask_bits}=="64" ATTRS{local_cpus}=="00000000,00000000,00000000,0000000f" ATTRS{device}=="0x3b2f" ATTRS{msi_bus}=="" ATTRS{local_cpulist}=="0-3" ATTRS{vendor}=="0x8086" ATTRS{subsystem_device}=="0x2168" ATTRS{numa_node}=="-1" ATTRS{d3cold_allowed}=="1" looking at parent device '/devices/pci0000:00': KERNELS=="pci0000:00" SUBSYSTEMS=="" DRIVERS==""