Usbconfig

Материал из wiki.lissyara.su
Перейти к: навигация, поиск

Утилита для управления USB портами. появилась в FreeBSD 8. Работает только с новым USB-стеком, появившемся также в 8 версии.

смотрим список устройств:

lissyara# usbconfig
ugen1.1: <OHCI root HUB ATI> at usbus1, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen0.1: <OHCI root HUB ATI> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen2.1: <OHCI root HUB ATI> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen3.1: <OHCI root HUB ATI> at usbus3, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen4.1: <OHCI root HUB ATI> at usbus4, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen5.1: <EHCI root HUB ATI> at usbus5, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen0.2: <USB-PS/2 Optical Mouse Logitech> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
ugen2.2: <USB-PS/2 Optical Mouse Logitech> at usbus2, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
ugen5.2: <USB2.0-CRW Generic> at usbus5, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen2.3: <HP Basic USB Keyboard CHICONY> at usbus2, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON

выключаем питание на одной из мышей

lissyara# usbconfig -u 0 -a 2 power_off

лог

Aug 21 14:46:23 lissyara kernel: ums0: at uhub1, port 2, addr 2 (disconnected)

включаем питание на мышь

lissyara# usbconfig -u 0 -a 2 power_on

в логе наблюдаем детект устройства:

Aug 21 14:47:28 lissyara kernel: ums0: <Logitech USB-PS/2 Optical Mouse, class 0/0, rev 2.00/11.10, addr 2> on usbus0
Aug 21 14:47:28 lissyara kernel: ums0: 3 buttons and [XYZ] coordinates ID=0

выключаем питание на кард-ридере:

lissyara# usbconfig -u 5 -a 2 power_off

в логе видим:

Aug 21 14:41:11 lissyara kernel: umass0: at uhub5, port 7, addr 2 (disconnected)
Aug 21 14:41:11 lissyara kernel: (da0:umass-sim0:0:0:0): lost device
Aug 21 14:41:11 lissyara kernel: (da0:umass-sim0:0:0:0): removing device entry
Aug 21 14:41:11 lissyara kernel: (da1:umass-sim0:0:0:1): lost device
Aug 21 14:41:11 lissyara kernel: (da1:umass-sim0:0:0:1): removing device entry
Aug 21 14:41:11 lissyara kernel: (da2:umass-sim0:0:0:2): lost device
Aug 21 14:41:11 lissyara kernel: (da2:umass-sim0:0:0:2): removing device entry
Aug 21 14:41:11 lissyara kernel: (da3:umass-sim0:0:0:3): lost device
Aug 21 14:41:11 lissyara kernel: (da3:umass-sim0:0:0:3): removing device entry

включаем:

lissyara# usbconfig -u 5 -a 2 power_on

в логе видим:

