Comments (5)
Years ago I wrote some Python code to make creating userspace gadget drivers easier as part of a Chrome testing project. I don't have a Raspberry Pi Zero to test this with but in theory it should work. The caveat is that in my experience USB gadget support is rather finicky and especially since this has not been tested with the Pi's specific OTG controller there are likely things that need to be tweaked.
https://chromium.googlesource.com/chromium/src/+/master/tools/usb_gadget
It would be really cool if someone developed a library for Raspberry Pi (and other Linux devices with OTG support) that allowed passing of JSON messages over WebUSB similar to a WebSocket.
from arduino.
The Raspberry Pi Zero has a USB controller that supports gadget mode. The Linux kernel has built in support for presenting itself as a number of standard USB class devices including storage, serial and networking. For WebUSB you would want to present a vendor-specific interface by writing a kernel or user-space gadget driver. Exactly what kind of interface you want to present to the USB host depends on what kind of application you are interested in building.
from arduino.
@reillyeon is there guide to help create user space gadget driver with vendor specific interface for raspberry pi zero? In my case I just need two simple bulk-in/bulk-out endpoints. Really appreciate it.
from arduino.
Hi, Reillyeon,
I finally get some time to go through your code. It is beautifully written, although some parts are over my head :). Many thanks.
I have a few high-level questions at this point. Would appreciate your feedback.
- In order to support raspberry pi, it seems I need to replace linux_gadgetfs.py with newer configfs style access, right?
- how is this code intended to be used? I'm confused by "server" waiting on some interface for HTTP connections. I was expecting it used as a library by some test programs talking to USB host. No?
- My goal is to have a composite gadget with 1 ACM interface and 1 generic functionfs interface (1 bulk in endpoint and 1 bulk out endpoint). How will this be composed?
- In order for the generic functionfs interface to be recognized by windows and use winusb driver, I figure we need to set some kind MS OS descriptor. There are several related functions in the framework. Can you highlight steps that need to be done?
- It seems currently we are using a separate thread to handle ep read or write. Is this still necessary with configfs?
Thanks. Again, really great code. I hope I can understand enough and am able to contribute.
from arduino.
Yes, I think you'll need to update the code to use the more modern configfs interface so that it can coexist with the kernel-based ACM interface. I haven't looked into it so I'm not sure if the multiprocess model (yes, multiprocess, not multithreaded) is still necessary. Hopefully the newer API is also easier to use.
There is code there that sets up the MS OS descriptors but for the 2.0 version I also had to use a kernel patch that changed bcdUSB to 0x0210 so that Windows would read the capability descriptor. The compatibility ID descriptor might work if you use the 1.0 version descriptors but I haven't tested that in a while.
The server stuff has to do with the fact that this was designed for testing. The server listens for commands over HTTP and then configures the gadgetfs interface as necessary for the test.
from arduino.
Related Issues (20)
- atmega32u4 only connects to Windows not Mac HOT 2
- No devices detected with Seeeduino Xiao
- how set baudrate? what default speed? HOT 3
- ESP32-S2 support HOT 2
- License HOT 1
- MRKZero support? HOT 2
- Is webUSB supported for Arduino Uno R3 HOT 2
- WebUSB requires a board that supports USB client device mode HOT 2
- Arduino UNO support
- CUSTOM PID/VID HOT 1
- Question about usage of controlTransferOut() at connect() and disconnect() in serial.js HOT 3
- Getting Started mentions hardware/arduino/avr/cores/arduino/USBCore.h when there is no such file on Github HOT 2
- Not working with Seeeduino XIAO HOT 15
- WebUSB not working anymore with SAMD Board Version > 1.8.10 HOT 1
- No Connecting Device. HOT 3
- Can not download https://github.com/kimio-kosaka/webUSB-arduino/archive/v1.0.0.tar.gz HOT 1
- SAM Support?
- Feature Request: Arduino PortentaH7 HOT 9
- GitPod Integration HOT 1
- how can i insert a value in the console without use the keyboard? i mean, a button that I press and isert a value, what is the function to insert? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino.