[PATCH 11/11] tools/usb/p9_fwd: set new introduced alt mode 1 on interface 1
Michael Grzeschik <[email protected]>
| Newsgroups | dev.linux.lists.v9fs,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Check for the right interface with the two endpoints and enable the altmode 1 to tell the gadget it can mount now. Signed-off-by: Michael Grzeschik <[email protected]> --- tools/usb/p9_fwd.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/usb/p9_fwd.py b/tools/usb/p9_fwd.py index 1b479c931df9bfb0f7e7f2cf5a612764408f0828..32b138976e0da0f395d25036fce8fd7faffdadad 100755 --- a/tools/usb/p9_fwd.py +++ b/tools/usb/p9_fwd.py @@ -74,7 +74,7 @@ class Forwarder: if dev.is_kernel_driver_active(intf.bInterfaceNumber): dev.detach_kernel_driver(intf.bInterfaceNumber) - if intf.bInterfaceClass == 0xFF and intf.bInterfaceSubClass == 0xFF and intf.bInterfaceProtocol == 0x09: + if intf.bInterfaceClass == 0xFF and intf.bInterfaceSubClass == 0xFF and intf.bInterfaceProtocol == 0x09 and intf.bNumEndpoints == 2: usb9pfs = intf if usb9pfs is None: raise ValueError("Interface not found") @@ -103,6 +103,14 @@ class Forwarder: self.ep_in = ep_in self.dev = dev + logging.info(f"setting alt mode 1 interface:\n{usb9pfs}") + try: + self.dev.set_interface_altsetting(usb9pfs.bInterfaceNumber, 1) + except usb.core.USBError as e: + if e.errno == None: + logging.debug("could not switch to alt 1 retry", repr(e)) + raise ValueError("mount is not ready yet") + # create and connect socket self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.s.connect(server) -- 2.47.3