thefloweringash / iousbhiddriver-descriptor-override

Fix broken USB HID descriptors. Now with Noppoo Choc Mini support!
http://thefloweringash.github.io/iousbhiddriver-descriptor-override
GNU Lesser General Public License v3.0
204 stars 25 forks source link

Ozone StrikeBattle Support #28

Open itek09 opened 8 years ago

itek09 commented 8 years ago

Hi.

Thanks for this project.

I bought a Ozone Strikebattle with Holtek micro controller (vendor 0x04d9 productid 0xa096). This keyboard is not compatible with mac (if i type "asdf" it wrote "hzkm", for example).

The descriptor generator doesn't work with the keyboard, I make one using other descriptor values but I can't make work this keyboard...

I send you some info from Ubuntu (its work perfectly). In Mac, i think the keyboard has been detected with 3 interfaces, the interface 2 is for Media keys (its work ok).

Merry Christmas and happy new year.

Thanks ;)

PD: Do you need more things?

USB Holtek Ubuntu.txt

itek09 commented 8 years ago

I upload too the Report Descriptor from ubuntu (3 interfaces):

int1 - media.txt int0.txt int2.txt

itek09 commented 8 years ago

Oh, this keyboard work perfectly! I only need make "set-protocol.rb -v 0x04d9 -p 0xa096 -P 0".

Thanks man!

thefloweringash commented 8 years ago

I'm glad you managed to make it work with the set-protocol.rb script, but this is only a workaround and won't have NKRO (I expect it to max out at 6 keys).

This keyboard includes this in the descriptor:

        Usage_Minimum[224]
        Usage_Maximum[231]
        Usage_Minimum[0]
        Usage_Maximum[103]

Which is something the descriptor generator isn't able to handle. It's not impossible to implement but will take a bit of reworking.

itek09 commented 8 years ago

Yes, it work with 6kro, its enough for the moment.

How can i help you with this keyboard?

Thanks.

thefloweringash commented 8 years ago

I have everything I need to work on this.

thefloweringash commented 8 years ago

I've pushed an improvement to the descriptor generator in a branch named issue-28. This should be able to generate an appropriate descriptor for your keyboard. Would you be able to test this?

itek09 commented 8 years ago

Oh!

Really thanks.

I test the changes and... now i think all the keys are working with NKRO :D. I only need to use Keyboard Remap to set the corrects keys (actually A is a H... but now the Caps key and other keys work too :D)

