kiibohd / controller

Kiibohd Controller
GNU General Public License v3.0
807 stars 270 forks source link

USB to Bluetooth adapter doesnt seem to work #44

Open unphased opened 9 years ago

unphased commented 9 years ago

I'm quite a ways from making progress on debugging this but basically I have one of these:

http://www.amazon.com/Nulaxy-Wired-Keyboard-Bluetooth-Adapter/dp/B00T5YXNL0

And it's not able to complete the pairing procedure...

I guess this is not an easy problem to solve and it is easier to try out more of these devices until we find one that works. I was hoping if it worked out of the box that I could just take the casing apart and embed it into the infinity keyboard and I'd have myself a bluetooth-capable infinity bent plate board.

So I'm wondering if anyone's tried gadgets like this and experienced success.

kaansoral commented 9 years ago

Does it work with other keyboards? Maybe the NKRO stuff is messing with it's logic

On the bright side, I've measured infinitykb's power usage, it was at 0ma with the device I was using, so if you manage to make it work, the result will be satisfactory in terms of power usage :)

haata commented 9 years ago

You might be more successful if you set the keyboard in 6KRO mode. There isn't an easy way (yet) from the configurator, but you can do:

U"A":kbdProtocolBoot();

This will set the boot protocol when you press a.

On Sat, May 30, 2015 at 6:44 PM kaansoral notifications@github.com wrote:

Does it work with other keyboards? Maybe the NKRO stuff is messing with it's logic

On the bright side, I've measured infinitykb's power usage, it was at 0ma with the device I was using, so if you manage to make it work, the result will be satisfactory in terms of power usage :)

— Reply to this email directly or view it on GitHub https://github.com/kiibohd/controller/issues/44#issuecomment-107106641.

unphased commented 9 years ago

Awesome i will have to give that a try!

Currently I'm just running some configurator-generated layouts, and having some problems where my layer 1 function seems to get locked on permanently... thats totally separate and not necessarily an issue yet

unphased commented 9 years ago

I was able to add this line and it caused the 'a' key to no longer register an a.

However it is not clear how I can independently verify that the protocol changed. For example I plug it in, wait for it to initialize, mash A a bunch of times, no A's are sent by the keyboard, but I can still from this point press my hand down on a lot of keys at once (15+) and they all actually still register. On non-NKRO keyboards what usually happens is it "locks up" till the keys are released. That's not happening, they're streaming away in the same way that they do when NKRO is active.

I tried holding down A and doing the same (putting my hand down on the rest of the board). no change.

And i tried the bluetooth pairing a bunch of times, still no dice. Indeed the serial debug output shows NKRO protocol.

Update

Since I am a good keyboard freak I do happen to have a Ducky board that has its own builtin hardware switch Fn+F12 that toggles NKRO. I verified that if I leave NKRO off, I can successfully register a bluetooth keyboard with my Mac (and iOS devices!!!!!11) using the Nulaxy.

Then, while it is connected, I can toggle on NKRO on this ducky board and it stops working! And upon switching NKRO back off, it works again. So this is a very cool result that definitely verifies the hypothesis that NKRO is the thing that this Nulaxy can't handle.

I am also able to easily test NKRO active by smashing my hand across the keyboard, and it's clear that I just need to find a working way to set NKRO off for the Infinity board. I don't mind it being off 100% of the time so you can just show me how to make it boot up with NKRO off.

unphased commented 9 years ago

Here is the progress I made.

▸ AWHostedViewer/              |~
diff --git a/Output/pjrcUSB/arm/usb_dev.c b/Output/pjrcUSB/arm/usb_dev.c
index f09540c..0504738 100644
--- a/Output/pjrcUSB/arm/usb_dev.c
+++ b/Output/pjrcUSB/arm/usb_dev.c
@@ -455,7 +455,7 @@ static void usb_setup()
                printHex( setup.wValue & 0xFF );
                print(NL);
                #endif
-               USBKeys_Protocol = setup.wValue & 0xFF; // 0 - Boot Mode, 1 - NKRO Mode
+               USBKeys_Protocol = 0; // 0 - Boot Mode, 1 - NKRO Mode
                endpoint0_stall();
                return;

diff --git a/Output/pjrcUSB/output_com.c b/Output/pjrcUSB/output_com.c
index 7a9b84b..26d98e8 100644
--- a/Output/pjrcUSB/output_com.c
+++ b/Output/pjrcUSB/output_com.c
@@ -114,7 +114,7 @@ volatile uint8_t  USBKeys_LEDs = 0;
 // Protocol setting from the host.
 // 0 - Boot Mode
 // 1 - NKRO Mode (Default, unless set by a BIOS or boot interface)
-volatile uint8_t  USBKeys_Protocol = 1;
+volatile uint8_t  USBKeys_Protocol = 0;

 // Indicate if USB should send update
 // OS only needs update if there has been a change in state
@@ -191,7 +191,7 @@ void Output_kbdProtocolNKRO_capability( uint8_t state, uint8_t stateType, uint8_
        Output_flushBuffers();

        // Set the keyboard protocol to NKRO Mode
-       USBKeys_Protocol = 1;
+       USBKeys_Protocol = 0;
 }

This is fine considering how little I know of what's going on, I am finally able to see boot protocol output in debug over serial.

However, very sad to say, this made no difference and the bluetooth keyboard pairing does not work.

haata commented 9 years ago

Interesting. I just ordered one of the devices.

Also, I think I may have contact info for the developer of the device.

On Sun, Jun 7, 2015, 23:59 Steven Lu notifications@github.com wrote:

Here is the progress I made.

▸ AWHostedViewer/ |~ diff --git a/Output/pjrcUSB/arm/usb_dev.c b/Output/pjrcUSB/arm/usb_dev.c index f09540c..0504738 100644 --- a/Output/pjrcUSB/arm/usb_dev.c +++ b/Output/pjrcUSB/arm/usb_dev.c @@ -455,7 +455,7 @@ static void usb_setup() printHex( setup.wValue & 0xFF ); print(NL);

endif

  • USBKeys_Protocol = setup.wValue & 0xFF; // 0 - Boot Mode, 1 - NKRO Mode
  • USBKeys_Protocol = 0; // 0 - Boot Mode, 1 - NKRO Mode endpoint0_stall(); return;

diff --git a/Output/pjrcUSB/output_com.c b/Output/pjrcUSB/output_com.c index 7a9b84b..26d98e8 100644 --- a/Output/pjrcUSB/output_com.c +++ b/Output/pjrcUSB/output_com.c @@ -114,7 +114,7 @@ volatile uint8_t USBKeys_LEDs = 0; // Protocol setting from the host. // 0 - Boot Mode // 1 - NKRO Mode (Default, unless set by a BIOS or boot interface) -volatile uint8_t USBKeys_Protocol = 1; +volatile uint8_t USBKeys_Protocol = 0;

// Indicate if USB should send update // OS only needs update if there has been a change in state @@ -191,7 +191,7 @@ void Output_kbdProtocolNKRO_capability( uint8_t state, uint8t stateType, uint8 Output_flushBuffers();

    // Set the keyboard protocol to NKRO Mode
  • USBKeys_Protocol = 1;
  • USBKeys_Protocol = 0; }

This is fine considering how little I know of what's going on, I am finally able to see non NKRO output in debug over serial.

However, very sad to say, this made no difference and the bluetooth keyboard pairing does not work.

— Reply to this email directly or view it on GitHub https://github.com/kiibohd/controller/issues/44#issuecomment-109883678.

unphased commented 9 years ago

Thats fantastic, yeah I would imagine having a way to debug the bluetooth device is probably what we need