^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) What: /sys/bus/pci/drivers/ehci_hcd/.../companion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /sys/bus/usb/devices/usbN/../companion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) Date: January 2007
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) KernelVersion: 2.6.21
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Contact: Alan Stern <stern@rowland.harvard.edu>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) PCI-based EHCI USB controllers (i.e., high-speed USB-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) controllers) are often implemented along with a set of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) "companion" full/low-speed USB-1.1 controllers. When a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) high-speed device is plugged in, the connection is routed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) to the EHCI controller; when a full- or low-speed device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) is plugged in, the connection is routed to the companion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) controller.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) Sometimes you want to force a high-speed device to connect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) at full speed, which can be accomplished by forcing the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) connection to be routed to the companion controller.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) That's what this file does. Writing a port number to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) file causes connections on that port to be routed to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) companion controller, and writing the negative of a port
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) number returns the port to normal operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) For example: To force the high-speed device attached to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) port 4 on bus 2 to run at full speed::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) echo 4 >/sys/bus/usb/devices/usb2/../companion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) To return the port to high-speed operation::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) echo -4 >/sys/bus/usb/devices/usb2/../companion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) Reading the file gives the list of ports currently forced
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) to the companion controller.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) Note: Some EHCI controllers do not have companions; they
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) may contain an internal "transaction translator" or they
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) may be attached directly to a "rate-matching hub". This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) mechanism will not work with such controllers. Also, it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) cannot be used to force a port on a high-speed hub to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) connect at full speed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) Note: When this file was first added, it appeared in a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) different sysfs directory. The location given above is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) correct for 2.6.35 (and probably several earlier kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) versions as well).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)