Aug 21 14:41:53 lissyara kernel: umass0: <Bulk-In, Bulk-Out, Interface> on usbus5
Aug 21 14:41:53 lissyara kernel: umass0:  SCSI over Bulk-Only; quirks = 0x0000
Aug 21 14:41:54 lissyara kernel: umass0:3:0:-1: Attached to scbus3
Aug 21 14:41:54 lissyara kernel: (probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
Aug 21 14:41:54 lissyara kernel: (probe0:umass-sim0:0:0:0): CAM Status: SCSI Status Error
Aug 21 14:41:54 lissyara kernel: (probe0:umass-sim0:0:0:0): SCSI Status: Check Condition
Aug 21 14:41:54 lissyara kernel: (probe0:umass-sim0:0:0:0): NOT READY asc:3a,0
Aug 21 14:41:54 lissyara kernel: (probe0:umass-sim0:0:0:0): Medium not present
Aug 21 14:41:54 lissyara kernel: (probe0:umass-sim0:0:0:0): Unretryable error
Aug 21 14:41:54 lissyara kernel: da0 at umass-sim0 bus 0 target 0 lun 0
Aug 21 14:41:54 lissyara kernel: da0: <Generic- Compact Flash 1.00> Removable Direct Access SCSI-0 device
Aug 21 14:41:54 lissyara kernel: da0: 40.000MB/s transfers
Aug 21 14:41:54 lissyara kernel: da0: Attempt to query device size failed: NOT READY, Medium not present
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:1): TEST UNIT READY. CDB: 0 20 0 0 0 0
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:1): CAM Status: SCSI Status Error
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:1): SCSI Status: Check Condition
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:1): NOT READY asc:3a,0
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:1): Medium not present
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:1): Unretryable error
Aug 21 14:41:55 lissyara kernel: da1 at umass-sim0 bus 0 target 0 lun 1
Aug 21 14:41:55 lissyara kernel: da1: <Generic- SM/xD-Picture 1.00> Removable Direct Access SCSI-0 device
Aug 21 14:41:55 lissyara kernel: da1: 40.000MB/s transfers
Aug 21 14:41:55 lissyara kernel: da1: Attempt to query device size failed: NOT READY, Medium not present
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:2): TEST UNIT READY. CDB: 0 40 0 0 0 0
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:2): CAM Status: SCSI Status Error
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:2): SCSI Status: Check Condition
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:2): NOT READY asc:3a,0
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:2): Medium not present
Aug 21 14:41:55 lissyara kernel: (probe0:umass-sim0:0:0:2): Unretryable error
Aug 21 14:41:55 lissyara kernel: da2 at umass-sim0 bus 0 target 0 lun 2
Aug 21 14:41:55 lissyara kernel: da2: <Generic- SD/MMC 1.00> Removable Direct Access SCSI-0 device
Aug 21 14:41:55 lissyara kernel: da2: 40.000MB/s transfers
Aug 21 14:41:55 lissyara kernel: da2: Attempt to query device size failed: NOT READY, Medium not present
Aug 21 14:41:56 lissyara kernel: (probe0:umass-sim0:0:0:3): TEST UNIT READY. CDB: 0 60 0 0 0 0
Aug 21 14:41:56 lissyara kernel: (probe0:umass-sim0:0:0:3): CAM Status: SCSI Status Error
Aug 21 14:41:56 lissyara kernel: (probe0:umass-sim0:0:0:3): SCSI Status: Check Condition
Aug 21 14:41:56 lissyara kernel: (probe0:umass-sim0:0:0:3): NOT READY asc:3a,0
Aug 21 14:41:56 lissyara kernel: (probe0:umass-sim0:0:0:3): Medium not present
Aug 21 14:41:56 lissyara kernel: (probe0:umass-sim0:0:0:3): Unretryable error
Aug 21 14:41:56 lissyara kernel: da3 at umass-sim0 bus 0 target 0 lun 3
Aug 21 14:41:56 lissyara kernel: da3: <Generic- MS/MS-Pro 1.00> Removable Direct Access SCSI-0 device
Aug 21 14:41:56 lissyara kernel: da3: 40.000MB/s transfers
Aug 21 14:41:56 lissyara kernel: da3: Attempt to query device size failed: NOT READY, Medium not present

Добавлено 2011-05-11 в 14:52 MSK

В 8-й и позднее ветках, поменяли что именно надо дёргать. Т.е. для моего кард-ридера последовательность действия стала такая:

Гасим хаб, на котором висит кардридер:

usbconfig -d ugen5.1 set_config 255

В логах видим такое:

May 11 14:55:18 lissyara kernel: uhub5: at usbus5, port 1, addr 1 (disconnected)
May 11 14:55:18 lissyara kernel: ugen5.3: <Generic> at usbus5 (disconnected)
May 11 14:55:18 lissyara kernel: umass0: at uhub5, port 7, addr 3 (disconnected)
May 11 14:55:18 lissyara kernel: (da0:umass-sim0:0:0:0): lost device
May 11 14:55:18 lissyara kernel: (da0:umass-sim0:0:0:0): removing device entry
May 11 14:55:18 lissyara kernel: (da1:umass-sim0:0:0:1): lost device
May 11 14:55:18 lissyara kernel: (da1:umass-sim0:0:0:1): removing device entry
May 11 14:55:18 lissyara kernel: (da2:umass-sim0:0:0:2): lost device
May 11 14:55:18 lissyara kernel: (da2:umass-sim0:0:0:2): removing device entry
May 11 14:55:18 lissyara kernel: (da3:umass-sim0:0:0:3): lost device
May 11 14:55:18 lissyara kernel: (da3:umass-sim0:0:0:3): removing device entry

