USB相關的sysfs檔案

來源:互聯網
上載者:User

標籤: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檔案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.