Author Topic: TMK USB to USB keyboard converter  (Read 429959 times)

0 Members and 1 Guest are viewing this topic.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4737
  • Location: England
Re: TMK USB to USB keyboard converter
« Reply #800 on: Fri, 07 January 2022, 12:19:29 »
Hi All,

I recently got a USB-to-USB converter for my Realforce 87u, with the intention of remapping a few keys to better work with MacOS. Everything works great with one exception: swapping of capslock and left control.

My keyboard has jumpers that are already set to flip left control and capslock, which is great, however after programming the USB-to-USB converter it keeps interpreting capslock as capslock and left control as left control. I have tried both QMK and TMK with their respective online mappers, using QMK Toolbox to program the controller itself. I am not sure if there is an issue with using QMK Toolbox to deploy TMK firmware or if I need to clear the EEPROM of the QMK firmware prior to flashing the TMK firmware. Any help would be greatly appreciated.

I guess you are using a GUI to change the firmware?  If so you need to map things where they would be by default, so whatever you want to do with caps needs to be mapped next to A on screen even if the code for caps is actually sent when you press control.  The convertor (or indeed the computer) doesn't know what the keys are actually labelled, all it knows is what code has been sent.

If you are not using a GUI and/or are already doing this are you sure the physical switch works?
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline salvanipour

  • Posts: 25
Re: TMK USB to USB keyboard converter
« Reply #801 on: Fri, 07 January 2022, 13:30:18 »
Hi All,

I recently got a USB-to-USB converter for my Realforce 87u, with the intention of remapping a few keys to better work with MacOS. Everything works great with one exception: swapping of capslock and left control.

My keyboard has jumpers that are already set to flip left control and capslock, which is great, however after programming the USB-to-USB converter it keeps interpreting capslock as capslock and left control as left control. I have tried both QMK and TMK with their respective online mappers, using QMK Toolbox to program the controller itself. I am not sure if there is an issue with using QMK Toolbox to deploy TMK firmware or if I need to clear the EEPROM of the QMK firmware prior to flashing the TMK firmware. Any help would be greatly appreciated.

The convertor (or indeed the computer) doesn't know what the keys are actually labelled, all it knows is what code has been sent.

Thank you so much for this. I completely blanked out on the fact that the dip switch was already doing the flipping, so by telling the firmware to do the same thing it was essentially flopping it back to normal ANSI (self sabotage, so to speak). I updated the firmware accordingly:



And it works perfectly now. I cannot thank you enough for providing such an easy fix so quickly. I really appreciate it!

Edit: Also thank you Hasu for such a wonderful little device! So glad to be able to use my 87u again.
« Last Edit: Fri, 07 January 2022, 13:54:15 by salvanipour »

Offline HyperDown

  • Posts: 3
Re: TMK USB to USB keyboard converter
« Reply #802 on: Sun, 09 January 2022, 09:04:02 »
Am I correct in thinking that this converter will allow me to remap the 'kana' and 'eng' keys on a Japanese layout realforce keyboard?  I'm interested in mapping those keys to return and backspace, respectively.

 

Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #803 on: Sun, 09 January 2022, 12:36:30 »
I believe so.

