Author Topic: USB to USB keyboard converter  (Read 151060 times)

0 Members and 10 Guests are viewing this topic.

Offline zucca

  • Posts: 14
Re: USB to USB keyboard converter
« Reply #450 on: Tue, 26 March 2019, 02:39:06 »
If the SW solution/bugfix is too complicated, then I suggest a hardware change, something like this:

VBUS Power control



https://www.circuitsathome.com/mcu/vbus-power-control-on-usb-host-shield/

to control when the keyboard has to startup.

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #451 on: Tue, 26 March 2019, 04:06:22 »
zucca, thank you for the suggestion. I've also seen the power switch are recommended to people with weird device problem several times  by Host Shield library maintainers on github.com. It may be useful or must-have for some exceptional keyboards while I still suppose keyboard incompatibilities of the converter is solvable by software in most cases.

From recent debug and observation, I almost believe the 're/boot-time fail problem' of USB-USB converter resides on usb interface facing with PC, not usb host shield side. At computer boot time USB interface receives suspend, resume and reset events on its bus multiple times and the converter seems to fail to handle either of the events. The converter(TMK firmware) performs kind of power saving and related actions when suspend and resume occurs, this is probably cause or one of causes at least. Removing those actions code the problem is not observed so far, it is promising for us. The code in question is used in many other converter and keyboard projects and its change can affect many of them, I'll look into and test it with care.

Let me take a little more time.

Thank you

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #452 on: Tue, 26 March 2019, 04:42:49 »
if there is someone is interested or want to try this is patch:

