發表文章

目前顯示的是有「USB」標籤的文章

Linux UVC 兩個 video node, 哪一個可使用 ?

圖片
 UVC 裝置會有個video node, 哪一個可用? 用 v4l2-ctl 可以看出 device caps 不同 struct v4l2_capability cam_cap; ioctl(fd, VIDIOC_QUERYCAP, &cam_cap); videodev2.h /* Values for 'capabilities' field */ #define V4L2_CAP_VIDEO_CAPTURE 0x00000001  /* Is a video capture device */ #define V4L2_CAP_META_CAPTURE 0x00800000  /* Is a metadata capture device */ PS:  VIDIOC_QUERYCAP 要確認的是 device_caps 而不是 capabilities   reference:  https://askubuntu.com/questions/1294041/why-only-one-usb-camera-shows-two-video4linux-devices https://bugzilla.kernel.org/show_bug.cgi?id=199575

如何 reset USB host ??

echo 0 > /sys/bus/usb/devices/usb1/authorized echo 1 > /sys/bus/usb/devices/usb1/authorized

USB 相關

USB 相關     先記錄,再研究 1. USB Host 簡介     http://pollos-blog.blogspot.tw/2015/08/usb-host.html 2. USB Video Class 簡介     http://pollos-blog.blogspot.tw/2014/10/usb-video-class.html 3. USB PTP/MTP 簡介     http://pollos-blog.blogspot.tw/2014/10/usb-ptpmtp.html 4. RS232 over USB 簡介     http://pollos-blog.blogspot.tw/2014/10/rs232-over-usb.html 5. USB Mass Storage Class 簡介     http://pollos-blog.blogspot.tw/2014/10/usb-mass-storage-class.html 6. USB 簡介     USB 簡介[1]    http://pollos-blog.blogspot.tw/2014/07/usb-1.html     USB 簡介[2]    http://pollos-blog.blogspot.tw/2014/07/usb-2.html     USB 簡介[3]    http://pollos-blog.blogspot.tw/2014/07/usb-3.html     USB 簡介[4]    http://pollos-blog.blogspot.tw/2014/07/usb-4.html     USB 簡介[5]    http://pollos-blog.blogspot.tw/2014/07/usb-5.html     USB...

HID report descriptor

圖片
The Items on report descriptor is classified into three categories. Main Items: - Input - Output - Feature - Collection - End Collection Global Items: - Usage Page - Logical Minimum / Logical Maximum - Physical Minimum / Physical Maximum - Report Size - Report Count - Report ID - Unit - Unit Exponent - Push / Pop Local Items: - Usage, Usage Minimun / Usage Maximum - Designator Index, Designator Minimum / Designator Maximum - String Index, String Minimum / String Maximum - Delimiter - Reserved Global and Local items describe the details of the format Main Item (Input, Output, Feature) generates report field(s) of specified type, detailed by global and local items. Collection / End Collection pair defines a block of report fields - which may be nested The value of each global item is carried over to all of following lines, until new value is defined. On the other hand, value of local item is cleared, when it is applied to a major item. This table illustrates the ...

How to dump HID report descriptor under Linux

You can detach and attach drivers by hand. To unbind hiddev from a device: cd /sys/bus/usb/drivers/hiddev ls Find the filename for the interface you want to unbind. Interface filenames have the form B-P:C.I where B is the bus number, P is a string of port numbers separated by periods, C is the configuration value, and I is the interface number. Having found the filename for the interface you want to unbind, do echo -n interface-filename >unbind To re-attach the driver, do echo -n interface-filename >bind Example: $# ls 1-3:1.0 1-5:1.0 1-7:1.0 1-7:1.1 bind module new_id uevent unbind $# su - Password: $# cd /sys/bus/usb/drivers/usbhid/ $# ls 1-3:1.0 1-5:1.0 1-7:1.0 1-7:1.1 bind module new_id uevent unbind $# echo -n 1-7:1.0 >unbind $# echo -n 1-7:1.1 >unbind $# lsusb -vvv | more

USB Gadget driver

USB Gadget driver 實現 STR8133 的 usb gadget driver 先在 menuconfig 下,先 Gadget 的 udc driver 編到 kernel 裡。 再將 "File-backed storage gadget" 選成 module 形式。 Compiler 完後,會有 g_file_storage.ko 檔。 再用 insmod 將ko檔載入。 insmod g_file_storage.ko removable=1 stall=0 file=/dev/sda1 假設 /dev/sda1 是usb 隨身碟。 那麼在接上 device cable 後,PC 可以看到 usb mass storage device,即插在 target 上的 USB 隨身碟。 現在問題是.......如何模擬一個 storage device,讓PC存取? 相關資料可參考下列網址。 1. http://www.linux-usb.org/gadget/file_storage.html 2. http://www.armadeus.com/wiki/index.php?title=USB_Gadget 3. http://72.14.235.132/search?q=cache:LZI0Mi1ATtQJ:blog.chinaunix.net/u/22754/showart_1384634.html+usb+gadget+/dev/mtdblock1&hl=zh-TW&ct=clnk&cd=1&gl=tw&lr=lang_zh-CN|lang_zh-TW 4. http://blog.csdn.net/zjujoe/archive/2008/07/13/2645510.aspx simple block driver http://lwn.net/Articles/58720/