Lines Matching +full:data +full:- +full:path

2 # SPDX-License-Identifier: GPL-2.0
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}"
32 def _log_hexdump(data): argument
36 for c in range(0, len(data), L):
37 chars = data[c : c + L]
43 def __init__(self, server, vid, pid, path): argument
54 if path is not None:
55 return dev_path == path
69 # we have to detach the usb-storage driver from multi gadget since
107 data = None
108 while data is None:
111 data = self.ep_in.read(self.ep_in.wMaxPacketSize)
122 size = struct.unpack("<I", data[:4])[0]
123 while len(data) < size:
124 data += self.ep_in.read(size - len(data))
126 self._log_hexdump(data)
127 self.s.send(data)
135 data = self.s.recv(4)
136 size = struct.unpack("<I", data[:4])[0]
137 while len(data) < size:
138 data += self.s.recv(size - len(data))
140 self._log_hexdump(data)
141 while data:
142 written = self.ep_out.write(data)
144 data = data[written:]
158 if (time.monotonic() - self.stats_logged) < interval:
167 with open(f"/sys/bus/usb/devices/{dev.bus}-{dev.address}/{name}") as f:
176 print("Bus | Addr | Manufacturer | Product | ID | Path")
177 print("--- | ---- | ---------------- | ---------------- | --------- | ----")
179 path = path_from_usb_dev(dev) or ""
183 …address:4} | {manufacturer:16} | {product:16} | {dev.idVendor:04x}:{dev.idProduct:04x} | {path:18}"
190 f = Forwarder(server=(args.server, args.port), vid=vid, pid=pid, path=args.path)
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")