Comments (4)
Here is some guidance:
Each device interface can have multiple alternative settings as described here - http://www.beyondlogic.org/usbnutshell/usb5.shtml#AlternateSetting. Section 4.2.3 of the USB DFU interface may be helpful - http://www.usb.org/developers/docs/devclass_docs/DFU_1.1.pdf, along with this patch not from u-boot's implementation - http://lists.denx.de/pipermail/u-boot/2011-November/108003.html.
Looking at the source code, dfu-util will call libusb_get_string_descriptor_ascii() to receive a string descriptor in unicode. I am not sure what index must be set but the line of code that finds it is here - https://github.com/Stefan-Schmidt/dfu-util/blob/fdc72a8a738994dc72cfd63ff08f690e5145277e/src/main.c#L193.
From the looks of the line, and examining the libusb_get_config_descriptor_by_value() code it returns a libusb_config_descriptor struct, which then has an array of libusb_interface structs, each of which has an array of libusb_interface_descriptor's (altsettings), which then have an index. This index is what is used to query the string. As far as I can tell there is no string field in the struct, so I am not sure where it is stored, perhaps the extra field is of use... Looking at this log it seems like the iInterface somehow has a descriptive string to go with it - https://github.com/cjheath/dfu-util/blob/99ddc0c15021065512dca5c98ce57bec79513261/device-logs/stm32f4discovery.lsusb#L37.
It would be helpful if I knew more about how string descriptors worked in the usb standard. [EDIT: Just did some searching...] According to this page, http://www.beyondlogic.org/usbnutshell/usb5.shtml#InterfaceDescriptors, iInterface is the "Index of string descriptor describing interface - set to 0 if no string". That makes a lot more sense. In that case I believe this line must be updated - https://github.com/kiibohd/controller/blob/master/Bootloader/dfu.desc.c#L53, and a string descriptor must be added somewhere. Looking for other string descriptors my best guess is in the string_descs array found here - https://github.com/kiibohd/controller/blob/master/Bootloader/usb.h#L140. USB_INIT_DEVICE does not seem to be used anywhere but it seems like the best place. I'll give it a shot and report back.
Happy debugging.
from controller.
Got my buspirate wired up and tested this thing out. Turns out it didn't read my ID=4 I added, but using id 3 (serialno) worked fine. This lead me to find out that the defines in usb.h do not seem to be used, instead the string must be added to dfu_device_str_desc in dfu.desc.c. After doing that and adding a define to _buildvars.h I could successfully set iInterface to the index of the new string and had it show up as the name in dfu-util --list. See here: http://ix.io/gNP
If you say what you want the name to be I will send a pull request over. I could send one now but then you would probably end up changing it anyways. Also, it might be worthwhile to look at usb.h and see if some of that stuff is actually needed (it appears it is not).
from controller.
Cool. Awesome work.
Probably the easiest thing to name it would be "Kiibohd DFU". Usually for names like this I put it in one of the CMake build files (through _buildvars.h). Probably Lib/CMake/arm.cmake would be the ideal place for it.
from controller.
Created a pull request using your preferred name and define location. Tested working on my infinity, but feel free to review the code. It's a pretty simple change overall, but the research going into it is what made it more difficult :)
from controller.
Related Issues (20)
- Method for toggling a set of LEDs off/on?
- Colours differ between sections of the underlighting on Gemini HOT 1
- Stretch Rainbow Animations
- K-Type enters flashing mode when using Ultimaker Cura HOT 5
- Mouse Key Control - Ergodox Infinity
- Creating custom KLL files
- Errors running ergodox.bash HOT 2
- GEMINI RGUI (possibly MENU as well) remap issue due to layout mismatch HOT 2
- Support for Aurora RGB sync HOT 3
- Macro "CapsLock" + "I" produces extra letters HOT 1
- Support for fwupd - Linux Vendor Firmware Service HOT 12
- Hexgears Gemini white backlighting not white HOT 2
- Kira LEDS go into a continous blinking loop (red, blue, green on different parts of the keyboard) HOT 5
- K-Type not detected in flash mode
- Kira - Multiple issues flashing the firmware HOT 2
- HID-IO as a replacement for CDC Virtual Serial Port? HOT 1
- Docker Missing CMakeLists.txt HOT 1
- Slow initialization and /dev/ttyACM0 no longer available after flashing with updated controller
- How do I map right alt to emit Fn? HOT 1
- Cannot install libusbK driver
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 controller.