最終更新:2016-03-09 (水) 13:54:05 (1579d)  

new_id
Top / new_id

Writing a device ID to this file will attempt to dynamically add a new device ID to a USB device driver.

メモ

  • From kernel version Linux 2.6.21 (2007), all USB drivers can be told to recognize an additional device without rebuilding.

ドキュメント

Adding new vendor and product IDs to an existing USB driver on Linux

  • modprobe foo_driver
    echo 34ca d365 > /sys/bus/usb/drivers/foo_driver/new_id

フォーマット

  • idVendor idProduct bInterfaceClass RefIdVendor RefIdProduct

メモ

  • What:		/sys/bus/usb/drivers/.../new_id
    Date:		October 2011
    Contact:	linux-usb@vger.kernel.org
    Description:
    		Writing a device ID to this file will attempt to
    		dynamically add a new device ID to a USB device driver.
    		This may allow the driver to support more hardware than
    		was included in the driver's static device ID support
    		table at compile time. The format for the device ID is:
    		idVendor idProduct bInterfaceClass RefIdVendor RefIdProduct
    		The vendor ID and device ID fields are required, the
    		rest is optional. The Ref* tuple can be used to tell the
    		driver to use the same driver_data for the new device as
    		it is used for the reference device.
    		Upon successfully adding an ID, the driver will probe
    		for the device and attempt to bind to it.  For example:
    		# echo "8086 10f5" > /sys/bus/usb/drivers/foo/new_id
    
    		Here add a new device (0458:7045) using driver_data from
    		an already supported device (0458:704c):
    		# echo "0458 7045 0 0458 704c" > /sys/bus/usb/drivers/foo/new_id
    
    		Reading from this file will list all dynamically added
    		device IDs in the same format, with one entry per
    		line. For example:
    		# cat /sys/bus/usb/drivers/foo/new_id
    		8086 10f5
    		dead beef 06
    		f00d cafe
    
    		The list will be truncated at PAGE_SIZE bytes due to
    		sysfs restrictions.
    

Linux/sys/bus/usb/drivers/.../new_id

  • Linux/sys/bus/usb-serial/drivers/hid-generic/new_id?

Linux/sys/bus/hid/drivers/.../new_id

udevで使う場合

  • Create /etc/udev/rules.d/95-foo.rules containing the following:
    # Rules for hotplugging Yoyodyne USB frobitzers
    SUBSYSTEM=="usb", ATTR{idVendor}=="34ca", ATTR{idProduct}=="d365", RUN="/etc/yoyodyne_foo.sh"
    # You may need lines like these to create devices with correct groups
    # and permissions, and set up symlinks:
    # KERNEL=="ttyUSB0", SYMLINK="modem", GROUP="dialout", MODE="0660"
    # KERNEL=="ttyUSB1", GROUP="dialout" MODE="0660"
  • and /etc/yoyodyne_foo.sh as follows:
    #!/bin/sh
    modprobe foo_driver
    echo 34ca d365 > /sys/bus/usb/drivers/foo_driver/new_id