EDIT: The converter supports all of six Japnese specific keys; 無変換(muhenkan), 変換(henkan), ひらがな(hiragana), ろ(ro), ¥(yen) and 全角/半角(zenkaku/hankaku).
Note that 全角/半角 key is identical to `(grave in US) in USB spec and TMK firmware.
And 英数(eisuu/english) and かな(kana) on Mac layout are handled as 無変換 and 変換 by the converter.

See this for JIS layout.
https://en.wikipedia.org/wiki/Keyboard_layout#Japanese
« Last Edit: Sun, 09 January 2022, 21:51:34 by hasu »

Offline HyperDown

  • Posts: 3
Re: TMK USB to USB keyboard converter
« Reply #804 on: Mon, 10 January 2022, 06:52:52 »
Thanks, Hasu!

Offline dxlr8r

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #805 on: Wed, 16 March 2022, 09:28:06 »
Perhaps been addressed before. But I would like to use layers, but I do not want to dedicate an entire button for it.

What would be perfect was to be able to switch to a layer by pressing and holding a key, like Space. And if you simply tap, you get the Space key.

Then once inside that layer, I could use a dedicated button to return to the default layer.

Guess kinda like a sticky version of ACTION_LAYER_TAP_KEY.

Perhaps this is already possible?
« Last Edit: Wed, 16 March 2022, 09:31:09 by dxlr8r »

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4737
  • Location: England
Re: TMK USB to USB keyboard converter
« Reply #806 on: Wed, 16 March 2022, 10:46:16 »
Perhaps been addressed before. But I would like to use layers, but I do not want to dedicate an entire button for it.
Not perfect but you could use the hold space for layer (with tap typing space) then on that layer have a key to switch to another layer with a key to return to default on it.  Then you could have hold space and tap M for a media layer or G for gaming (or whatever it is you do on your computer) with all the keys you want on the home row so you don't have to move your fingers.
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline qeebored

  • Posts: 10
  • Location: Norway
Re: TMK USB to USB keyboard converter
« Reply #807 on: Wed, 16 March 2022, 18:05:21 »
At last I got to test the converter I got in the mail a few weeks ago. It works really well with my HHKB Pro 2. I used an hour creating a decent keymap on the online configurator, and now it is almost as I want it. Thanks a lot for this excellent converter, Hasu.

Offline dxlr8r

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #808 on: Wed, 23 March 2022, 06:26:22 »
Perhaps been addressed before. But I would like to use layers, but I do not want to dedicate an entire button for it.
Not perfect but you could use the hold space for layer (with tap typing space) then on that layer have a key to switch to another layer with a key to return to default on it.  Then you could have hold space and tap M for a media layer or G for gaming (or whatever it is you do on your computer) with all the keys you want on the home row so you don't have to move your fingers.

That is a really good advice. Not what I wanted, but I think it might be better :)

Offline nevin

  • Posts: 1634
  • Location: US
Re: TMK USB to USB keyboard converter
« Reply #809 on: Wed, 23 March 2022, 09:24:46 »
depending on use, sometimes it's easier to have the layer switch as a momentary function.
- tapping space = space
- holding space = momentarily go to layer X while space is held (acting like a Fn key)
- dual role keys are key with some of the older macintosh keyboards.
...again, depends on use, but the momentary is usually easier than switching to a layer then switching back.
284106-0
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 hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #810 on: Thu, 24 March 2022, 16:46:16 »
Perhaps been addressed before. But I would like to use layers, but I do not want to dedicate an entire button for it.

What would be perfect was to be able to switch to a layer by pressing and holding a key, like Space. And if you simply tap, you get the Space key.

Then once inside that layer, I could use a dedicated button to return to the default layer.


Not sure I can help but describe details more about your usage scenario.

Is this what you want?
when you get something on destionation layer:
1. press and hold "space" to switch to destination layer.
2. release space. (still in destination layer)
3. register one or more keys in the destination layer
4. press and release "dedicated button" to return to the original layer

What key is "dedicated button" in your case?
You really want to place the function on your space, or other key?


Offline dxlr8r

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #811 on: Fri, 25 March 2022, 16:32:21 »
Not sure I can help but describe details more about your usage scenario.

Is this what you want?
when you get something on destionation layer:
1. press and hold "space" to switch to destination layer.
2. release space. (still in destination layer)
3. register one or more keys in the destination layer

Sound right.

4. press and release "dedicated button" to return to the original layer

What key is "dedicated button" in your case?
You really want to place the function on your space, or other key?

On my default layer, I do not want to dedicate a button, like a single tap, to anything else that what is printed on the key. I cannot do without any letter, space, backspace etc. :)

For other layers it is not a problem to dedicate a button entirely (no dual role) to a button.

Offline dxlr8r

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #812 on: Fri, 25 March 2022, 16:36:48 »
Is it possible to bind two actions to one key? Say you press "f", which then results in a layer switch, then types "F8" (just an example). I thought MACROs might do it, but in the example it can only type normal keys, and not function keys.

Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #813 on: Fri, 25 March 2022, 22:33:25 »
4. press and release "dedicated button" to return to the original layer

What key is "dedicated button" in your case?
You really want to place the function on your space, or other key?

On my default layer, I do not want to dedicate a button, like a single tap, to anything else that what is printed on the key. I cannot do without any letter, space, backspace etc. :)

For other layers it is not a problem to dedicate a button entirely (no dual role) to a button.



OK. I think I understand what you want somehow.

Save code below as file named 'unimap_stickylayer.c' and buiild firmware like this.
With this code you can enable 'Layer1' by holding 'Space' key on 'Layer0' and disable 'Layer1' by pressing(and release) 'Right Control' key on 'Layer 1'.

Quote

$ make -f Makefile.unimap KEYMAP=stickylayer clean
$ make -f Makefile.unimap KEYMAP=stickylayer

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


/* ID for user defined functions */
enum function_id {
    STICKY_LAYER,
};

/*
 * user defined action function
 */
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    xprintf("%s%d%s\n", (record->event.pressed ? "P" : "R"), record->tap.count, (record->tap.interrupted ? "i" : ""));

    switch (id) {
        case STICKY_LAYER:
            if (record->event.pressed) {
                if (record->tap.count > 0) {
                    register_code(KC_SPACE);
                } else {
                }
            } else {
                if (record->tap.count > 0) {
                    unregister_code(KC_SPACE);
                } else {
                    layer_on(1);
                }
            }
            break;
    }
}

#define AC_STL1     ACTION_FUNCTION_TAP(STICKY_LAYER)
#define AC_OFF1     ACTION_LAYER_OFF(1, ON_PRESS)

#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,          STL1,          HENK,KANA,RALT,RGUI,APP, 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,BTLD,         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,OFF1,     HOME,PGDN,END,     TRNS,     TRNS,TRNS
    ),
};

Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #814 on: Fri, 25 March 2022, 22:40:34 »
Is it possible to bind two actions to one key? Say you press "f", which then results in a layer switch, then types "F8" (just an example). I thought MACROs might do it, but in the example it can only type normal keys, and not function keys.

MACRO offers no layer handling action in current implementation.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4737
  • Location: England
Re: TMK USB to USB keyboard converter
« Reply #815 on: Sat, 26 March 2022, 03:26:13 »
Is it possible to bind two actions to one key? Say you press "f", which then results in a layer switch, then types "F8" (just an example). I thought MACROs might do it, but in the example it can only type normal keys, and not function keys.
Unless you're trying to mess with someone having no "f" on your keyboard really doesn't sound like a good idea

I guess you've simplified the scenario to the point of it looking useless, what are you actually trying to do?
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline dxlr8r

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #816 on: Sat, 26 March 2022, 07:04:26 »
I guess you've simplified the scenario to the point of it looking useless, what are you actually trying to do?

It was a simple example, yes. It is kind of complicated to explain. But the "f" key (just an example for a letter) remapping would not happen on the default layer. Kinda reminds me of the Simpsons episode where Homer is lacking keys for his typewriter, it quickly becomes funny ;)

But from the other layer, not default, my point would be to jump to the default layer (where f types f) then press a Function key. This mechanism could be used in for example emacs, where the Function key could drop you into a modal mode and layer. So it is way to integrate the keyboard layers with a software's layer.


It could also be used as a signal to the system, so it can provide the end user with a visual marker/notication of some kind of what layer the user is at. You jump to a layer, and a function key is pressed, which the system looks for.

Can also be used for prefix keys, say you are on layer 1, and bind f to Switch to layer 0, then type ctrl-o, then programs like emacs will see that as a prefix, and the next key you press with determine the command (C-o x).
« Last Edit: Sat, 26 March 2022, 07:42:41 by dxlr8r »

Offline dxlr8r

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #817 on: Sat, 26 March 2022, 07:08:18 »
MACRO offers no layer handling action in current implementation.

Thank you for answer though. Would be a nice feature though.

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4737
  • Location: England
Re: TMK USB to USB keyboard converter
« Reply #818 on: Sat, 26 March 2022, 07:46:48 »
But from the other layer, not default, my point would be to jump to the default layer (where f types f) then press a Function key. This mechanism could be used in for example emacs, where the Function key could drop you into a modal mode and layer. So it is way to integrate the keyboard layers with a software's layer.
That makes sense.

So you don't really care which order the actions happens in, maybe the tap key code could be manipulated to send the Fx key on the first tap then switch layer on the second?  A double tap is still going to be quicker than any other key combo.

If hasu doesn't say it wont work I'll have a look at it later.
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline dxlr8r

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #819 on: Sat, 26 March 2022, 08:11:27 »
So you don't really care which order the actions happens in, maybe the tap key code could be manipulated to send the Fx key on the first tap then switch layer on the second?  A double tap is still going to be quicker than any other key combo.

Order does not matter. But ideally one tap would be better though ;)

If hasu doesn't say it wont work I'll have a look at it later.

 :cool:

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4737
  • Location: England
Re: TMK USB to USB keyboard converter
« Reply #820 on: Sat, 26 March 2022, 12:11:58 »
one tap would be better though ;)

Based on the documentation I think this code should enable the keycode F2L2 which will type F2 then switch to layer 2 in a single tap, of the four scenarios the original handled only one remains as if it works you can't tap it twice because you'll be on another layer, and you wont quickly press another key while pressing this one because it wouldn't make sense to.  I think the code goes in the keymap.c file but I can't get it to compile because LUFA is too old (I have no idea what this is and the suggested fix doesn't work)

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


/* id for user defined functions */
enum function_id {
    F2_LAYER2,
};

/*
 * user defined action function
 */
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    if (record->event.pressed) dprint("P"); else dprint("R");
    dprintf("%d", record->tap.count);
    if (record->tap.interrupted) dprint("i");
    dprint("\n");

    switch (id) {
        case F2_LAYER2:
            if (record->event.pressed) {
                    register_code(KC_F2);
                    unregister_code(KC_F2);
                    layer_on(2)
            }
            break;
    }
}

#define AC_F2L2     ACTION_FUNCTION_TAP(F2_LAYER2)
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline dxlr8r

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #821 on: Sun, 27 March 2022, 15:26:51 »
I think the code goes in the keymap.c file but I can't get it to compile because LUFA is too old (I have no idea what this is and the suggested fix doesn't work)

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


/* id for user defined functions */
enum function_id {
    F2_LAYER2,
};

/*
 * user defined action function
 */
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    if (record->event.pressed) dprint("P"); else dprint("R");
    dprintf("%d", record->tap.count);
    if (record->tap.interrupted) dprint("i");
    dprint("\n");

    switch (id) {
        case F2_LAYER2:
            if (record->event.pressed) {
                    register_code(KC_F2);
                    unregister_code(KC_F2);
                    layer_on(2)
            }
            break;
    }
}

#define AC_F2L2     ACTION_FUNCTION_TAP(F2_LAYER2)

First, what is LUFA?

Second, it does not work here either. Tried putting in keymap.c and keymap_common.c.

I get:

Code: [Select]
In file included from keymap_my.c:1:
keymap_common.h:128:47: error: 'KC_F2L2' undeclared here (not in a function); did you mean 'KC_F22'?
  128 |       KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, /* 28-2F */ \
      |                                               ^~~
keymap_common.h:179:3: note: in expansion of macro 'KEYMAP_ALL'
  179 | ) KEYMAP_ALL( \
      |   ^~~~~~~~~~
keymap_my.c:39:5: note: in expansion of macro 'KEYMAP'
   39 |     KEYMAP(
      |     ^~~~~~
make: *** [obj_usb_usb/keymap_my.o] Error 1

EDIT: made it work, better example https://github.com/tmk/tmk_keyboard/blob/a93677cbf145baf210f92a9129ded55c9ef5657b/keyboard/hhkb/keymap_spacefn.c

So just call the action function from fn_actions.
« Last Edit: Sun, 27 March 2022, 15:37:02 by dxlr8r »

Offline dxlr8r

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #822 on: Mon, 28 March 2022, 07:12:50 »
So, I find myself in the same situation as many others before me... There are to few fn actions, I quickly used up all 32.

Then I read up on actionmap, does this work for USB to USB converter? And if so, any examples.

I also had issues compiling. I saw `keyboard/alps64` had some examples, so I tried:

Code: [Select]
keyboard/alps64 % make -f Makefile.unimap KEYMAP=hasu

-------- begin --------
avr-gcc (Homebrew AVR GCC 9.3.0_3) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

make: *** No rule to make target `obj_alps64_unimap/unimap_hasu.o', needed by `alps64_unimap.elf'.  Stop.

