Comments (9)
HID Remapper's report descriptor is fixed, it doesn't change based on what devices are plugged into it. It just doesn't have these keys so it can't pass them through. You can map them to something else if you want.
from hid-remapper.
How can one change the report descriptor to enable these keys?
from hid-remapper.
It's in our_descriptor.cc
.
from hid-remapper.
I pulled the descriptor from the keyboard, and extracted the relevant portions. I added these to the hid-remapper descriptor.
(This was after a few iterations of trying to do it manually... but the documentation for how to register these AC commands is rather spare.)
The result is the hid-remapper can no longer forward (any) events to the host.
@jfedor2 do you have any hints for me? Do you think there is a problem with the descriptor?
Or is there some other fault/incompatibility with the hid-remapper code that is causing it to fault?
How would one typically go about debugging this?
diff --git a/firmware/src/our_descriptor.cc b/firmware/src/our_descriptor.cc
index 464d716..c17a66d 100644
--- a/firmware/src/our_descriptor.cc
+++ b/firmware/src/our_descriptor.cc
@@ -135,6 +135,13 @@ const uint8_t our_report_descriptor_kb_mouse[] = {
0x09, 0x2F, // Usage (Phone Mute)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
+ 0x15, 0x01, // Logical Minimum (1)
+ 0x26, 0x8C, 0x02, // Logical Maximum (652)
+ 0x19, 0x01, // Usage Minimum (Consumer Control)
+ 0x2A, 0x8C, 0x02, // Usage Maximum (AC Send)
+ 0x75, 0x10, // Report Size (16)
+ 0x95, 0x02, // Report Count (2)
+ 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0, // End Collection
};
from hid-remapper.
It's because HID Remapper doesn't know how to output "array" usages (its default descriptors don't have them).
But you don't have to replicate the report descriptor exactly, the descriptor just has to have the right usages.
For example you might add something like this (in the same place):
0x05, 0x0C, // Usage Page (Consumer)
0x1A, 0x20, 0x02, // Usage Minimum (AC Find and Replace)
0x2A, 0x27, 0x02, // Usage Maximum (AC Refresh)
0x75, 0x01, // Report Size (1)
0x95, 0x08, // Report Count (8)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
(edited to add Usage Page)
from hid-remapper.
Thanks @jfedor2! I really appreciate the feedback.
I gave that a try (with and without the usage page), but I have the same behavior. The hid remapper web tool and monitor the device, but hid-remapper isn't forwarding anything to the host.
I would really appreciate any additional thoughts and/or some guidance on how to troubleshoot the issue.
diff --git a/firmware/src/our_descriptor.cc b/firmware/src/our_descriptor.cc
index 464d716..3b4ddb1 100644
--- a/firmware/src/our_descriptor.cc
+++ b/firmware/src/our_descriptor.cc
@@ -135,6 +135,12 @@ const uint8_t our_report_descriptor_kb_mouse[] = {
0x09, 0x2F, // Usage (Phone Mute)
0x95, 0x01, // Report Count (1)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
+0x05, 0x0C, // Usage Page (Consumer)
+0x1A, 0x20, 0x02, // Usage Minimum (AC Find and Replace)
+0x2A, 0x27, 0x02, // Usage Maximum (AC Refresh)
+0x75, 0x01, // Report Size (1)
+0x95, 0x08, // Report Count (8)
+0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0, // End Collection
};
from hid-remapper.
Ah, there's a bug when the descriptor length is above 255 bytes, which we're just hitting when adding this.
The fix would look something like this:
diff --git a/firmware/src/tinyusb_stuff.cc b/firmware/src/tinyusb_stuff.cc
index 22e4951..590e596 100644
--- a/firmware/src/tinyusb_stuff.cc
+++ b/firmware/src/tinyusb_stuff.cc
@@ -85,7 +85,8 @@ uint8_t const* tud_descriptor_device_cb() {
// Application return pointer to descriptor
// Descriptor contents must exist long enough for transfer to complete
uint8_t const* tud_descriptor_configuration_cb(uint8_t index) {
- desc_configuration[25] = our_descriptor->descriptor_length; // XXX there has to be a better way
+ desc_configuration[25] = TU_U16_LOW(our_descriptor->descriptor_length);
+ desc_configuration[26] = TU_U16_HIGH(our_descriptor->descriptor_length);
return desc_configuration;
}
from hid-remapper.
It's working now. Thanks for your help @jfedor2 !
Can I ask why we don't just add all of the 'AC' keys to the descriptor so that all of these will be supported if a users keyboard happens to have them?
from hid-remapper.
Thanks again! I really appreciate the assistance.
For future reference, I've commit the fix here:
86e2195
a6eb4e4
from hid-remapper.
Related Issues (20)
- Usage on a Pico without USB input at all => reuse the D+ and D- as GPIO?
- Would you consider RGB output (APA102 and WS2812B)? HOT 1
- Sticky not working as expected for drag-lock on mouse button HOT 4
- Weird issue with zowie ec1-c HOT 4
- Switch Output does not enable controller setup HOT 3
- Feature Request: Control HID Remapper via USB Serial HOT 1
- Feature: Monitor control using DDC/CI protocol
- Emulated a single controller using a USB Joystick and a gamepad using free GPIOs HOT 4
- Firmware for nrf52840-mdk-usb-dongle
- Problem with arrow keys in macro HOT 4
- Support for the sleep and power buttons HOT 4
- Ensure that the prior key in a tap-hold binding is equal to the tap input key when initiating a tap binding HOT 3
- HID Remapper with hand held speechmike HOT 4
- Unable to get board v5 to work HOT 16
- Clear Layer HOT 3
- Support: Startup (run once) action (and Delay) HOT 4
- How would i? Capslock is Escape, or Control if pressed with a key? HOT 6
- Feature Request: WAIT macro HOT 2
- A single key press HOT 3
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 hid-remapper.