Lines Matching +full:usb +full:- +full:port +full:- +full:id
2 # SPDX-License-Identifier: GPL-2.0
11 import usb.core
12 import usb.util
17 The string is a Path representation of the position of the USB device on the USB bus tree.
19 This path is used to find a USB device on the bus or all devices connected to a HUB.
20 … The path is made up of the number of the USB controller followed be the ports of the HUB tree."""
23 return f"{dev.bus}-{dev_path}"
58 dev = usb.core.find(idVendor=vid, idProduct=pid, custom_match=find_filter)
69 # we have to detach the usb-storage driver from multi gadget since
70 # stall option could be set, which will lead to spontaneous port
82 usb.util.claim_interface(dev, usb9pfs.bInterfaceNumber)
83 ep_out = usb.util.find_descriptor(
85 … custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT,
88 ep_in = usb.util.find_descriptor(
90 … custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_IN,
106 """forward a request from the USB client to the TCP server"""
112 except usb.core.USBTimeoutError:
115 except usb.core.USBError as e:
124 data += self.ep_in.read(size - len(data))
133 """forward a response from the TCP server to the USB client"""
138 data += self.s.recv(size - len(data))
158 if (time.monotonic() - self.stats_logged) < interval:
167 with open(f"/sys/bus/usb/devices/{dev.bus}-{dev.address}/{name}") as f:
174 vid, pid = [int(x, 16) for x in args.id.split(":", 1)]
176 print("Bus | Addr | Manufacturer | Product | ID | Path")
177 print("--- | ---- | ---------------- | ---------------- | --------- | ----")
178 for dev in usb.core.find(find_all=True, idVendor=vid, idProduct=pid):
188 vid, pid = [int(x, 16) for x in args.id.split(":", 1)]
190 f = Forwarder(server=(args.server, args.port), vid=vid, pid=pid, path=args.path)
203 description="Forward 9PFS requests from USB to TCP",
206 parser.add_argument("--id", type=str, default="1d6b:0109", help="vid:pid of target device")
207 parser.add_argument("--path", type=str, required=False, help="path of target device")
208 parser.add_argument("-v", "--verbose", action="count", default=0)
223 …parser_connect.add_argument("-s", "--server", type=str, default="127.0.0.1", help="server hostname…
224 parser_connect.add_argument("-p", "--port", type=int, default=564, help="server port")
228 logging.TRACE = logging.DEBUG - 5
237 logging.basicConfig(level=level, format="%(asctime)-15s %(levelname)-8s %(message)s")