What am I missing? Using macOS Monterey on a M1.

Offline dxlr8r

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #823 on: Thu, 28 April 2022, 08:57:44 »
With this code you can enable 'Layer1' by holding 'Space' key on 'Layer0' and disable 'Layer1' by pressing(and release) 'Right Control' key on 'Layer 1'.

Code: [Select]
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    xprintf("%s%d%s\n", (record->event.pressed ? "P" : "R"), record->tap.count, (record->tap.interrupted ? "i" : ""));

    switch (id) {
        case STICKY_LAYER:
            if (record->event.pressed) {
                if (record->tap.count > 0) {
                    register_code(KC_SPACE);
                } else {
                }
            } else {
                if (record->tap.count > 0) {
                    unregister_code(KC_SPACE);
                } else {
                    layer_on(1);
                }
            }
            break;
    }
}

After reading up on the source code, I have unicode working, and all examples above.

I find myself wanting to experiment with tapping to change layers. I know you have "ACTION_LAYER_TAP_TOGGLE" for just that, but I want to be able to tap, say Space, quickly twice to switch to a layer, if you do not tap fast enough, or only once (some other key pressed afterwards) type Space as normal.

Offline qk6339zmdm

  • Posts: 18
Re: TMK USB to USB keyboard converter
« Reply #824 on: Fri, 29 April 2022, 23:29:49 »
The Anne Pro 2 model doesn't appear to work, attached is the debug output.

Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #825 on: Sat, 30 April 2022, 00:25:48 »
The Anne Pro 2 model doesn't appear to work, attached is the debug output.