Включаем хаб:

usbconfig -d ugen5.1 set_config 0

В логах сообщения о новых девайсах

May 11 14:55:32 lissyara kernel: uhub5: <ATI EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus5
May 11 14:55:36 lissyara kernel: ugen5.3: <Generic> at usbus5
May 11 14:55:36 lissyara kernel: umass0: <Bulk-In, Bulk-Out, Interface> on usbus5
May 11 14:55:36 lissyara kernel: umass0:  SCSI over Bulk-Only; quirks = 0x0000
May 11 14:55:36 lissyara root: Unknown USB device: vendor product bus uhub5
May 11 14:55:37 lissyara kernel: uhub5: 10 ports with 10 removable, self powered
May 11 14:55:37 lissyara kernel: umass0:2:0:-1: Attached to scbus2
May 11 14:55:38 lissyara kernel: (probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
May 11 14:55:38 lissyara kernel: (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
May 11 14:55:38 lissyara kernel: (probe0:umass-sim0:0:0:0): SCSI status: Check Condition
May 11 14:55:38 lissyara kernel: (probe0:umass-sim0:0:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
May 11 14:55:38 lissyara kernel: da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
May 11 14:55:38 lissyara kernel: da0: <Generic- Compact Flash 1.00> Removable Direct Access SCSI-0 device
May 11 14:55:38 lissyara kernel: da0: 40.000MB/s transfers
May 11 14:55:38 lissyara kernel: da0: Attempt to query device size failed: NOT READY, Medium not present
May 11 14:55:38 lissyara kernel: (probe0:umass-sim0:0:0:1): TEST UNIT READY. CDB: 0 20 0 0 0 0
May 11 14:55:38 lissyara kernel: (probe0:umass-sim0:0:0:1): CAM status: SCSI Status Error
May 11 14:55:38 lissyara kernel: (probe0:umass-sim0:0:0:1): SCSI status: Check Condition
May 11 14:55:38 lissyara kernel: (probe0:umass-sim0:0:0:1): SCSI sense: NOT READY asc:3a,0 (Medium not present)
May 11 14:55:38 lissyara kernel: da1 at umass-sim0 bus 0 scbus2 target 0 lun 1
May 11 14:55:38 lissyara kernel: da1: <Generic- SM/xD-Picture 1.00> Removable Direct Access SCSI-0 device
May 11 14:55:38 lissyara kernel: da1: 40.000MB/s transfers
May 11 14:55:38 lissyara kernel: da1: Attempt to query device size failed: NOT READY, Medium not present
May 11 14:55:39 lissyara kernel: da2 at umass-sim0 bus 0 scbus2 target 0 lun 2
May 11 14:55:39 lissyara kernel: da2: <Generic- SD/MMC 1.00> Removable Direct Access SCSI-0 device
May 11 14:55:39 lissyara kernel: da2: 40.000MB/s transfers
May 11 14:55:39 lissyara kernel: da2: 7647MB (15661056 512 byte sectors: 255H 63S/T 974C)
May 11 14:55:39 lissyara kernel: (probe0:umass-sim0:0:0:3): TEST UNIT READY. CDB: 0 60 0 0 0 0
May 11 14:55:39 lissyara kernel: (probe0:umass-sim0:0:0:3): CAM status: SCSI Status Error
May 11 14:55:39 lissyara kernel: (probe0:umass-sim0:0:0:3): SCSI status: Check Condition
May 11 14:55:39 lissyara kernel: (probe0:umass-sim0:0:0:3): SCSI sense: NOT READY asc:3a,0 (Medium not present)
May 11 14:55:39 lissyara kernel: da3 at umass-sim0 bus 0 scbus2 target 0 lun 3
May 11 14:55:39 lissyara kernel: da3: <Generic- MS/MS-Pro 1.00> Removable Direct Access SCSI-0 device
May 11 14:55:39 lissyara kernel: da3: 40.000MB/s transfers
May 11 14:55:39 lissyara kernel: da3: Attempt to query device size failed: NOT READY, Medium not present
May 11 14:55:39 lissyara kernel: GEOM: da2s1: EBR has non empty bootcode.

Иточник: http://forum.lissyara.su/viewtopic.php?f=5&t=31710&p=287435