Raw Gadget is a kernel module that allows to emulate USB devices from userspace
11–20 of 26 posts
Re: Raw Gadget is a kernel module that allows to emulate USB devices from userspace
#12This is really fantastic. I am currently building my own keyboard with my own controller and it will be much easier for me to first implement mock controller in userspace before I try to get it right on external device. Especially because I will want to put some complicated functionality in it like steno.
For final integration tests, you can use an additional microcontroller to be the key matrix. Instead of wiring up keyswitches, wire the microcontroller to the matrix pins, and have it accept commands over the serial port to set the matrix to a certain state. This way, you can do a full end-to-end test on your real hardware.
The only place USB gadget emulation might be helpful is in writing the code that switches the keyboard from compatibility mode (6KRO) to the NKRO mode. It's been done a million times, though, so there is plenty of library code to just copy.
Re: Raw Gadget is a kernel module that allows to emulate USB devices from userspace
#13This is really fantastic. I am currently building my own keyboard with my own controller and it will be much easier for me to first implement mock controller in userspace before I try to get it right on external device. Especially because I will want to put some complicated functionality in it like steno.
I don't think you need that for this. The keyboard firmware likely consists of three big chunks, the USB code, the matrix scan, and the processing of the matrix scan data into keystrokes. The USB stack is likely a peripheral on your microcontroller, which they have in theory already tested. The matrix scan will need to be tested on real hardware. The processing code should be abstracted enough from USB and matrix sca…
While I could achieve all of that with OS driver and plover the sad reality is that I am unable to install my own software on my corporate PC and I would like to have consistent environment at my home and office.
Re: Raw Gadget is a kernel module that allows to emulate USB devices from userspace
#14Earlier quoted context omitted.
I don't think you need that for this. The keyboard firmware likely consists of three big chunks, the USB code, the matrix scan, and the processing of the matrix scan data into keystrokes. The USB stack is likely a peripheral on your microcontroller, which they have in theory already tested. The matrix scan will need to be tested on real hardware. The processing code should be abstracted enough from USB and matrix sca…
First, this is going to be my first USB device. Second, I plan to put some more complex functionality. I intend it to be my last keyboard so I want to be able to map every key however I want (the whole point of having my own controller). I also want it to have built-in steno which is much more than just matrix scanning. While I could achieve all of that with OS driver and plover the sad reality is that I am unable to…
Do keep in mind that /usr/share/dict/words is about 10x larger than the flash on microcontrollers. This is why most people do the steno conversion in software, not on the keyboard itself.
Re: Raw Gadget is a kernel module that allows to emulate USB devices from userspace
#15Earlier quoted context omitted.
First, this is going to be my first USB device. Second, I plan to put some more complex functionality. I intend it to be my last keyboard so I want to be able to map every key however I want (the whole point of having my own controller). I also want it to have built-in steno which is much more than just matrix scanning. While I could achieve all of that with OS driver and plover the sad reality is that I am unable to…
All I'm saying is that the interesting part of the code will run just fine on your host machine, so you don't need any complicated tricks to develop and test it. Obviously in production it will run on the microcontroller, so you get the functionality you desire without OS drivers. Do keep in mind that /usr/share/dict/words is about 10x larger than the flash on microcontrollers. This is why most people do the steno co…
If it wasn't clear yet it is my personal project, I don't plan to make product from it.
Re: Raw Gadget is a kernel module that allows to emulate USB devices from userspace
#16Re: Raw Gadget is a kernel module that allows to emulate USB devices from userspace
#17Earlier quoted context omitted.
All I'm saying is that the interesting part of the code will run just fine on your host machine, so you don't need any complicated tricks to develop and test it. Obviously in production it will run on the microcontroller, so you get the functionality you desire without OS drivers. Do keep in mind that /usr/share/dict/words is about 10x larger than the flash on microcontrollers. This is why most people do the steno co…
I plan to store configuration data on an SD card for convenience. If it wasn't clear yet it is my personal project, I don't plan to make product from it.
Re: Raw Gadget is a kernel module that allows to emulate USB devices from userspace
#18This is really fantastic. I am currently building my own keyboard with my own controller and it will be much easier for me to first implement mock controller in userspace before I try to get it right on external device. Especially because I will want to put some complicated functionality in it like steno.
Re: Raw Gadget is a kernel module that allows to emulate USB devices from userspace
#19Earlier quoted context omitted.
I plan to store configuration data on an SD card for convenience. If it wasn't clear yet it is my personal project, I don't plan to make product from it.
If you're not designing your own microcontroller, you might want to check out the Proton-C. It has 248kB of usable flash memory, which could be enough to store a stenography-optimized word list in addition to the firmware. It was made to be flashed with the qmk keyboard firmware, but I don't think there's any requirement that you have to use qmk. https://qmk.fm/proton-c/
The F103 is also interesting in that it is well-supported by Rust and Tinygo, if C isn't your thing. I picked it because QMK supports it (and works great), but I'm actually planning to write the firmware in Go and ditch all the things that bug me about QMK. However the USB stack is not there and I dread writing it. I might pull a QMK and just have ChibiOS run my Go code ;)
Re: Raw Gadget is a kernel module that allows to emulate USB devices from userspace
#20Earlier quoted context omitted.
If you're not designing your own microcontroller, you might want to check out the Proton-C. It has 248kB of usable flash memory, which could be enough to store a stenography-optimized word list in addition to the firmware. It was made to be flashed with the qmk keyboard firmware, but I don't think there's any requirement that you have to use qmk. https://qmk.fm/proton-c/
I used an STM32F103 for my last keyboard, and you can buy four for the price of a Proton C. I am still not sure why they chose the F3 series for the Proton C, as it doesn't seem to be a chip that's commonly used in the maker community. I am somewhat surprised they didn't bite the bullet and just port QMK to the nRF52 (since everyone wants bluetooth out of the box), actually. The F103 is also interesting in that it is…