what does USB-USB firmware show when the keyboard is plugged?

Offline qk6339zmdm

  • Posts: 18
Re: TMK USB to USB keyboard converter
« Reply #826 on: Sat, 30 April 2022, 06:38:01 »
Hi Hasu, if I understand you correctly here is the output, first when inserting the converter then the keyboard and with both:

Waiting for device:..........
Listening:

TMK:2ccdf7/LUFA:d6a7df/UHS2:e37ed6

USB configured.

Loop start.
usb_state: 12
usb_state: 20
usb_state: 40
usb_state: 50
usb_state: 51
host.Task: 2415
usb_state: A0

Device disconnected.
Waiting for new device:......
Listening:

TMK:2ccdf7/LUFA:d6a7df/UHS2:e37ed6

USB configured.

Loop start.
usb_state: 20
usb_state: 40
usb_state: 50
usb_state: 51
host.Task: 2416
usb_state: A0

Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #827 on: Wed, 04 May 2022, 08:36:55 »
Thanks for the log.
It fails at somewhere in configuration process.

Could you try this debug firmware to get more info?
https://github.com/tmk/tmk_keyboard/blob/master/converter/usb_usb/binary/usb_usb_debug.hex

Offline qk6339zmdm

  • Posts: 18
Re: TMK USB to USB keyboard converter
« Reply #828 on: Wed, 04 May 2022, 12:58:09 »
Here are the results, Hasu:

