Andrey Konovalov
Andrey Konovalov
@choller WDYT?
[kirill9617](https://github.com/kirill9617) implemented a [prototype](https://github.com/kirill9617/Facedancer/tree/rawgadget) Facedancer backend based on Raw Gadget. Some notes: 1. Facedancer processes all requests in a single `service_irqs()` handler, which is incompatible with Raw Gadget's blocking fetch/read/write...
Finished up the prototype and made most Facedancer examples work with Dummy and `dwc2` UDCs, see the details [here](https://github.com/xairy/raw-gadget/tree/master#facedancer-backend).
Fixed by https://github.com/xairy/raw-gadget/commit/8274ee02badc8804e63cca41ed24fbc223ff69f9.
You need to comment out [this part](https://github.com/xairy/raw-gadget/blob/master/raw_gadget/update.sh#L16) and reupdate the module.
There's now a [prototype](https://github.com/xairy/raw-gadget?tab=readme-ov-file#facedancer-backend) of a Facedancer backend based on Raw Gadget. It relies on a couple out-of-tree Raw Gadget patches, so I'll hold off sending it as a PR...
If you have two separate UDCs connected, then it should be possible. If you have only one UDC, then it's not. Emulating a USB hub is impossible through the Gadget...
One of the things we need to expose is `usb_gadget->ep0->maxpacket`: looks like some UDCs expect `bMaxPacketSize0` in the device descriptor to be not lower than the `maxpacket` that they set.
Some UDCs also have a minimum device speed they support, e.g. [DWC3](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0c59f678fcfc6dd53ba493915794636a230bc4cc). This information is not exposed through `usb_gadget` though. The [comment](https://elixir.bootlin.com/linux/v6.6-rc1/source/include/linux/usb/gadget.h#L345) for `max_speed` is also misleading.
So the speed provided to `USB_RAW_IOCTL_INIT` is rather just a hint, and the UDC might decide to use a different one. Perhaps, we should expose the actual speed of the...