Really thanks man, and sorry for my english :(

thefloweringash commented 8 years ago

Thank you for testing the changes. It should be possible to have the keyboard work without any additional remapping. Your example of "A is a H" is an offset of 8 positions, which is the size of the first range that the generated descriptor should have introduced. In your example, what button are you pressing and what is the result? How did this change with the generated descriptor?

thefloweringash commented 8 years ago

I'd like to see the raw hid reports for a few representative buttons (for example, Caps Lock and A). There's a utility in the hid_report_dumper directory to do this, but it's not very polished.

itek09 commented 8 years ago

A -> 05 00 01 00 00 ... (continue zeros) S -> 05 00 00 40 00 ... Caps Lock -> 05 00 00 00 00 00 00 00 00 02 00 ... Left Shift -> 05 02 00 00 ... Left Ctrl -> 05 01 00 00 ... Space -> 05 00 00 00 00 00 00 10 00 ...

All 16 bytes.

I use hid_report_dumper, but this utility is like testgui, included on this repository https://github.com/signal11/hidapi/downloads ;)

thefloweringash commented 8 years ago

Sorry about the delay.

Looking at your example reports, I'm confused by the A and S reports. From the descriptor I expect

A -> 05 | 00 | 10 00 00 ... (usage  4 at bit number  4)
S -> 05 | 00 | 00 00 40 ... (usage 22 at bit number 22)

Where the general format is:

report id = 0x05
modifier bitset (keyboard,       224-231,   8 bits)
main bitset     (keyboard,         0-103, 104 bits)
extra           (system control, 129-131,   3 bits) (power down, sleep, wake)
5 bits of padding

The generated descriptor on the issue-28 branch seems to be generating a sensible replacement for me, it breaks the first input (224-231,0-103) into two inputs, the first of which is (224-231), and the second is (0-103).

In short: everything looks like it should work. Can you double check the extension was attached to your keyboard with ioreg?

$ ioreg -b -f | grep IOUSBHIDDriverDescriptorOverride

Which should produce something like this (for my Noppoo):

    | |   |       |     | +-o IOUSBHIDDriverDescriptorOverride@1d180000,0  <class IOUSBHIDDriverDescriptorOverride, id 0x1000002b8, registered, matched, active, busy 0 (30 ms), retain 10>
    | |   |       |       +-o IOUSBHIDDriverDescriptorOverride@1d180000,1  <class IOUSBHIDDriverDescriptorOverride, id 0x1000002bb, registered, matched, active, busy 0 (19 ms), retain 10>
itek09 commented 8 years ago

Its not working (no response for $ ioreg -b -f | grep IOUSBHIDDriverDescriptorOverride)

If I do rake scan it is stucked at Checking device: #<LIBUSB::Device 20/11 04d9:a096 ? USB Keyboard ? (HID (01,01), HID (00,00), HID (00,00))>

This build don't generate any descriptor for my keyboard (i think).

Don't worry about the delay, thanks ;)

thefloweringash commented 8 years ago

I'm guessing there's a USB device that doesn't like being inspected. I've pushed a hack to issue-28 to only scan vendor 0x04d9, which should only scan your keyboard.

itek09 commented 8 years ago

The same with the hack, it is stucked at Checking device: #<LIBUSB::Device 20/11 04d9:a096 ? USB Keyboard ? (HID (01,01), HID (00,00), HID (00,00))>

I don't have more Holtek USB connected.

thefloweringash commented 8 years ago

Ok, let's give up on the scanner. I've put together a descriptor from the information you provided above. (On issue-28).

thefloweringash commented 8 years ago

I just noticed I made a typo. Pushed an update.

itek09 commented 8 years ago

You are a fuc***g boss man.

Last update work perfectly! Really thanks!

4t0m1k commented 8 years ago

Hello,

I got this keyboard too. I've tried the solution (ready to use) here : http://www.elotrolado.net/hilo_funciona-strikebattle-y-strike-pro-en-mac_2144818 released by @itek09 but it doesn't work.

I'm French and I bought the french keyboard, maybe is it for that reason it doesn't work ?

I've noticed that the bcdDevice of my keyboard is 3335 instead of 3332 (in the .plist) :

    +-o USB Keyboard@14100000  <class AppleUSBDevice, id 0x1000006d0, registered, matched, active, busy 0 (5 ms), retain 15>
          "idProduct" = 41110
          "bcdDevice" = 3335
          "idVendor" = 1241

What I've to do please ? Thank you !

thefloweringash commented 8 years ago

You should be able to treat this keyboard like any new device. Run rake scan to get the descriptors, rebuild, and install the extension. Make sure IOUSBHIDDriverDescriptorOverride shows up in ioreg after installing. The details should be in the readme, but if you get stuck please ask for clarification.

If the scanner doesn't work or the result doesn't help please attach a "Bus Probe" from USB Prober.app in the February 2012 version of Hardware IO Tools for Xcode.

4t0m1k commented 8 years ago

Thank you for your very quick answer !

Finally I've decided to replace my keyboard with the Corsair Gaming K65 RGB, more compatible with mac os x. It'll be more simple to get it to work. Sorry to have wasted your time : /

You got a very nice project, thank you again !

zatarra commented 8 years ago

Hi,

I'm sorry for hijacking the thread, but I'm having the same problem. I've followed the instructions but it didn't work.

The idVendor and idProduct are the same, but bcdDevice device differs. Could this be the problem?

I've also tried to compile de code so that I could try to update the corresponding yml file with the new bcdDevice value, but first I was having issues with Ruby and after updating to ruby 2.2.0 now I have a different issue ( fatal error: 'IOKit/usb/IOUSBHIDDriver.h' file not found ).

Anyway, these are the details:

iopo0232:iousbhiddriver-descriptor-override xxxxxxx$ rake scan
/Users/xxxxxxx/.rvm/rubies/ruby-2.2.0/bin/ruby scripts/scanner.rb
Checking device: #<LIBUSB::Device 20/20 04d9:a096 ? USB Keyboard ? (HID (01,01), HID (00,00), HID (00,00))>
Found ambiguity!
Writing details to descriptors/04d9-a096-USB_Keyboard.yaml
Checking device: #<LIBUSB::Device 20/3 05ac:0263 Apple Inc. Apple Internal Keyboard / Trackpad ? (HID (01,01), HID (00,00), HID (01,02))>
iopo0232:iousbhiddriver-descriptor-override xxxxxxxx$ cat descriptors/04d9-a096-USB_Keyboard.yaml
---
- idVendor: 1241
  idProduct: 41110
  bcdDevice: 3335
  bConfigurationValue: 1
  bInterfaceNumber: 1
  hidReportDescriptor: !binary |-
    BQEJBqEBhQWVcHUBFQAlAQUHGeAp5xkAKWeBApUIgQHABQEJgKEBhQIZgSmD
    FQAlAZUDdQGBApUBdQWBAcAFDAkBoQGFAxkAKv8CFQAm/3+VAXUQgQDABgD/
    CQGhAYUGFQAm/wAJL5UCdQiBAsAGAf8JAaEBhQcVACb/AAkgdQiVB7ECwA==
iopo0232:workspace xxxxxxxxx$ kextstat | grep IOUSBHIDDriverDescriptorOverride
  163    0 0xffffff7f83437000 0x2000     0x2000     ryangoulden.driver.IOUSBHIDDriverDescriptorOverride (1) 1E35113F-35B7-35DA-8F2A-B0A87608BFB8 <65 32 4 3>
iopo0232:workspace xxxxxxxx$ ioreg -b -f | grep IOUSBHIDDriverDescriptorOverride
iopo0232:workspace xxxxxxxx$
iopo0232:workspace xxxxxx$ ioreg -p IOUSB -c IOUSBDevice | grep -e class -e idVendor -e idProduct -e bcdDevice
+-o Root  <class IORegistryEntry, id 0x100000100, retain 14>
  +-o Root Hub Simulation Simulation@14000000  <class AppleUSBRootHubDevice, id 0x100000300, registered, matched, active, busy 0 (29 ms), retain 9>
    |   "idProduct" = 32773
    |   "idVendor" = 1452
    +-o BRCM20702 Hub@14300000  <class AppleUSBDevice, id 0x100000301, registered, matched, active, busy 0 (29 ms), retain 12>
    | |   "idProduct" = 17664
    | |   "bcdDevice" = 256
    | |   "idVendor" = 2652
    | +-o Bluetooth USB Host Controller@14330000  <class AppleUSBDevice, id 0x100000334, registered, matched, active, busy 0 (431 ms), retain 17>
    |       "idProduct" = 33417
    |       "bcdDevice" = 274
    |       "idVendor" = 1452
    +-o Apple Internal Keyboard / Trackpad@14400000  <class AppleUSBDevice, id 0x100000311, registered, matched, active, busy 0 (359 ms), retain 22>
    |     "idProduct" = 611
    |     "bcdDevice" = 549
    |     "idVendor" = 1452
    +-o USB Keyboard@14200000  <class AppleUSBDevice, id 0x100000aa5, registered, matched, active, busy 0 (9 ms), retain 15>
          "idProduct" = 41110
          "bcdDevice" = 3335
          "idVendor" = 1241

If you need more information please let me know.

thefloweringash commented 8 years ago

fatal error: 'IOKit/usb/IOUSBHIDDriver.h' file not found

This is typically caused by building on a newer version of OS X. The old interface still exists but can't be built against, so I'm sticking with the older interface to support older OS X versions. There's a branch that supports the modern interface called ft-el-cap, try that and see if it helps.

zatarra commented 8 years ago

That was probably the case. Anyway, I did it the hard (and lazy) way, and I just manually copied all the IOKit header files that were required to the root folder, changed their paths for dependencies and compiled the kernel extension. After changing the bcdDevice to match the one from my keyboard the extension worked perfectly. Thanks :)

On 29 Mar 2016, at 10:27, Andrew Childs notifications@github.com wrote:

fatal error: 'IOKit/usb/IOUSBHIDDriver.h' file not found

This is typically caused by building on a newer version of OS X. The old interface still exists but can't be built against, so I'm sticking with the older interface to support older OS X versions. There's a branch that supports the modern interface called ft-el-cap, try that and see if it helps.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/thefloweringash/iousbhiddriver-descriptor-override/issues/28#issuecomment-202799811

nitin981 commented 7 years ago

hi thefloweringash

is there any way to build IOKit/usb/IOUSBHIDDriver.h using mac 10.12 and xcode 8 i am facing build issue while building my project in which we included IOKit/usb/IOUSBHIDDriver.h basically i wanted to generate kext and test it

error :- 'IOKit/usb/IOUSBHIDDriver.h' . file not found