Waiting for device:...
Listening:

TMK:ed7dfa/LUFA:d6a7df/UHS2:065e50

USB configured.

Loop start.
usb_state: 12
usb_state: 20
usb_state: 40
usb_state: 50
usb_state: 51
Ci read:0012
left:0000
vid:04D9
pid:A293
klass:00
subklass:00
AC1
AC2
A2 driver:00
BM Init
Ci read:0008
left:0000
Addr:01
Ci read:0012
left:0000
NC:01
HID_PROTOCOL_KEYBOARD
[gC]Ci read:0009
left:0000
Cl:007B
Ci [xE1][xE1][xE++]read:0040
left:003B
read:003B
left:0000
bNumEP:02
Cnf:01
bIfaceNum:00
bNumIface:00

Interface:00
crST:05
SetProto:05
Init:05
BUSRST
AttemptConfig2:05
Configuring:05
host.Task: 2422
usb_state: A0

Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #829 on: Wed, 04 May 2022, 21:07:06 »
The keyboard replies to SET_PROTOCOL request with STALL, it doesn't seem to support the rquest for no reason.

Try attached firmware to see if the keyboard works without the request. Posting debug log would be helpful again.

* usb_usb_debug.hex (68.88 kB - downloaded 33 times.)

Thanks

Offline qk6339zmdm

  • Posts: 18
Re: TMK USB to USB keyboard converter
« Reply #830 on: Wed, 04 May 2022, 22:55:58 »
Thanks Hasu, you're a wizard!  Here's the output, the keyboard is accepting input now.

Waiting for device:...
Listening:

TMK:6a5741/LUFA:d6a7df/UHS2:13078c

USB configured.

Loop start.
usb_state: 20
usb_state: 40
usb_state: 50
usb_state: 51
Ci read:0012
left:0000
vid:04D9
pid:A293
klass:00
subklass:00
AC1
AC2
A2 driver:00
BM Init
Ci read:0008
left:0000
Addr:01
Ci read:0012
left:0000
NC:01
HID_PROTOCOL_KEYBOARD
[gC]Ci read:0009
left:0000
Cl:007B
Ci [xE1][xE1][xE++]read:0040
left:003B
read:003B
left:0000
bNumEP:02
Cnf:01
bIfaceNum:00
bNumIface:00

Interface:00
crST:05
PROTOCOL SET HID_BOOT rcode:05
crST:05
SET_IDLE rcode:05
Ci read:0040
left:0040
read:000F
left:0031
RPIPE rcode:00
BM configured
Init:00
AttemptConfig2:00
Configuring:00
host.Task: 2323
usb_state: 90
speed: full
Co

Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #831 on: Thu, 05 May 2022, 00:35:05 »
Great.
Updated source code at github repository. Now you can download new firmware from Keymap Editor.

Offline qk6339zmdm

  • Posts: 18
Re: TMK USB to USB keyboard converter
« Reply #832 on: Thu, 05 May 2022, 09:36:22 »
Thanks again Hasu!  Your updated firmware works!

Offline antony

  • Posts: 2
Re: TMK USB to USB keyboard converter
« Reply #833 on: Wed, 25 May 2022, 13:14:18 »
i use a computer that only accept a German keyboard! And I can't change to my favorite one, US ASCCI or ISO International  After a year I am getting better at using DE keyboard.  Still it feels slowing me down. I  use vim, screen, tmux all day, think of  [], {} with  the Alt Gr combinations. 
So I would like build a hardware keyboard mapping translator. Would TMK be able translate from a English keyboard to a German keyboard? Is there a TMK firmware or an examples of mapping a layout to a German keyboard layout?
Any pointers before I order the hardware?

Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #834 on: Thu, 26 May 2022, 23:21:10 »
This is not trivial and you have to write C code to implement it.

You mean that you cannot change 'keyboard layout' setting on the computer and it is German, right?
Layout of your 'physical' keyboard is not that matter here, but let's assume it is US ASCII for sake of simplicity.


For example, when you press '[' on your US keyboard you will get '' by default but you want to get '[' here.
To get '[' char on the computer the keyboard(conveter) have to send scan code for 'RAlt + 8'.
This can be done with `ACTION_MODS_KEY(MOD_RALT, KC_8)` relatively easily. See line 96 and 230.

And you want to get '{' char when pressing Shift + '[' on your US keyboard. This is more complex. The converter should send scan code for 'RAlt+9' but it have to cancel Shift before sending the code.
See line 146 and 240.

https://gist.github.com/tmk/70babc152e09f102396dc0a621c8d66a/332f76be59c95c9efc33bcfd9337f7de26ba9501

I implemented Default(0) and Shift(1) layer for trial, and it seems to work during my brief test on Linux. Note that keys tweaked with `CANCEL_*` function can't do key repeating.
« Last Edit: Thu, 26 May 2022, 23:33:18 by hasu »