Code: [Select]
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index b5d0b50e..12c451d8 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -220,18 +220,20 @@ void EVENT_USB_Device_Connect(void)
 {
     print("[C]");
     /* For battery powered device */
+/*
     if (!USB_IsInitialized) {
         USB_Disable();
         USB_Init();
         USB_Device_EnableSOFEvents();
     }
+*/
 }
 
 void EVENT_USB_Device_Disconnect(void)
 {
     print("[D]");
     /* For battery powered device */
-    USB_IsInitialized = false;
+    //USB_IsInitialized = false;
 /* TODO: This doesn't work. After several plug in/outs can not be enumerated.
     if (USB_IsInitialized) {
         USB_Disable();  // Disable all interrupts
@@ -253,7 +255,7 @@ void EVENT_USB_Device_Suspend()
 #ifdef LUFA_DEBUG
     print("[S]");
 #endif
-    hook_usb_suspend_entry();
+    //hook_usb_suspend_entry();
 }
 
 void EVENT_USB_Device_WakeUp()
@@ -261,7 +263,7 @@ void EVENT_USB_Device_WakeUp()
 #ifdef LUFA_DEBUG
     print("[W]");
 #endif
-    hook_usb_wakeup();
+    //hook_usb_wakeup();
 }
 
 // called every 1ms
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline zucca

  • Posts: 14
Re: USB to USB keyboard converter
« Reply #453 on: Tue, 26 March 2019, 04:54:45 »
Thanks HASU!

It looks good, nice catch!

I have now to compile the code, so I have to set up a linux virtual machine in Windows, compile it and flash it.
I never have done it before so it will take some time, but I want to help in this project.

PS: also TaranVH has the same "rebooting" "re-plug" problem. See here:
https://github.com/TaranVH/2nd-keyboard/issues/45#issuecomment-455648812
Quote
Just unplug and re-plug a normal keyboard 10 times!
So if this works be prepared to sell trucks and trucks of your converter!
« Last Edit: Wed, 27 March 2019, 09:59:41 by zucca »

Offline zucca

  • Posts: 14
Re: USB to USB keyboard converter
« Reply #454 on: Thu, 04 April 2019, 16:44:11 »
Very Good hasu!

It was a long jorney but I learned a lot. First I need to set up an Ubuntu virtual machine and then I need to learn how GitHub works.

Since I am working with QMK I forked the QMK FW and I committed the patch to the branch "Reboot"

https://github.com/Zuckme/qmk_firmware/tree/Reboot

https://github.com/Zuckme/qmk_firmware/commit/3832438bac82653917628edbe5de99b4bcdceeaf

Now QMK is not equal to TMK, and I did this

https://github.com/Zuckme/qmk_firmware/commit/3832438bac82653917628edbe5de99b4bcdceeaf#r33042061

guessing is the right thing to do.

Anyway here my results:



So in my case the reboot worked for 81,25%! Reboot without keyboard attached no problem at all. Also by leaving the PC on and replugging the hasu+keyboard worked perfectly.

Another step to perfection!

Tomorrow I will take the patched converter to work and test it there.

hasu, can you please take a look at my patch?




Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #455 on: Thu, 04 April 2019, 17:21:05 »
Great. Thank you for your time.
I know rebooting computer many times is irritating time consuming job :D I would be very helpful for me if you can test with TMK as well. You may get different result.

My previous patch was too ad hoc and crude, I'm working on this and close to release.
I believe I found one of causes of the problem at least and the patch should improve/mitigate in many cases.

This is my current temporary working branch just for reference.
https://github.com/tmk/tmk_keyboard/tree/usb_usb_init_fix


EDIT:
zucca,
what is your keyboard actually, btw?
« Last Edit: Thu, 04 April 2019, 18:25:20 by hasu »
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline zucca

  • Posts: 14
Re: USB to USB keyboard converter
« Reply #456 on: Fri, 05 April 2019, 02:38:09 »
My pleasure to help on this brilliant project.

I would be very helpful for me if you can test with TMK as well. You may get different result.

I can do it. Can you tell me if the /keymaps/F24/config.h and /keymaps/F24/keymap.c are compatible with TMK FW?
Otherwise, I have to generate another mapping for TMK.

what is your keyboard actually, btw?

As stated before,
at Home: HP KU-0133
at Work:  HP KU-1156

This WE I will have no time for testing, please wait for next week. Moreover what is the best method to test the fix in your opinion?
According to my experiments the best is to leave the converter with the keyboard connected to the PC and reboot over and over again. Do you agree?

Now I am at work, I will test the patched converter through a monitor USB hub when I am rebooting, un/doking my work laptop. So far it failed once when I turned on the PC this morning :'(.
Remember at work it NEVER worked for me with the original QMK TaranVH firmware.
« Last Edit: Fri, 05 April 2019, 02:42:30 by zucca »

Offline Hypersphere

  • Posts: 1855
  • Location: USA
Re: USB to USB keyboard converter
« Reply #457 on: Fri, 05 April 2019, 12:37:06 »
@hasu and @zucca: Looks like you are getting close to a solution. Things are working "good enough" for me at the moment, so I think I will wait for your completed method before trying any intermediate patches.

I do, however, look forward to a solution to this problem, as it is rather inconvenient to unplug/replug the converter in my setup.

Thanks for your dedicated efforts! Much appreciated!

Offline zucca

  • Posts: 14
Re: USB to USB keyboard converter
« Reply #458 on: Wed, 17 April 2019, 02:16:22 »
Just a quick update.

I am doing a statistical investigation at work. The patched hasu converter did not started properly the first three times, after that is holding strong and it is now the 7th time that is working properly after a reboot; before it never worked.

I am sorry I could not test the TMK FW patch, I was busy with other projects. During the easter break I will be "unfortunately" on vacation so no time for testing neither, please be patience.

It looks like we are on the right path to solve the issue.  :thumb:


Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #459 on: Wed, 17 April 2019, 03:40:39 »
Just a quick update.

I am doing a statistical investigation at work. The patched hasu converter did not started properly the first three times, after that is holding strong and it is now the 7th time that is working properly after a reboot; before it never worked.

I am sorry I could not test the TMK FW patch, I was busy with other projects. During the easter break I will be "unfortunately" on vacation so no time for testing neither, please be patience.

It looks like we are on the right path to solve the issue.  :thumb:



I don't know whether the patch is compatible to QMK firmware, it is not perhaps. They may differ lot these days.

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline zucca

  • Posts: 14
Re: USB to USB keyboard converter
« Reply #460 on: Wed, 17 April 2019, 04:08:45 »
I don't know whether the patch is compatible to QMK firmware, it is not perhaps. They may differ lot these days.

Looks like you don't work with QMK at all, but you were able to generate a patch that is so much better also in QMK.
No worries once we have solved the issue in TMK, I will contact TaranHV or some QMK buddy to help us.

The idea to remove the code for saving energy on battery device is promising also for the QMK firmware.

Offline nevin

  • Posts: 413
  • Location: US
Re: USB to USB keyboard converter
« Reply #461 on: Thu, 18 April 2019, 20:27:08 »
Not the first time being "green" has caused a problem.
Keeb.io Viterbi, Apple m0110, Apple m0120, Apple m0110a, Apple 658-4081, Apple M1242, Apple AEK II, MK96, GH60/Pure, Cherry g84-4100, Adesso AKP-220B, Magicforce 68

Offline santo

  • Posts: 1
Re: USB to USB keyboard converter
« Reply #462 on: Sun, 28 April 2019, 12:52:49 »
Great work Hasu!

Just one question:
Is it possible for USB to USB converter to set a timeout for dual role keys after which oneshot key is discarded (like ONESHOT_TIMEOUT in HHKB controller)?


Sent from my iPad using Tapatalk

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #463 on: Sun, 28 April 2019, 19:04:38 »
Yes, you can configure functions with the converter as with other TMK firmware projects.
ONESHOT_TIMEOUT configuration is available with this covnerter, of course.

The timeout for dual role keys on TMK can be configured with TAPPING_TERM.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/keymap.md#4-tapping



Great work Hasu!

Just one question:
Is it possible for USB to USB converter to set a timeout for dual role keys after which oneshot key is discarded (like ONESHOT_TIMEOUT in HHKB controller)?


Sent from my iPad using Tapatalk

« Last Edit: Sun, 28 April 2019, 20:36:04 by hasu »
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline shiroshiro

  • Posts: 5
Re: USB to USB keyboard converter
« Reply #464 on: Mon, 29 April 2019, 05:48:56 »
Does this work with 5v version of the pro micro?

Offline scotland

  • Posts: 5
Re: USB to USB keyboard converter
« Reply #465 on: Wed, 08 May 2019, 03:40:09 »
I have hasu's USB to USB converter and I'm using it with an Apple aluminium keyboard for remapping certain keys. There is some weird behaviour that I have been living with for a while but hopefully someone can shed some light on it. It is related to pressing keys while others are held down. As a test, I opened notepad in Windows and would start to type and take a note of the behaviour. What I found is split into various Action/Behaviour patterns below. Note than when holding keys this happens very quickly. E.g. if I press and hold C then press and hold D then press B, this all happens very quickly (before Windows would start to repeat a keypress)

============
Action - Scenario 1
============
1) Press C and hold it
2) Press D and hold it
3) Press B and release B while still holding C and D

====================
Editor contents after each action
====================
1) c
2) cd
3) cdcd

I would have expected after releasing B that the contents would be "cdb" but instead of b, it appends "cd" again at the end.
This same behaviour happens if you substitue many of the keys on the keyboard in place of B in action 3. e.g. Space, M, L, K would all cause the same output of "cdcd". This seems to be any of the non-special chars on the ASDFGHJKL row or ZXCVBNM row which will cause this. If, for step 3, I use any of the keys on the QWERTYUIOP row, I do not get the double "cdcd" output - the output works as expected (see scenario 2 below).

============
Action - Scenario 2
============
1) Press C and hold it
2) Press D and hold it
3) Press T and release T while still holding C and D

====================
Editor contents after each action
====================
1) c
2) cd
3) cdt

So this works as expected and works for substituting any key from the QWERTYUIOP row in step 3.


============
Action - Scenario 3
============
1) Press A and hold it
2) Press Z and hold it
3) Press Space and release Space while still holding A and Z

====================
Editor contents after each action
====================
1) a
2) az
3) azaz

Similar weird behaviour to scenario 1.

============
Action - Scenario 4
============
1) Press D and hold it
2) Press C and hold it
3) Press Space and release Space while still holding D and C

====================
Editor contents after each action
====================
1) d
2) c
3) dccd

NOTE: this is slightly different to scenario 1 in that D is pressed before C but after action 3 we end up with "dccd" rather than "dcdc" like you would maybe expect after reading scenario 1.

============
Action - Scenario 5
============
1) Press D and hold it
2) Press E and hold it
3) Press P and release P while still holding D and E

====================
Editor contents after each action
====================
1) d
2) e
3) dede

============
Action - Scenario 6
============
1) Press E and hold it
2) Press D and hold it
3) Press P and release P while still holding E and D

====================
Editor contents after each action
====================
1) e
2) d
3) edde

Does anyone have any idea what is going on here and how to fix it?

Thanks





Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #466 on: Wed, 08 May 2019, 04:17:58 »
scotland,
It sounds to me like  primary cause is that the keyboard is 2KRO unfortunately. I believe "Apple aluminium keyboard" is consisted of switches on conductive mebrane matrix and 2KRO. With 2KRO keyboard third key may not be registered besides modifier keys baiscally, though, in some key combinations third key can be recognized like the "cdt" scenario.

Though, we may be able to improvement converter firmware for the keyboard. I think you should get just "cd" instead of "cdcd" when you press c, d and t, for example.

You can use 'hid_listen' tool to see debug message from converter. Share debug messages you get when doing the scenario "cdt".
https://github.com/tmk/tmk_keyboard#debugging

And what happens when doing those scenarios without the converter?

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #467 on: Wed, 08 May 2019, 18:27:22 »
Hypersphere and zucca,
I have found and fixed some problems on plugin and startup of keyboard. The fixes contribute to stability on both keyboard and PC side.

Could you try this attached binary and let me know your result?


@hasu and @zucca: Looks like you are getting close to a solution. Things are working "good enough" for me at the moment, so I think I will wait for your completed method before trying any intermediate patches.

I do, however, look forward to a solution to this problem, as it is rather inconvenient to unplug/replug the converter in my setup.

Thanks for your dedicated efforts! Much appreciated!

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline scotland

  • Posts: 5
Re: USB to USB keyboard converter
« Reply #468 on: Thu, 09 May 2019, 06:20:53 »
Thanks for the prompt reply. It sounds like you are correct in that WITHOUT the converter plugged in (i.e. the keyboard is connected directly to the laptop) I get the following:

============
Action - Scenario 1
============
1) Press C and hold it
2) Press D and hold it
3) Press B and release B while still holding C and D

====================
Editor contents after each action
====================
1) c
2) cd
3) cd

So the pressing of B is not registered.

The CDT scenario does work for the third key being pressed:

============
Action - Scenario 2
============
1) Press C and hold it
2) Press D and hold it
3) Press T and release T while still holding C and D

====================
Editor contents after each action
====================
1) c
2) cd
3) cdt

============
Action - Scenario 3
============
1) Press C and hold it
2) Press D and hold it
3) Press Space and release Space while still holding C and D

====================
Editor contents after each action
====================
1) c
2) cd
3) cd  (Just "cd" - there will be no space)

If I plug the converter back in and run hid_listen, I get the following output:

============
Action - Scenario 1
============
1) Press C and hold it
2) Press D and hold it
3) Press B and release B while still holding C and D

λ hid_listen
Waiting for device:
Listening:
input 10: 00 00 06 00 00 00 00 00
state:  00 00 06 00 00 00 00 00
input 10: 00 00 06 07 00 00 00 00
state:  00 00 06 07 00 00 00 00
input 10: 00 00 01 01 01 01 01 01
state:  00 00 00 00 00 00 00 00
input 10: 00 00 06 07 00 00 00 00
state:  00 00 06 07 00 00 00 00
input 10: 00 00 06 00 00 00 00 00
state:  00 00 06 00 00 00 00 00
input 10: 00 00 00 00 00 00 00 00
state:  00 00 00 00 00 00 00 00

============
Action - Scenario 2
============
1) Press C and hold it
2) Press D and hold it
3) Press T and release T while still holding C and D

λ hid_listen
Waiting for device:
Listening:
input 10: 00 00 06 00 00 00 00 00
state:  00 00 06 00 00 00 00 00
input 10: 00 00 06 07 00 00 00 00
state:  00 00 06 07 00 00 00 00
input 10: 00 00 06 07 17 00 00 00
state:  00 00 06 07 17 00 00 00
input 10: 00 00 06 07 00 00 00 00
state:  00 00 06 07 00 00 00 00
input 10: 00 00 06 00 00 00 00 00
state:  00 00 06 00 00 00 00 00
input 10: 00 00 00 00 00 00 00 00
state:  00 00 00 00 00 00 00 00

============
Action - Scenario 3
============
1) Press C and hold it
2) Press D and hold it
3) Press Space and release Space while still holding C and D

λ hid_listen
Waiting for device:
Listening:
input 10: 00 00 06 00 00 00 00 00
state:  00 00 06 00 00 00 00 00
input 10: 00 00 06 07 00 00 00 00
state:  00 00 06 07 00 00 00 00
input 10: 00 00 01 01 01 01 01 01
state:  00 00 00 00 00 00 00 00
input 10: 00 00 06 07 00 00 00 00
state:  00 00 06 07 00 00 00 00
input 10: 00 00 06 00 00 00 00 00
state:  00 00 06 00 00 00 00 00
input 10: 00 00 00 00 00 00 00 00
state:  00 00 00 00 00 00 00 00

It is really that 3rd scenario that is a killer for me. The behavior of C, D then Space is actually slightly different depending on how quickly I try to type. If I try that key combination 10 times in a row WIHTOUT the converter, I get this:

"cd cd cd cd cd cd cd cd cd cd "

Now WITH the converter:

"cd cdd cdd cdd cd cd cdd cdd cdd "

Given I use the command line a lot in my job, it's a real pain.

Is this something that could be fixed with a firmware tweak? If so, if you can even give me some pointers I'm happy to try changing the firmware myself.

Thanks

scotland,
It sounds to me like  primary cause is that the keyboard is 2KRO unfortunately. I believe "Apple aluminium keyboard" is consisted of switches on conductive mebrane matrix and 2KRO. With 2KRO keyboard third key may not be registered besides modifier keys baiscally, though, in some key combinations third key can be recognized like the "cdt" scenario.

Though, we may be able to improvement converter firmware for the keyboard. I think you should get just "cd" instead of "cdcd" when you press c, d and t, for example.

You can use 'hid_listen' tool to see debug message from converter. Share debug messages you get when doing the scenario "cdt".
https://github.com/tmk/tmk_keyboard#debugging

And what happens when doing those scenarios without the converter?

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #469 on: Thu, 09 May 2019, 20:55:42 »
Thank you for the info.
It seems that the keyboard reports Rollover error(0000010101010101) expectedly.
I fixed Rollover error handling code, can you try attached binary?

I almost believe this fix solves the issue.
If you can confirm it I'll update firmware in Keymap Editor in a few next weeks.


EDIT: btw, do you happen to know exact model number of  your keyboard?


============
Action - Scenario 3
============
1) Press C and hold it
2) Press D and hold it
3) Press Space and release Space while still holding C and D

λ hid_listen
Waiting for device:
Listening:
input 10: 00 00 06 00 00 00 00 00
state:  00 00 06 00 00 00 00 00
input 10: 00 00 06 07 00 00 00 00
state:  00 00 06 07 00 00 00 00
input 10: 00 00 01 01 01 01 01 01
state:  00 00 00 00 00 00 00 00
input 10: 00 00 06 07 00 00 00 00
state:  00 00 06 07 00 00 00 00
input 10: 00 00 06 00 00 00 00 00
state:  00 00 06 00 00 00 00 00
input 10: 00 00 00 00 00 00 00 00
state:  00 00 00 00 00 00 00 00

It is really that 3rd scenario that is a killer for me. The behavior of C, D then Space is actually slightly different depending on how quickly I try to type. If I try that key combination 10 times in a row WIHTOUT the converter, I get this:

"cd cd cd cd cd cd cd cd cd cd "

Now WITH the converter:

"cd cdd cdd cdd cd cd cdd cdd cdd "

Given I use the command line a lot in my job, it's a real pain.

Is this something that could be fixed with a firmware tweak? If so, if you can even give me some pointers I'm happy to try changing the firmware myself.

Thanks


« Last Edit: Thu, 09 May 2019, 20:57:58 by hasu »
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline scotland

  • Posts: 5
Re: USB to USB keyboard converter
« Reply #470 on: Fri, 10 May 2019, 04:55:49 »
I'm working from home today and the keyboard is in the office so I can't test this or get you an exact model number until Monday. Thanks for looking into this. I'll report back as soon as I test it on Monday morning.

Thank you for the info.
It seems that the keyboard reports Rollover error(0000010101010101) expectedly.
I fixed Rollover error handling code, can you try attached binary?

I almost believe this fix solves the issue.
If you can confirm it I'll update firmware in Keymap Editor in a few next weeks.


EDIT: btw, do you happen to know exact model number of  your keyboard?

Offline scotland

  • Posts: 5
Re: USB to USB keyboard converter
« Reply #471 on: Wed, 15 May 2019, 03:16:29 »
Hi Hasu,

I flashed the firmware and that has fixed all of the issues! Thank you for the help - you're a life saver.  :D

FYI the exact model of the Apple keyboard is A1243.

Cheers


Thank you for the info.
It seems that the keyboard reports Rollover error(0000010101010101) expectedly.
I fixed Rollover error handling code, can you try attached binary?

I almost believe this fix solves the issue.
If you can confirm it I'll update firmware in Keymap Editor in a few next weeks.


EDIT: btw, do you happen to know exact model number of  your keyboard?

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #472 on: Wed, 15 May 2019, 23:26:13 »
Thanks for your testing and report.
Great, I'll update prebuilt firmware of Keymap Editor in a few next weeks. Until then you can edit keymap by supplying the attached firmware as "Base Firmware File" for Keymap Editor.

Source code with the fix is available from this branch, not merged to master branch yet.
https://github.com/tmk/tmk_keyboard/tree/usb_usb_rollover_fix


Hi Hasu,

I flashed the firmware and that has fixed all of the issues! Thank you for the help - you're a life saver.  :D

FYI the exact model of the Apple keyboard is A1243.

Cheers


Thank you for the info.
It seems that the keyboard reports Rollover error(0000010101010101) expectedly.
I fixed Rollover error handling code, can you try attached binary?

I almost believe this fix solves the issue.
If you can confirm it I'll update firmware in Keymap Editor in a few next weeks.


EDIT: btw, do you happen to know exact model number of  your keyboard?

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline gavogavo

  • Posts: 1
Re: USB to USB keyboard converter
« Reply #473 on: Sat, 18 May 2019, 21:55:07 »
hi there,

HASU I sent you a PM but wanted to check this thread.. does this mean the problem of needing to unplug/replug has been fixed for sure?

I maybe want to use on a GMMK Compact but need to know there won't be problem of needing to unplug/replug... Also, have you got them in stock ?

Thank you!

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #474 on: Sun, 19 May 2019, 19:01:17 »
No, not confirmed the fix by real users suffering from the problem yet.
The converter stops working with some of keyboards occasionally(or often) at startup(power up/plug-in), and you need to replug to make the converter start again.

I for one found the problem with my 'Realforce RGB' with current firmware and confirmed that the problem no longer happen with new firmware with the fix.

There is no report about GMMK Compact from users yet, so I'm not sure that the converter work with the keyboard. We can't tell before real test.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Hypersphere

  • Posts: 1855
  • Location: USA
Re: USB to USB keyboard converter
« Reply #475 on: Sun, 26 May 2019, 11:12:29 »
Hypersphere and zucca,
I have found and fixed some problems on plugin and startup of keyboard. The fixes contribute to stability on both keyboard and PC side.

Could you try this attached binary and let me know your result?


@hasu and @zucca: Looks like you are getting close to a solution. Things are working "good enough" for me at the moment, so I think I will wait for your completed method before trying any intermediate patches.

I do, however, look forward to a solution to this problem, as it is rather inconvenient to unplug/replug the converter in my setup.

Thanks for your dedicated efforts! Much appreciated!

Hi, I have returned from travel, and I had some time to test the new hex file with the usb-usb converter and my RF R2 TKL keyboard. I regret to say that it did not work. The converter still has to be unplugged and replugged, both after restarting the computer and when using a KM switch to switch between two computers. I have not yet tested the converter with other keyboards, but previously, the problem existed with several very different keyboards plugged into the converter.

EDIT: My setup has a KM switch sharing a keyboard and mouse with 3 computers -- 2 running Linux and 1 running Windows. The KM switch is connected to a USB hub, and the keyboard and mouse are connected to the hub. When I am using the USB-USB converter, it is plugged into the USB hub, and the keyboard is plugged into the converter. Thus, the unplugging/replugging of the USB-USB converter occurs at the USB hub.

To make unplugging/replugging of the converter easier, I tried replacing the USB hub with a different USB hub that has a toggle switch for each USB receptacle. This works, but oddly enough, it does not work as well as unplugging and replugging. I usually need to toggle the switch on the keyboard receptacle 2-3 times to get the USB-USB converter to be reinitialized. Why should this be the case?

In any event, I think I will change my setup so that I will have a switchable USB hub within easy reach. Even if I need to toggle several times the switch to which the USB-USB converter is connected, this seems easier than unplugging/replugging the converter.
« Last Edit: Sun, 26 May 2019, 13:59:08 by Hypersphere »

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #476 on: Sun, 26 May 2019, 17:57:23 »
Hypersphere,
New firmware doesn't work for you, I'm again at my wits' end here and don't have things to do for this problem at this point unfortunately. Sorry.

Is there anyone have Realforce R2 with this converter here? Any information from other users would be helpful.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline zucca

  • Posts: 14
Re: USB to USB keyboard converter
« Reply #477 on: Tue, 28 May 2019, 13:19:40 »
Hypersphere and zucca,
I have found and fixed some problems on plugin and startup of keyboard. The fixes contribute to stability on both keyboard and PC side.

Could you try this attached binary and let me know your result?

Sorry guys for some reasons the blog notifications did not work for me anymore.

I'm sorry Hypersphere but for me that .hex works 100%. 25 Reboot tonight, I un-replugged the converter many times and it always worked.
The host keyboard was always recognized, not even an imperfection. No matter what I try and do, it always works!!!  :thumb:

I will take tomorrow the fixed HASU reboot converter to test it at work, where it will be stress tested on a Laptop with docking station.

@Hasu can I find your fix code here below?

This is my current temporary working branch just for reference.
https://github.com/tmk/tmk_keyboard/tree/usb_usb_init_fix

I will try to import it in QMK, since I believe you don't want to or not interested.
Another options could be to import the TaranHV .hex

https://github.com/Zuckme/N-keyboard/tree/master/HASU_USB/F24

in the TMK enviroment.... what do you suggest?

Thank you so much I am now recommending your converter to my friends.

I keep you posted in case I found any problems.


Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #478 on: Tue, 28 May 2019, 14:46:17 »
Thank you for testing the fix, @zucca.
Great to hear that it works on your site. I'll merge it into master branch and update Keymap Editor soon.

Yes, you can find the fix for the replug realted problem in that branch of tmk_keyboard and my own fork of USB_Host_Shield_2.0.
https://github.com/tmk/tmk_keyboard/tree/usb_usb_init_fix
https://github.com/tmk/USB_Host_Shield_2.0/tree/master

I think you want to merge the fix to QMK, not Taran's. I don't know how QMK differs from TMK at this point, but I guess merging the fix is sitll not difficult that much.
Or, why don't you just import QMK functions you need to TMK? :D

Hypersphere and zucca,
I have found and fixed some problems on plugin and startup of keyboard. The fixes contribute to stability on both keyboard and PC side.

Could you try this attached binary and let me know your result?

Sorry guys for some reasons the blog notifications did not work for me anymore.

I'm sorry Hypersphere but for me that .hex works 100%. 25 Reboot tonight, I un-replugged the converter many times and it always worked.
The host keyboard was always recognized, not even an imperfection. No matter what I try and do, it always works!!!  :thumb:

I will take tomorrow the fixed HASU reboot converter to test it at work, where it will be stress tested on a Laptop with docking station.

@Hasu can I find your fix code here below?

This is my current temporary working branch just for reference.
https://github.com/tmk/tmk_keyboard/tree/usb_usb_init_fix

I will try to import it in QMK, since I believe you don't want to or not interested.
Another options could be to import the TaranHV .hex

https://github.com/Zuckme/N-keyboard/tree/master/HASU_USB/F24

in the TMK enviroment.... what do you suggest?

Thank you so much I am now recommending your converter to my friends.

I keep you posted in case I found any problems.

Show Image


TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline zucca

  • Posts: 14
Re: USB to USB keyboard converter
« Reply #479 on: Tue, 28 May 2019, 15:08:21 »
I think you want to merge the fix to QMK, not Taran's. I don't know how QMK differs from TMK at this point, but I guess merging the fix is sitll not difficult that much.

Yes into QMK.

Or, why don't you just import QMK functions you need to TMK? :D

Well since I am a beginner with xMK firmware I don't know what would be easier for me. All what I need is this remapping:

https://github.com/Zuckme/N-keyboard/blob/master/HASU_USB/F24/keymap.c

very very easy stuff... nothing crazy. The only thing which is black magic for me is this code at the end of that file to trigger the F24 key at every host keyboard key press:

Code: [Select]
//https://docs.qmk.fm/keycode.txt
//shoutout to drashna on the QMK discord for basically writing this for me.... :P

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    static uint8_t f24_tracker;
    switch (keycode) {
    case KC_A ... KC_F23: //notice how it skips over F24
    case KC_EXECUTE ... KC_EXSEL: //exsel is the last one before the modifier keys
        if (record->event.pressed) {
            register_code(KC_F24); //this means to send F24 down
            f24_tracker++;
            register_code(keycode);
        } else {
            unregister_code(keycode);
            f24_tracker--;
            if (!f24_tracker) {
                unregister_code(KC_F24); //this means to send F24 up
            }
            //real key is released HERE
        }
        return false;
        break;
    }
    return true;
}

and I don't know if TMK can do that.

« Last Edit: Tue, 28 May 2019, 15:10:17 by zucca »

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #480 on: Tue, 28 May 2019, 16:32:21 »
That seems to be interesting and useful for TMK users too. I'll add 'hook' function equivalent to that.
Let me have some time, like a week.

Or, why don't you just import QMK functions you need to TMK? :D

Well since I am a beginner with xMK firmware I don't know what would be easier for me. All what I need is this remapping:

https://github.com/Zuckme/N-keyboard/blob/master/HASU_USB/F24/keymap.c

very very easy stuff... nothing crazy. The only thing which is black magic for me is this code at the end of that file to trigger the F24 key at every host keyboard key press:

Code: [Select]
//https://docs.qmk.fm/keycode.txt
//shoutout to drashna on the QMK discord for basically writing this for me.... :P

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    static uint8_t f24_tracker;
    switch (keycode) {
    case KC_A ... KC_F23: //notice how it skips over F24
    case KC_EXECUTE ... KC_EXSEL: //exsel is the last one before the modifier keys
        if (record->event.pressed) {
            register_code(KC_F24); //this means to send F24 down
            f24_tracker++;
            register_code(keycode);
        } else {
            unregister_code(keycode);
            f24_tracker--;
            if (!f24_tracker) {
                unregister_code(KC_F24); //this means to send F24 up
            }
            //real key is released HERE
        }
        return false;
        break;
    }
    return true;
}

and I don't know if TMK can do that.



TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #481 on: Tue, 04 June 2019, 19:56:01 »
zucca,
Code below is modified 'unimap.c' for your purpose, copy it to usb_usb directory. You can build with `make -f Maefile.unimap` in comand line. Or just use attached HEX file.

Code: [Select]
#include "unimap_trans.h"
#include "action_layer.h"


#define AC_FN0 ACTION_LAYER_MOMENTARY(1)

#ifdef KEYMAP_SECTION_ENABLE
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
#else
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
#endif
    UNIMAP(
              F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
    ESC,      F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,         VOLD,VOLU,MUTE,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, JYEN,BSPC,     INS, HOME,PGUP,    NLCK,PSLS,PAST,PMNS,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,     BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PPLS,
    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     NUHS,ENT,                         P4,  P5,  P6,  PCMM,
    LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     RO,  RSFT,          UP,           P1,  P2,  P3,  PENT,
    LCTL,LGUI,LALT,MHEN,          SPC,           HENK,KANA,RALT,RGUI,FN0, RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PEQL
    ),
    UNIMAP(
              TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
    GRV,      TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,TRNS,TRNS,         TRNS,TRNS,TRNS,
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, INS, DEL,      TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP,  INS,      TRNS,     TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,TRNS,TRNS,HOME,PGUP,LEFT,RGHT,     TRNS,TRNS,                        TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,END, PGDN,DOWN,     TRNS,TRNS,          PGUP,         TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,          TRNS,          TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     HOME,PGDN,END,     TRNS,     TRNS,TRNS
    ),
};


bool hook_process_action(keyrecord_t *record) {
    static uint8_t f24_tracker;
    action_t action = layer_switch_get_action(record->event);

    switch (action.code) {
    case KC_A ... KC_F23: //notice how it skips over F24
    case KC_EXECUTE ... KC_EXSEL: //exsel is the last one before the modifier keys
        if (record->event.pressed) {
            register_code(KC_F24); //this means to send F24 down
            f24_tracker++;
            register_code(action.code);
        } else {
            unregister_code(action.code);
            f24_tracker--;
            if (!f24_tracker) {
                unregister_code(KC_F24); //this means to send F24 up
            }
            //real key is released HERE
        }
        return true;
        break;
    }
    return false;
}

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline zucca

  • Posts: 14
Re: USB to USB keyboard converter
« Reply #482 on: Fri, 07 June 2019, 07:03:16 »
thank you HASU for your support.
Now I have "unfortunately" some vacation time, so please wait until next week and I will give you some feedback.

Meanwhile, your reboot fix is working solid rock also at my work.  :thumb:

Offline jayt

  • Posts: 1
Re: USB to USB keyboard converter
« Reply #483 on: Tue, 18 June 2019, 03:01:59 »
Hello hasu and everyone,

It's just a log. I have built one by myself.
Actually, I bought it from hasu a couple weeks ago and realized the KiCad file is on github. So I have tried to build another one just for fun this time.

Attached is chain of hasu's original and mine. Mine is a little dirty.  ;D

My keyboards are Topre Realforce 91UDK-G and ELECOM TK-FDP098TBK. They both work fine so far.

I'm still confusing which is correct 18p and 10p for C[4-5,10-11], 1k and 2k2 for R6.
Anyway, thank you very much hasu and everyone. I don't have any good useful idea for the LED on the board though.

Offline zucca

  • Posts: 14
Re: USB to USB keyboard converter
« Reply #484 on: Wed, 19 June 2019, 10:27:42 »
zucca,
Code below is modified 'unimap.c' for your purpose, copy it to usb_usb directory. You can build with `make -f Maefile.unimap` in comand line. Or just use attached HEX file.

Thanks hasu, it works better than perfect. I just did a 5 Minute check before starting another travel.
I will try to build some .hex with the F23 and F22 hook functions.

I tried to contact TeranVH in many ways but no luck. I wish he know that you provided a solution to everything.

 :thumb:

Offline senkwich

  • Posts: 2
    • Personal Website
Re: USB to USB keyboard converter
« Reply #485 on: Wed, 19 June 2019, 14:26:29 »
Just wanted to double-check that I understand the state of this awesome converter!

I own two Kinesis Advantage and one Kinesis Advantage 2. From what I've read, this does not work with the Kinesis Advantage 2 at all, right? But it sounds like the original Kinesis Advantage does work with this converter, but you cannot use the other USB ports on the original Kinesis Advantage.

Additionally, media keys and whatnot will pass through directly and work based on the keyboard's configuration. You can't modify them with this converter.

I've got some parts to modify my Kinesis Advantage 1/2, but would love to have a plug-and-play converter like this instead.

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #486 on: Wed, 19 June 2019, 18:28:43 »
@zucca, Great. I don't think TeranVH suffers from the problem you had, so he is not interested in this fix probably.

@senkwich, I think the converter sitll doesn't work with Kinesis Advantage 2 unless they update firmware and change order of USB intefaces. The converter expects that the first interface is keyboard but it is not on the keyboard. (It has also same problem on Apple Magic keyboard.)
This is converter firmware limitation and I have had plan to fix the limitation but didn't finish it yet, mainly because I don't have keyboard like that for test.

I can't remember if I have heard from users about 'Kinesis Advantage'.
« Last Edit: Wed, 19 June 2019, 18:30:43 by hasu »
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline senkwich

  • Posts: 2
    • Personal Website
Re: USB to USB keyboard converter
« Reply #487 on: Wed, 19 June 2019, 20:55:09 »
@senkwich, I think the converter sitll doesn't work with Kinesis Advantage 2 unless they update firmware and change order of USB intefaces. The converter expects that the first interface is keyboard but it is not on the keyboard. (It has also same problem on Apple Magic keyboard.)
This is converter firmware limitation and I have had plan to fix the limitation but didn't finish it yet, mainly because I don't have keyboard like that for test.

I can't remember if I have heard from users about 'Kinesis Advantage'.
I just ordered a couple from 1upkeyboards, so I'd be willing to be a tester to help figure this out and/or pitch in some code myself at https://github.com/tmk/tmk_keyboard/tree/master/converter/usb_usb

My availability will most likely open up to dive in around August. :)

Offline deadtree123

  • Posts: 2
Re: USB to USB keyboard converter
« Reply #488 on: Wed, 26 June 2019, 01:23:53 »
hey just wanted to pop in this thread and say thanks. I got the hasu usb controller last week, works great.  works perfectly with all layers I programmed into it. very very very very happy with it. :thumb: :thumb: :thumb:

Offline zucca

  • Posts: 14
Re: USB to USB keyboard converter
« Reply #489 on: Thu, 27 June 2019, 17:44:48 »
Well, time to give back something to the community.

I analyzed the HASU's code for the F24 hook, and I adapted it to the TaranVH .ahk integration by removing the modifier keys:

Code: [Select]
#include "unimap_trans.h"
#include "action_layer.h"


#define AC_FN0 ACTION_LAYER_MOMENTARY(1)

#ifdef KEYMAP_SECTION_ENABLE
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
#else
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
#endif
    UNIMAP(
              F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23,  NO,
    ESC,      F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PCMM,         VOLD,VOLU,MUTE,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, JYEN,BSPC,     INS, HOME,PGUP,    INT6,PSLS,PAST,PMNS,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,     BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PPLS,
    F20, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     NUHS,ENT,                         P4,  P5,  P6,  PCMM,
    INT2,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     RO,  INT3,          UP,           P1,  P2,  P3,  PENT,
    LANG2,LANG1,INT1,MHEN,         SPC,        HENK,KANA,LANG4,LANG3,INT4,INT5,     LEFT,DOWN,RGHT,    P0,       PDOT,PEQL
    ),
    UNIMAP(
              TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
    TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,TRNS,TRNS,         TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,     TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,TRNS,                        TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,END, PGDN,DOWN,     TRNS,TRNS,          TRNS,         TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,          TRNS,          TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,TRNS,TRNS,     TRNS,     TRNS,TRNS
    ),
};


bool hook_process_action(keyrecord_t *record) {
    static uint8_t f24_tracker;
    action_t action = layer_switch_get_action(record->event);

    switch (action.code) {
    case KC_A ... KC_F23: //notice how it skips over F24
    case KC_EXECUTE ... KC_EXSEL: //exsel is the last one before the modifier keys
        if (record->event.pressed) {
            register_code(KC_F24); //this means to send F24 down
            f24_tracker++;
            register_code(action.code);
        } else {
            unregister_code(action.code);
            f24_tracker--;
            if (!f24_tracker) {
                unregister_code(KC_F24); //this means to send F24 up
            }
            //real key is released HERE
        }
        return true;
        break;
    }
    return false;
}

Please note that the F24 key is replaced with NO, the rest are obvious changes.
It seems you need to write there the key from this list:
https://github.com/tmk/tmk_keyboard/wiki/Keycode
without the "KC_" prefix.

For the reference here the F23 hook:

Code: [Select]
#include "unimap_trans.h"
#include "action_layer.h"


#define AC_FN0 ACTION_LAYER_MOMENTARY(1)

#ifdef KEYMAP_SECTION_ENABLE
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
#else
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
#endif
    UNIMAP(
              F13, F14, F15, F16, F17, F18, F19, F20, F21, F22,  NO, F24,
    ESC,      F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PCMM,         VOLD,VOLU,MUTE,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, JYEN,BSPC,     INS, HOME,PGUP,    INT6,PSLS,PAST,PMNS,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,     BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PPLS,
    F20, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     NUHS,ENT,                         P4,  P5,  P6,  PCMM,
    INT2,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     RO,  INT3,          UP,           P1,  P2,  P3,  PENT,
    LANG2,LANG1,INT1,MHEN,         SPC,        HENK,KANA,LANG4,LANG3,INT4,INT5,     LEFT,DOWN,RGHT,    P0,       PDOT,PEQL
    ),
    UNIMAP(
              TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,
    TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,TRNS,TRNS,         TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,     TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,TRNS,                        TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,END, PGDN,DOWN,     TRNS,TRNS,          TRNS,         TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,          TRNS,          TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,TRNS,TRNS,     TRNS,     TRNS,TRNS
    ),
};


bool hook_process_action(keyrecord_t *record) {
    static uint8_t f23_tracker;
    action_t action = layer_switch_get_action(record->event);

    switch (action.code) {
    case KC_A ... KC_F22: //notice how it skips over F23
    case KC_F24 ... KC_EXSEL: //exsel is the last one before the modifier keys
        if (record->event.pressed) {
            register_code(KC_F23); //this means to send F23 down
            f23_tracker++;
            register_code(action.code);
        } else {
            unregister_code(action.code);
            f23_tracker--;
            if (!f23_tracker) {
                unregister_code(KC_F23); //this means to send F23 up
            }
            //real key is released HERE
        }
        return true;
        break;
    }
    return false;
}

also here the F23 was replaced with NO.

@zucca, Great. I don't think TeranVH suffers from the problem you had, so he is not interested in this fix probably.

I am not so sure, in the Youtube video he stated the need to plug first the USB-USB converter and then the keyboard after the PC is started up. Moreover also here:
https://github.com/TaranVH/2nd-keyboard/issues/45#issuecomment-455648812
he wrote:
Quote
Just unplug and re-plug a normal keyboard 10 times!

Anyway I posted this also in the LTT forum:
https://linustechtips.com/main/topic/1026955-can-your-keyboard-do-this/?do=findComment&comment=12603756

I can't do more.

Finally a little typo correction:

You can build with `make -f Maefile.unimap` in comand line. Or just use attached HEX file.

I think you meant:

Code: [Select]
make -f Makefile.unimap
Thanks again HASU, I hope to deal with you in the future again. You are a real gentleman.

PS: In the attachments I share the F24, F23, F22 hook compatible with the TaranVH .ahk 

Online AdrianMan

  • Posts: 51
Re: USB to USB keyboard converter
« Reply #490 on: Thu, 04 July 2019, 08:33:59 »
I would like to confirm compatibility with my new Realforce R2TL-US3-IV/AHBZ32 . Works great and the default FN key still works as intended for built in combos (ex FN+ F11 Caps/Ctrl swap)

Cheers and thanks for the work Hasu !


Offline mblsha

  • Posts: 7
Re: USB to USB keyboard converter
« Reply #491 on: Sat, 06 July 2019, 09:56:47 »
Just received my converter from 1UP Keyboards and it seems to work fine with Kinesis Advantage2, which is reported here as unsupported: was able to do some basic customizations through the web editor, media keys don't work as expected.

Very excited to finally do some heavy customizations!

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #492 on: Sat, 06 July 2019, 16:43:51 »
Just received my converter from 1UP Keyboards and it seems to work fine with Kinesis Advantage2, which is reported here as unsupported: was able to do some basic customizations through the web editor, media keys don't work as expected.

Very excited to finally do some heavy customizations!

Thanks for reporting and glad to hear that!
Converter firmware has been fixed some bugs and evolved gradually since its incompatiblity reported in 2016, and Kinesis firmware updates since then may involve this perhaps.

Updated compatibilty list in first post.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline mblsha

  • Posts: 7
Re: USB to USB keyboard converter
« Reply #493 on: Sat, 20 July 2019, 11:11:22 »
Tried to plug my Planck EZ with QMK firmware into the USB-USB converter and it doesn't work. What configuration options should I check?

I tried disabling NKRO but it didn't help (tried both the config options, and the `keymap_config.nkro = !keymap_config.nkro` approach at runtime).

I want to try using this keyboard with USB pedals, and on Mac it needs to be seen as a single USB device, USB-USB converter should help with that.

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #494 on: Sat, 20 July 2019, 18:53:56 »
No configuration for the converter basically, except for keymapping.

'USB descriptor' would be helpful for debug if your keyboard doesn't work.
Refer this for how to get 'USB descriptor'. https://github.com/tmk/tmk_keyboard/wiki/USB-Descriptor

And do you have link to explanation about "keymap_config.nkro" config?

Did you try this?
https://github.com/qmk/qmk_firmware/blob/421125211741993ba874068dadf4ab371d4d13de/docs/faq_debug.md#nkro-doesnt-work

Which USB pedals are you using and do they work with the converter?


Tried to plug my Planck EZ with QMK firmware into the USB-USB converter and it doesn't work. What configuration options should I check?

I tried disabling NKRO but it didn't help (tried both the config options, and the `keymap_config.nkro = !keymap_config.nkro` approach at runtime).

I want to try using this keyboard with USB pedals, and on Mac it needs to be seen as a single USB device, USB-USB converter should help with that.

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline mblsha

  • Posts: 7
Re: USB to USB keyboard converter
« Reply #495 on: Sun, 21 July 2019, 05:32:21 »
'USB descriptor' would be helpful for debug if your keyboard doesn't work.

Product ID:   0x6060
Vendor ID:   0xfeed
Version:   0.00
Serial Number:   0
Manufacturer:   OLKB

And do you have link to explanation about "keymap_config.nkro" config?

Code is similar to this, but I mapped it to a key (including the eeconfig_read_keymap() call):
https://github.com/tmk/tmk_keyboard/blob/cf6df9db5fa6123b418ca29455d467e4455c0ebd/tmk_core/common/bootmagic.c#L86-L89

Did you try this?
https://github.com/qmk/qmk_firmware/blob/421125211741993ba874068dadf4ab371d4d13de/docs/faq_debug.md#nkro-doesnt-work

I tried this, but I wasn't sure I was hitting the key combinations correctly, so I just created my custom key handler and used the same code it's internally using. Hopefully I haven't missed anything.

Which USB pedals are you using and do they work with the converter?

The ones I currently have are plugged directly to the Kinesis Advantage2 keyboard and can be remapped via its onboard keyswapping facilities, they should work fine as long as the keyboard is fine as well. But I'm  thinking on getting the Kinesis Savant Elite2 pedals in order to use them with the Planck.

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #496 on: Sun, 21 July 2019, 07:58:57 »
'USB descriptor' would be helpful for debug if your keyboard doesn't work.

Product ID:   0x6060
Vendor ID:   0xfeed
Version:   0.00
Serial Number:   0
Manufacturer:   OLKB

More detailed USB descriptor would be helpful, you need tool like 'lsusb' to get descriptor.
https://github.com/tmk/tmk_keyboard/wiki/USB-Descriptor


Quote
And do you have link to explanation about "keymap_config.nkro" config?

Code is similar to this, but I mapped it to a key (including the eeconfig_read_keymap() call):
https://github.com/tmk/tmk_keyboard/blob/cf6df9db5fa6123b418ca29455d467e4455c0ebd/tmk_core/common/bootmagic.c#L86-L89

The converter doesn't support NKRO from the beginning so you don't have to disable NKRO on the converter.
Instead, you want to disable NKRO on QMK firmware of your keyboard if keyboard doesn't switches from NKRO to 6KRO mode automatically.

Does the keyboard works with UEFI/BIOS interface screen normally? If so it seems to swich the modes properly.


Quote
Did you try this?
https://github.com/qmk/qmk_firmware/blob/421125211741993ba874068dadf4ab371d4d13de/docs/faq_debug.md#nkro-doesnt-work

I tried this, but I wasn't sure I was hitting the key combinations correctly, so I just created my custom key handler and used the same code it's internally using. Hopefully I haven't missed anything.

Just try holding all keys on your text editor in order like: asdfghj
If the keyboard is in 6KRO mode 'j'(7th key) is not registered on computer.


Quote
Which USB pedals are you using and do they work with the converter?

The ones I currently have are plugged directly to the Kinesis Advantage2 keyboard and can be remapped via its onboard keyswapping facilities, they should work fine as long as the keyboard is fine as well. But I'm  thinking on getting the Kinesis Savant Elite2 pedals in order to use them with the Planck.

Ah, I see.

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline mblsha

  • Posts: 7
Re: USB to USB keyboard converter
« Reply #497 on: Sun, 21 July 2019, 09:24:39 »
More detailed USB descriptor would be helpful, you need tool like 'lsusb' to get descriptor.
https://github.com/tmk/tmk_keyboard/wiki/USB-Descriptor

I'm on a Mac and lsusb doesn't show much info. Here's a screenshot of IORegistryExplorer, hope that helps:
https://imgur.com/a/8cv5W8d

And full output of the mac version of lsusb:

        Planck:

          Product ID: 0x6060
          Vendor ID: 0xfeed
          Version: 0.00
          Serial Number: 0
          Speed: Up to 12 Mb/sec
          Manufacturer: OLKB
          Location ID: 0x14300000 / 9
          Current Available (mA): 500
          Current Required (mA): 500
          Extra Operating Current (mA): 0

Does the keyboard works with UEFI/BIOS interface screen normally? If so it seems to swich the modes properly.

Verified: I can boot to BIOS using this keyboard on an old laptop.

Just try holding all keys on your text editor in order like: asdfghj
If the keyboard is in 6KRO mode 'j'(7th key) is not registered on computer.

Verified: the custom key with keymap_config.nkro works: it detects only up to 6 keypresses.

Offline mblsha

  • Posts: 7
Re: USB to USB keyboard converter
« Reply #498 on: Sun, 21 July 2019, 09:51:45 »
Was able to run USB Descriptor Dumper on a VM with Windows:
https://pastebin.com/Qv9vgvPz

Offline hasu

  • Thread Starter
  • Posts: 2926
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #499 on: Mon, 22 July 2019, 06:36:12 »
Thanks for the USB descripter.
I couldn't find any clue there unfortunately, though. And NKRO/6KRO switching doesn't seem to be the cause in that case.

Could you show output on debug console when the keyboard is plugged then?
Use hid_listen to see debug prints from the converter.
https://github.com/tmk/tmk_keyboard/wiki#debug-console
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt