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

0 Members and 1 Guest are viewing this topic.

Offline hasu

  • Thread Starter
  • Posts: 3318
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #750 on: Mon, 04 October 2021, 18:20:29 »
Not stupid. You will have to wirte some codes and build firmware yourself. Keymap Editor can't do that at least.
In general changing keyboard language in the converter is very difficult, especially with AZERTY.
Change language on OS is good option if possible, of course.

Maybe stupid question, but can I use this Converter to switch from French AZERTI Lay-out to German ISO?

Many thanks t


Offline Horsebadorties

  • Posts: 6
  • Location: Eastern Seaboard
Re: USB to USB keyboard converter
« Reply #751 on: Mon, 04 October 2021, 19:27:03 »
Hi Hasu,

This is firmware with debug feature and it will cause the problem, I guess.
(Attachment Link)

This firmware with  media key and mouse key will work without the problem.
(Attachment Link)

You are correct! The first .hex file indeed replicated the problem. The second file works fine.

Thanks so much. Now I can actually start using the converter!

Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #752 on: Tue, 05 October 2021, 06:16:51 »
Hi Hasu,
    I have a Corsair K70 MK 2 LP and have visited [https://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?usb_usb][/https://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?usb_usb] from there I made no changes but simply downloaded the unimap.hex file. I then flashed the converter using FLIP and none of the mappings appear to work.

Attached is a log from hid_listen (just copy and paste from console) that shows the keyboard attaching. I hit a key to switch off the flashing LEDs and then try typing a Q and a W.

Hope that helps.

Thanks,
Mark

Offline hasu

  • Thread Starter
  • Posts: 3318
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #753 on: Tue, 05 October 2021, 07:18:09 »
mcaple,
The converter recognizes the keyboard somewhat but seems to fail to make it into Boot(6KRO) mode.

Please check 'Troubleshoot' section in the first post(just updated).
Can you flash debug firmware and check its log with hid_listen again?
Also try 'USB Descriptor Dumper' to get the keyboard's descriptor.

Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #754 on: Tue, 05 October 2021, 16:26:39 »
OK Hasu I hope this is what you need,

  • debug_log.txt contains the log from hid_listen
  • tmk_usb_desciptor.txt contains the text from the right hand panel of the USB Device Tree Viewer
  • Capture.PNG shows which branch of the tree I clicked on

Thanks,
Mark

Offline hasu

  • Thread Starter
  • Posts: 3318
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #755 on: Tue, 05 October 2021, 21:24:59 »
As for debug_log.txt, the converter seems to work well without explicit issue at startup. We will have to check keyboard's USB Descriptor colsely to further investigation now.

Sorry for confusion of  the instruction. Use hid_listen with TMK USB Descriptor Dumper firmware and just share all of its output like your debug_log.txt.


Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #756 on: Tue, 05 October 2021, 23:15:20 »
Aha,
   easy when you know this stuff so well to expect certain knowledge so no worries on your last request. I have now flashed the tmk dumper file and attached the log from hid_listen

Offline hasu

  • Thread Starter
  • Posts: 3318
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #757 on: Wed, 06 October 2021, 00:25:49 »
Attached file(tmk_dumper.txt) is output of debug firmware as previous, not of dumper firmware.


Output of dumper is exepected like below.
Code: [Select]
usb_state: 12                                                                                                                                                 
usb_state: 20                                                                                                                                                 
usb_state: 40                                                                                                                                                 
usb_state: 50                                                                                                                                                 
usb_state: 51                                                                                                                                                 
usb_state: 90                                                                                                                                                 
                                                                                                                                                             
//////////////////////////////////////////////////////////////////////                                                                                       
// USB_desc_dump                                                                                                                                             
// Address: 01                                                                                                                                               
// Lowspeed: 01                                                                                                                                               
                                                                                                                                                             
// Devicer dump:                                                                                                                                             
12 01 00 02 00 00 00 08 6A 04 11 00 00 01 00 00                                                                                                               
00 01                                                                                                                                                         
                                                                                                                                                             
// Device:                                                                                                                                                   
bLength:                12                                                                                                                                   
bDescriptorType:        01                                                                                                                                   
bcdUSB:                 0200                                                                                                                                 
bDeviceClass:           00                                                                                                                                   
bDeviceSubClass:        00                                                                                                                                   
bDeviceProtocol:        00                                                                                                                                   
bMaxPacketSize0:        08                                                                                                                                   
idVendor:               046A                                                                                                                                 
idProduct:              0011
bcdDevice:              0100
iManufacturer:          00
iProduct:               00
iSerialNumber:          00
bNumConfigurations:     01

// Config0 dump:        len: 0022
09 02 22 00 01 01 00 A0 32 09 04 00 00 01 03 01
01 00 09 21 11 01 00 01 22 40 00 07 05 81 03 08
00 0A


Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #758 on: Wed, 06 October 2021, 06:02:05 »
Sorry about that had a problem with the extension under windows  :(

Offline hasu

  • Thread Starter
  • Posts: 3318
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #759 on: Wed, 06 October 2021, 09:12:59 »
Thanks.
But dumper output is broken somewhat unfortunately.

Did you use QMK Toolbox for this, perhaps?  It is known to miss some output.

If so, use hid_listen directly in cmd or power shell.
If not, this is a bug of dumper firmware.

Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #760 on: Wed, 06 October 2021, 17:12:02 »
Morning Hasu,
     I didn't use TMK Toolbox for this and have found that you cannot use it and hid_hidden at the same time as one expects the converter to be in program mode and the other not.
     I did the whole process again and I think I have found that the first time you connect after reflash the output appears broken but if you disconnect and reconnect another time the output looks OK. I have attached 3 outputs for you. As you will see the 1st looks broken and the other 2 have the Corsair keyboard name and look complete. Let me know what you think.

Mark

Offline hasu

  • Thread Starter
  • Posts: 3318
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #761 on: Thu, 07 October 2021, 00:58:37 »
try3.txt has complete descriptors. Thanks.
Dumper firmware seems to have a bug on reading decriptors from K70.

Accodring to descriptors of the keyboard  it should support Boot mode(6KRO) as well as NKRO. But it seems to refuse Boot mode request of the converter for some reason.

I dont' know how to update Corsair keyboard firmware but the latest firmware may solve somewhat. iCUE software?

Try this to turn keyboard into 6KRO mode manually. This won't be a solution but may kind of work.
https://help.corsair.com/hc/en-us/articles/360053198052-How-to-Use-a-CORSAIR-keyboard-to-enter-BIOS-mode

Also try "Reset" to return to default setting.
https://help.corsair.com/hc/en-us/articles/360025465031-How-to-Reset-your-keyboard

Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #762 on: Thu, 07 October 2021, 02:56:55 »
Hi Hasu,
     I am writing this message using my Corsair K70 RGB with the USB-USB converter plugged in!!!! At the moment I have done nothing but this is a big step forward. I updated the firmware from 3.19 to 3.24 but that made no difference. What I did have to do was manually enter bios mode using https://help.corsair.com/hc/en-us/articles/360053198052-How-to-Use-a-CORSAIR-keyboard-to-enter-BIOS-mode

It suggests two options but my option was a mixture of the two. The options are

Code: [Select]
Entering BIOS mode
If your keyboard has a Windows lock key:

Hold down the Windows lock key and the F1 key at the same time.
Wait 5 seconds.
Release the Windows lock key and the F1 key.
 
If your keyboard does not have a Windows lock key:

Unplug your keyboard.
Hold down the S key and the B key at the same time.
Plug in your keyboard while still holding the S and B keys.
Release the S and B keys.

Well my keyboard has a windows lock and after plugging the keyboard in and hitting Windows lock key and F1 key nothing happened. What I had to do was unplug hold these two keys and replug the keyboard. I guess otherwise I am not quick enough before your little device is trying to enter BIOS mode.

I am a bit reluctant to try the reset option in fear of losing what I have.

As you say not perfect but just another key combination I need to commit to memory.

Could I ask one final question. Is their a location where people have shared how they have programmed their keyboard? Always easier to get ideas rather than reinvent the wheel. I know you were attempting the spacebar layer selector at one point, is that available anywhere? I did look at another topic that mentioned this work but the site that was linked does not exist anymore and I cannot remember where I was on geekhack  :-[.

Many thanks for your speedy responses thus far and I will try not to bother you anymore,
Mark

Offline hasu

  • Thread Starter
  • Posts: 3318
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #763 on: Thu, 07 October 2021, 07:33:28 »
Quote
Could I ask one final question. Is their a location where people have shared how they have programmed their keyboard? Always easier to get ideas rather than reinvent the wheel. I know you were attempting the spacebar layer selector at one point, is that available anywhere? I did look at another topic that mentioned this work but the site that was linked does not exist anymore and I cannot remember where I was on geekhack  :-[.

I tried to collect ideas and examples of keymap here but almost abandoned. I think people can github the wiki page for the purpose.
https://github.com/tmk/tmk_keyboard/wiki/Keymap-examples

As for layer swtich by spacebar search with word 'SpaceFn' in the first post.


Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #764 on: Thu, 07 October 2021, 17:13:59 »
Thanks Hasu,
     I want to try something a bit unusual out but I am having trouble working out how to get the shifted characters using

http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?usb_usb

For instance !, @, #, $, % etc

When I look at the Code Edit tab for A I see that the Hex code is 0004 which is not what I expected from

https://unicode-table.com/en/

or

https://unicode-table.com/jp/#0041

Offline hasu

  • Thread Starter
  • Posts: 3318
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #765 on: Thu, 07 October 2021, 18:45:04 »
You can use this to input the charactors.
https://github.com/tmk/tmk_keyboard/wiki/Keymap#212-modified-key

As for Unicode see this, you have to use keymap MACRO. Unicode input depends on your OS and is not suit for keyboard protocol. TMK doesn't support Unicode in efficient way at least.
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Keymap#2-unicode-input


Traverse these wiki pages for keymap.
https://github.com/tmk/tmk_keyboard/wiki#keymap

Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #766 on: Sat, 09 October 2021, 00:08:04 »
Hi Hasu,
    the SpaceFn https://geekhack.org/index.php?topic=51069.0 talks about the idea and then there are a few discussions about the implementation through a number of OS specific scripts and also your more generic implementation. Am I correct in thinking that you have implemented this in https://github.com/tmk/tmk_keyboard/tree/master/keyboard/gh60 as I can see your keymap_hasu.c ? After installing all the necessary software I have now successfully built this project using

Code: [Select]
make all
and I can see a gh60_lufa.hex

I was going to flash this to my keyboard to try this out. Is this how you would have done it? I feel this is probably a long winded way of getting to this point.

Mark



Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #767 on: Sat, 09 October 2021, 00:13:44 »
Sorry Hasu I missed this crucial piece of information (lots of moving parts to this stuff)

Code: [Select]
$ make KEYMAP=[poker|poker_set|poker_bit|plain|hasu|spacefn|hhkb|<name>]

I should have done

Code: [Select]
$ make KEYMAP=[hasu]
I guess my question was more of is gh60 the only place that you have implemented this logic or is there a better project for me to start with?

Mark

Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #768 on: Sat, 09 October 2021, 00:35:35 »
Unfortunately after doing a

Code: [Select]
make clean

and then

Code: [Select]
make KEYMAP=hasu
the gh60_lufa.hex is created but when I flash it none of the keys do anything. I think a little knowledge is a dangerous thing and I have attempted something silly.

Mark

Offline hasu

  • Thread Starter
  • Posts: 3318
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #769 on: Sat, 09 October 2021, 01:16:22 »
GH60 is product name of keyboard PCB, GH60 firmware is not suit for this converter.


You can define SpaceFn layout in Keymap Editor
See this exampel of SpaceFN layout: https://goo.gl/aFmnbY

This link displays Keymap Editor for HHKB Alt Controller by default, but you can
just select "USB-USB Converter" at "Base Firmware File:" to edit for this converter.
277129-0



Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #770 on: Sat, 09 October 2021, 17:11:29 »
Thanks Hasu,
     it's only after you reply that I notice the answer is right in front of my eyes, sorry and thanks for your patience. That layout is a great starter for me. When I asked about shifted characters you suggested I use MACROS. My understanding is they are key recordings defined in code.

An example of defining MACROS in keymap.c is given at https://github.com/tmk/tmk_keyboard/wiki/Keymap#232-examples

Once defined you simply index them from the TMK Keymap Editor Code Editor Tab using ACTION_MACRO and enter the index in Code(hex).

If the MACROS cannot be defined in the editor then is there code for the SpaceFn layout as https://github.com/tmk/tmk_keyboard/wiki/Keymap-examples says TBD.

Maybe they can be defined in the editor, as this hex firmware file is the output of the code? Sorry Hasu I know you are not the sole maintainer of TMK and I have asked too many questions but this is probably my last piece in the puzzle to start me on my keyboard journey and I will address other questions to the broader community.

Mark

Offline hasu

  • Thread Starter
  • Posts: 3318
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #771 on: Sat, 09 October 2021, 20:09:06 »
I meant that 'modified key' is enough for your need(shifted characters) and you don't have to use MACRO and Unicode probably.
https://github.com/tmk/tmk_keyboard/wiki/Keymap#212-modified-key

MACRO is not supported currently in Keymap Editor and you have to write C code. MACRO is not well documented and not maintained actively, you will have to traverse source codes and wiki pages in github. I don't recommend that unless you are a programmer who have enough time and patience.

Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #772 on: Sun, 10 October 2021, 18:47:44 »
Thanks Hasu,
    I have finally got around to defining my Atreus-like keyboard settings and have been trying it out. It does take a little unlearning but I am reasonably happy so far. I have what looks like a small issue when I toggle back to layer 0 from layer 2 the key action codes from layer 2 appear to be retained and not the action codes from layer 0.

It is described in the PROBLEMS section of https://github.com/mcaple/tmk_keyboard/wiki/Keymap-examples#atreus-like-layout

Any ideas?

As usual many thanks,
Mark

Offline hasu

  • Thread Starter
  • Posts: 3318
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: USB to USB keyboard converter
« Reply #773 on: Sun, 10 October 2021, 21:08:25 »
Great. In TMK keymap layer switching means enabling or disabling a layer, not moving one to another layer exactly.
"Toggle" action changes state(on/off) of a layer, you can turn a layer on if its current state is off, and vice versa.

I think what you want there is disabling Layer 2, not enabling Layer 0. (Layer 0 should be always enabled in most cases.)
You will have to T2 on Layer 2,  intead of T0.


I just found that we discussed about keymap topic here for a while, which is not specfic to USB-USB converter :D
Feel free to post in this thread if you have any generic problem or question to TMK firmware.
https://geekhack.org/index.php?topic=41989.0





Offline mcaple

  • Posts: 13
Re: USB to USB keyboard converter
« Reply #774 on: Mon, 11 October 2021, 01:19:28 »
Brilliant Hasu,
      the 'Toggle on Layer 2' tooltip confused me a bit. Maybe 'Toggle Layer2' or 'Toggle on/off Layer2' would have been better.

No more questions to you in this thread unless I find a USB-USB converter problems. Scouts honour.   :thumb:

Mark