Offline antony

  • Posts: 2
Re: TMK USB to USB keyboard converter
« Reply #835 on: Wed, 01 June 2022, 09:09:07 »
thanks hasu. C code should be fine me me. Your message to me sounds like I should be prepared for a lot of debugging. Can I attach TMK's console? I didn't read in depth yet.


I see the restriction, can't repeat some keys. It seems ok now. Special keys {},[] seems are not often repeated. And I am not 100% where that would be an issue. Repeating is most important for space bar, arrow keys, backspace, delete. I guess I will order some.


Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #836 on: Thu, 02 June 2022, 02:23:52 »
Yes you can use hid_listen to to see debug prints. See this wiki page.

https://github.com/tmk/tmk_keyboard/wiki#hid_listen

You can use xprintf() to show values on debug console like below.

Code: [Select]
#include "print.h"

xprintf("key: %02X\n", key);

Refer to this for xprintf format string:
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/avr/xprintf.h#L62-L85




Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #838 on: Mon, 13 June 2022, 19:30:35 »
Thanks for your report!
Updated the list in the first post.

Offline ionflux

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #839 on: Thu, 30 June 2022, 12:14:15 »
Hi guys!
sorry for posting here, I'm a bit lost. What can I do if my keyboard is working with TMK but not with QMK?? it's a filco majestouch ninja. I bought it because I had success with filco majestouch 2 (the hasu converter experience was life changing!!), but it seems the ninja version is not working.
I would keep TMK instead, but I need KC_LSPO/KC_RSPC (the shift as parens thingie)
I have the debug output, but it's useless, right? since it's actually working with TMK....

Code: [Select]
> TMK:2dc680/LUFA:d6a7df/UHS2:3b1e03
>
> USB configured.
>
> Loop start.
> usb_state: 20
USB device connected (HidUsb): (Standard system devices) USB Input Device (FEED:005B:0815)
USB device connected (HidUsb): (Standard system devices) USB Input Device (FEED:005B:0815)
USB device connected (usbccgp): (Standard USB Host Controller) USB Composite Device (FEED:005B:0815)
> usb_state: 40
> usb_state: 50
> usb_state: 51
> BM Init
> Addr:01
> NC:01
> HID_PROTOCOL_KEYBOARD
> bNumEP:02
> Cnf:01
> bIfaceNum:00
> bNumIface:00
>
> Interface:00
> PROTOCOL SET HID_BOOT rcode:00
> SET_IDLE rcode:00
> RPIPE rcode:00
> BM configured
> host.Task: 2317
> usb_state: 90
> speed: full


Many thanks in advance for any suggestions...


Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #840 on: Thu, 30 June 2022, 20:46:41 »
ionflux,
This is my implementation of steve losh's Shift Parentheses.
I don't know how QMK does this internally, you may want to looking into their codes.

You can disscuss its details there.

https://github.com/tmk/tmk_keyboard/discussions/744

Offline ionflux

  • Posts: 14
Re: TMK USB to USB keyboard converter
« Reply #841 on: Fri, 01 July 2022, 02:16:44 »
Many Thanks for this hasu !! I'll try it !!
it's weird because i thought i almost got it with the TMK online editor, except i could sort of do it with the brackets, but not the parens :(
anyway, this looks like it's exactly what I need.

Offline Fabrice

  • Posts: 2
  • Location: Paris
Re: TMK USB to USB keyboard converter
« Reply #842 on: Sun, 10 July 2022, 02:28:52 »
Hi guys,

I compiled the usb_usb using the command make and I was able to upload the usb_usb.hex file into my "pro micro 5v 16mhz". Then I plugged my "pro micro" in my laptop and it recognizes it as a keyboard => OK :)

Then I compiled using the command "make -f Makefile.8mhz" for my "pro micro 3.3v 8mhz" and I get an error :

