標籤:The move 置配 HERE drive for 串連 記錄 nconf
主要來自driver/usb/core/sysfs.c:
1.bConfigurationValue
RW,W時調用了usb_set_configuration()即時設定配置。根據USB規範(例如第9.1.1.5節),configuration values必須是非零值,值為零表示裝置處於未配置狀態。但是,某些裝置錯誤地使用0作為其配
置值之一。 為協助管理此類裝置,此函數將接受@configuration = -1,表示裝置應處於未配置狀態。
未授權的裝置(dev->authorized == 0)將僅被設定為未配置模式。
# echo 0 > bConfigurationValue 此時隨身碟的裝置檔案消失
# echo 1 > bConfigurationValue 此時從新進行類似的隨身碟插入識別過程
配置這個檔案就可以實現隨身碟的類比插拔!!
/sys/devices/platform/soc/ee080100.usb/usb1/1-1/bConfigurationValue
配置這個檔案就可以實現Android Carlife的類比插拔!!
/sys/devices/platform/soc/ee080100.usb/usb1/(1-1/)bConfigurationValue
2.# cat ./1-1/power/connected_duration
記錄了從USB裝置串連上後到現在持續的事件
3.# cat ./1-1/power/active_duration
active狀態持續的時間
4.# cat ./1-1/power/level
RW,設定autosuspend模式是on還是auto
5.authorized
RW,同樣能起到類比隨身碟插拔的效果
Move the USB device to a very basic state where interfaces are disabled and the device is in fact unconfigured and unusable.
6.remove
W,安全的移除裝置。
# echo 1 > remove
UDEV [4921.100082] remove /devices/platform/soc/ee080100.usb/usb1/1-0:1.0 (usb)
移除了root-hub,然後USB介面就不識別了,不接恢複,目前只能掉電。移除隨身碟隨身碟就需要重新插拔才能識別。
7.modalias
R,此檔案只有介面有
usb1/1-1# cat ./1-1:1.0/modalias
eg:隨身碟:usb:v0951p1666d0001dc00dsc00dp00ic08isc06ip50in00
拆分如下:v0951 p1666 d0001 dc00 dsc00 dp00 ic08 isc06 ip50 in00
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf){ struct usb_interface *intf; struct usb_device *udev; struct usb_host_interface *alt; intf = to_usb_interface(dev); udev = interface_to_usbdev(intf); alt = ACCESS_ONCE(intf->cur_altsetting); return sprintf(buf, "usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02Xin%02X\n", le16_to_cpu(udev->descriptor.idVendor), le16_to_cpu(udev->descriptor.idProduct), le16_to_cpu(udev->descriptor.bcdDevice), udev->descriptor.bDeviceClass, udev->descriptor.bDeviceSubClass, udev->descriptor.bDeviceProtocol, alt->desc.bInterfaceClass, alt->desc.bInterfaceSubClass, alt->desc.bInterfaceProtocol, alt->desc.bInterfaceNumber);}New USB device found, idVendor=0951, idProduct=1666
USB相關的sysfs檔案