Code: [Select]
-------- begin --------
avr-gcc (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Linking: usb_usb.elf
avr-gcc -mmcu=atmega32u4 -gdwarf-2 -DF_CPU=8000000UL -DBOOTLOADER_SIZE=4096 -DTMK_USB_HOST_SHIELD_VERSION=3b1e03 -DARDUINO=1813 -DTMK_LUFA_VERSION=d6a7df -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DUNIMAP_ENABLE -DACTIONMAP_ENABLE -DMOUSEKEY_ENABLE -DMOUSE_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DKEYMAP_SECTION_ENABLE -DTMK_VERSION=4923f0 -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=usb_usb.elf -I../../tmk_core/common -I. -I../../tmk_core -I../../tmk_core/protocol/usb_hid -I../../tmk_core/protocol/usb_hid/USB_Host_Shield_2.0-tmk -I../../tmk_core/protocol/usb_hid/arduino-1.8.13/cores/arduino -I../../tmk_core/protocol/usb_hid/arduino-1.8.13/variants/leonardo -I../../tmk_core/protocol/lufa -I../../tmk_core/protocol/lufa/lufa-abcminiuser -I../../tmk_core/common -std=gnu99 -include config.h -MMD -MP -MF .dep/usb_usb.elf.d   obj_usb_usb/unimap.o obj_usb_usb/usb_usb.cpp.o obj_usb_usb/protocol/usb_hid/parser.cpp.o obj_usb_usb/protocol/usb_hid/override_Serial.cpp.o obj_usb_usb/protocol/usb_hid/override_wiring.o obj_usb_usb/common/avr/timer.o obj_usb_usb/protocol/usb_hid/USB_Host_Shield_2.0-tmk/Usb.cpp.o obj_usb_usb/protocol/usb_hid/USB_Host_Shield_2.0-tmk/usbhid.cpp.o obj_usb_usb/protocol/usb_hid/USB_Host_Shield_2.0-tmk/usbhub.cpp.o obj_usb_usb/protocol/usb_hid/USB_Host_Shield_2.0-tmk/parsetools.cpp.o obj_usb_usb/protocol/usb_hid/USB_Host_Shield_2.0-tmk/message.cpp.o obj_usb_usb/protocol/usb_hid/arduino-1.8.13/cores/arduino/abi.cpp.o obj_usb_usb/protocol/usb_hid/arduino-1.8.13/cores/arduino/Print.cpp.o obj_usb_usb/protocol/usb_hid/arduino-1.8.13/cores/arduino/Stream.cpp.o obj_usb_usb/protocol/lufa/lufa.o obj_usb_usb/protocol/lufa/descriptor.o obj_usb_usb/protocol/lufa/lufa-abcminiuser/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.o obj_usb_usb/protocol/lufa/lufa-abcminiuser/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.o obj_usb_usb/protocol/lufa/lufa-abcminiuser/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.o obj_usb_usb/protocol/lufa/lufa-abcminiuser/LUFA/Drivers/USB/Core/DeviceStandardReq.o obj_usb_usb/protocol/lufa/lufa-abcminiuser/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.o obj_usb_usb/protocol/lufa/lufa-abcminiuser/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.o obj_usb_usb/protocol/lufa/lufa-abcminiuser/LUFA/Drivers/USB/Core/ConfigDescriptors.o obj_usb_usb/protocol/lufa/lufa-abcminiuser/LUFA/Drivers/USB/Core/Events.o obj_usb_usb/protocol/lufa/lufa-abcminiuser/LUFA/Drivers/USB/Core/USBTask.o obj_usb_usb/protocol/lufa/lufa-abcminiuser/LUFA/Drivers/USB/Class/Common/HIDParser.o obj_usb_usb/common/host.o obj_usb_usb/common/keyboard.o obj_usb_usb/common/matrix.o obj_usb_usb/common/action.o obj_usb_usb/common/action_tapping.o obj_usb_usb/common/action_macro.o obj_usb_usb/common/action_layer.o obj_usb_usb/common/action_util.o obj_usb_usb/common/print.o obj_usb_usb/common/debug.o obj_usb_usb/common/util.o obj_usb_usb/common/hook.o obj_usb_usb/common/avr/suspend.o obj_usb_usb/common/avr/xprintf.o obj_usb_usb/common/avr/bootloader.o obj_usb_usb/common/unimap.o obj_usb_usb/common/mousekey.o --output usb_usb.elf -Wl,-Map=usb_usb.map,--cref -Wl,--gc-sections     -lm -Wl,-L../../tmk_core,-Tldscript_keymap_avr5.x
/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: section .keymap loaded at [0000000000006800,00000000000069ff] overlaps section .data loaded at [00000000000067ac,0000000000006847]
collect2: error: ld returned 1 exit status
make: *** [../../tmk_core/rules.mk:552: usb_usb.elf] Error 1


The content of the file Makefile.8mhz :

Code: [Select]
F_CPU = 8000000
F_USB = 16000000
UNIMAP_ENABLE = yes
KEYMAP_SECTION_ENABLE = yes
include Makefile

So, commenting the lines "KEYMAP_SECTION_ENABLE" and "UNIMAP_ENABLE",  I am able to compile. So I uploaded the hex file into my "pro micro 3.3v 8mhz". But when I plug it into my laptop, it returns "Unknown device ..." =>  NOK  :(
I tried on 2 different "pro micro 3.3v 8mhz", so I assume that it is not a hardware issue.

Any idea ?

Thanks for your help :)

Fabrice

Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #843 on: Mon, 11 July 2022, 21:15:45 »
Your firmware build runs out of flash space.

Code: [Select]
/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: section .keymap loaded at [0000000000006800,00000000000069ff] overlaps section .data loaded at [00000000000067ac,0000000000006847]


You will have to make firmware smaller in some way

1) Give up some feature and disable build options in Makefile.

Code: [Select]
# Build Options
#   comment out to disable the options.
#
MOUSEKEY_ENABLE ?= yes  # Mouse keys
EXTRAKEY_ENABLE ?= yes  # Media control and System control
CONSOLE_ENABLE ?= yes   # Console for debug


2) Or try other version of GCC. I confirmed that default 'Makefile.8mhz' firmware can be compiled with  7.3.0.

Code: [Select]
$ avr-gcc --version
avr-gcc (AVR_8_bit_GNU_Toolchain_3.7.0_1796) 7.3.0
[code]

Offline Fabrice

  • Posts: 2
  • Location: Paris
Re: TMK USB to USB keyboard converter
« Reply #844 on: Fri, 15 July 2022, 04:26:21 »
Thanks Hasu, it works !

I updated my avr-gcc from 5.4.0 to 12.1.0 and set MOUSEKEY_ENABLE to no.
So it compiled.
But once uploaded into my "pro micro 3.3v 8mhz", it is seen as "unknown device" when my "pro micro 5.5v 16 mhz" works.
This is another issue I have to investiguate.

Thanks again for your help !

Fabrice

Offline nahuel

  • Posts: 1
Re: TMK USB to USB keyboard converter
« Reply #845 on: Wed, 17 August 2022, 09:10:57 »
I'm evaluating using this converter with the Tex Shinobi Keyboard. This keyboard has a trackpoint in it. Is Hasu compatible? I doubt if the mouse events coming from the trackpoint will be passed to the PC.

Offline Lucky_Marsupial

  • Posts: 6
Tapping term question
« Reply #846 on: Fri, 02 September 2022, 21:02:52 »
I have a converter working with my keyboard. I'm trying to use home row modifiers, which I was using successfully before with an Atreus, but I got the converter so I could try home row modifiers with my Unicomp buckling spring. They are not working well, and I want to adjust the tapping term as described here: https://github.com/tmk/tmk_keyboard/wiki/FAQ-Keymap#tap-keydual-role-key-doesnt-work-for-me The problem is that I am really out of my depth on most keyboard things (think old man / non-programmer / Win 10 / MS Office user) and I am programming the layout using the TMK Keymap Editor page to create the hex file. I don't see a place to adjust the tapping term there, and I can't imagine figuring out how to compile the hex file from a text file layout. Is it possible to increase the tapping term using the editor web site? Or is it actually easy to create the hex file on my Win 10 machine without installing a Linux VM or doing lots of command line stuff? Or am I just out of luck? Thanks for any help.

Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #847 on: Fri, 02 September 2022, 22:26:40 »
I have a converter working with my keyboard. I'm trying to use home row modifiers, which I was using successfully before with an Atreus, but I got the converter so I could try home row modifiers with my Unicomp buckling spring. They are not working well, and I want to adjust the tapping term as described here: https://github.com/tmk/tmk_keyboard/wiki/FAQ-Keymap#tap-keydual-role-key-doesnt-work-for-me The problem is that I am really out of my depth on most keyboard things (think old man / non-programmer / Win 10 / MS Office user) and I am programming the layout using the TMK Keymap Editor page to create the hex file. I don't see a place to adjust the tapping term there, and I can't imagine figuring out how to compile the hex file from a text file layout. Is it possible to increase the tapping term using the editor web site? Or is it actually easy to create the hex file on my Win 10 machine without installing a Linux VM or doing lots of command line stuff? Or am I just out of luck? Thanks for any help.

I'll look into how to change the setting without recompilation when I have some time, but currently you have to build firmware yourself unfrotunately.

Installling VM looks to me the easisest way but other option for windows is 'Windows Subsystem for Linux'(WSL). But you can't avoid command line interface. I don't know much about and didn't try other options and possibilities myself.

See these for firmware build.
https://github.com/tmk/tmk_keyboard/wiki/Build-on-Ubuntu-On-Windows10
https://github.com/tmk/tmk_keyboard/wiki#build-on-windows

Offline suicidal_orange

  • * Global Moderator
  • Posts: 4737
  • Location: England
Re: Tapping term question
« Reply #848 on: Sat, 03 September 2022, 05:58:37 »
I've just compiled the default usb_usb firmaware with the tapping term change as it seemed like an easy way for Lucky_Marsupial to solve his problem but when I load it on the editor website the keymap is blank.  The keymap loads as expected for the shipped binary version though, so seems I'm doing something wrong?
120/100g linear Zealio R1  
GMK Hyperfuse
'Split everything' perfection  
MX Clear
SA Hack'd by Geeks     
EasyAVR mod

Offline hasu

  • Thread Starter
  • Posts: 3418
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK USB to USB keyboard converter
« Reply #849 on: Sat, 03 September 2022, 10:32:35 »
I've just compiled the default usb_usb firmaware with the tapping term change as it seemed like an easy way for Lucky_Marsupial to solve his problem but when I load it on the editor website the keymap is blank.  The keymap loads as expected for the shipped binary version though, so seems I'm doing something wrong?

You can use make file 'Makefile.unimap' to make firmware compatible to the Keymap Editor.
Code: [Select]
$ make -f Makefile.unimap clean
$ make -f Makefile.unimap