Author Topic: [TMK] USB-USB Converter  (Read 46782 times)

0 Members and 1 Guest are viewing this topic.

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
[TMK] USB-USB Converter
« on: Mon, 09 November 2020, 20:15:35 »
Check this post for detailed information of the converter.
https://geekhack.org/index.php?topic=69169.0



Its dimension is 24mm*58mm*11mm including connectors.



How to order
Please check this notes on shipping under COVID-2019 pandemic before ordering.

Email me with subject including 'USB-USB' to place an order(or ask quesiton about ordering) and let me know your country. My email is: hasu@tmk-kbd.com. You will receive PayPal invoice.

As for technical question posting in the thread would be preferable, you can share information with the community. PM(personal message) in this forum is not suitable for these, anyway.



Price
Converter:  $65UD - Components cost is rising due to its scarcity in the market now.(2021-08-24, 2021-10-05, 2022-03-09)

Shipping: Check this post. This is shipped from Tokyo, Japan.


Lead Time
The converters will be shipped usually in a week and you will receive email with tracking number from Japan Post. Check junk mail folder too.
Let me know if you don't get tracking number within 10 working days after payment.
« Last Edit: Fri, 02 September 2022, 17:33:07 by hasu »

Offline TheNeonKnight

  • Posts: 25
Re: [TMK] USB-USB Converter
« Reply #1 on: Tue, 01 December 2020, 11:00:24 »
Hasu, In the TMK USB to USB converter config if I were to use something like a Unicomp PC122 which comes natively as USB the config is missing the left hand function keys as well as the key that would go below the down arrow. Also, if I wanted to split the numpad 0 into 2 seperate keys how could this be accomplished on the software end?

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #2 on: Tue, 01 December 2020, 18:00:37 »
See this post. Thanks.
https://geekhack.org/index.php?topic=69169.msg2986331#msg2986331

Hasu, In the TMK USB to USB converter config if I were to use something like a Unicomp PC122 which comes natively as USB the config is missing the left hand function keys as well as the key that would go below the down arrow. Also, if I wanted to split the numpad 0 into 2 seperate keys how could this be accomplished on the software end?




Offline TheNeonKnight

  • Posts: 25
Re: [TMK] USB-USB Converter
« Reply #3 on: Thu, 03 December 2020, 13:25:42 »
Ah I see, thank you!

Offline srucontrol

  • Posts: 0
Re: [TMK] USB-USB Converter
« Reply #4 on: Fri, 24 December 2021, 11:45:31 »
Hasu, I just purchased this device and it arrived pretty quickly :) Unfortunately I'm having some issues getting it to work properly.

I open qmk toolbox, plug in the converter, press the button on the converter, then hit open, select the hex file, and then hit flash. I then plug in my keyboard in but it doesn't seem to work.
Am I doing it correctly? I accidentally pressed the button on the converter while my keyboard was plugged in the first time. Would that affect it? I have done the "correct" process since then of course.

I'm following this video from Taran at LTT: https://www.youtube.com/watch?v=GZEoss4XIgc&t=518s
and using this hex file: https://github.com/TaranVH/2nd-keyboard/blob/master/HASU_USB/F24_with_modifiers/F24_with_modifiers.hex

Hopefully I can figure the issue out because it seems like your product is really great!
Thanks,
Srucontrol

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #5 on: Fri, 24 December 2021, 17:27:37 »
Quote
it doesn't seem to work.
Describe more details. Any key doesn't register? What do you expect?

Try this keyboard test program to see what key registers.
https://web.archive.org/web/20190428204254/https://elitekeyboards.com/switchhitter.php


Try official default firmware first to check if your converter itself works. You can download here.
https://github.com/tmk/tmk_keyboard/tree/master/converter/usb_usb/binary

Check the first post also, especially Troubleshoot section.
https://geekhack.org/index.php?topic=69169.0

If you got error in the tool while flashing. Post the error.

Offline srucontrol

  • Posts: 0
Re: [TMK] USB-USB Converter
« Reply #6 on: Sun, 26 December 2021, 23:11:21 »
Hi, thanks for answering!
The issue is that when I type with the external keyboard through the converter, it doesn't type anything in notepad. It should be able to type things normally. The hex code is supposed to make it so that F24 is held down before the regular key is pressed and then lifted once it's done. This is so that the keyboard can be detected as a different keyboard by autohotkey. It should send regular key presses without any script running though. I don't see any errors in qmk but here's a screenshot just in case. I'm using the Keychron K2 and Drevo Excalibur keyboards by the way.
Now I tried using the default hex file you provided and that seemed to flash correctly. It gave me blue text I had not seen with the hex that I was using at first. Using the default hex file you provided, qmk toolbox detected my key presses and displayed numbers each time. The Switch Hitter program only ever detected key presses from my laptop keyboard though. Nothing on the switch hitter changed when I pressed keys on the external keyboard (through hasu) but I did see the numbers in qmk toolbox.
So is it looking like the issue with the hex file I was using?
Sending a screenshot after "flashing" the hex file from the video, and another after flashing the one you provided.
Thanks again for the help!


Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #7 on: Mon, 27 December 2021, 00:08:38 »
Use the default firmware when testing.

It seems to work with the default firmware at least.
If you are using AHK and any other keyboard tools try disabling them or uninstalling.

EDIT: also try other keyboard, this problem may be caused by keyboard compatibility.
EDIT: and trying on other computer may be helpful.
« Last Edit: Mon, 27 December 2021, 00:14:39 by hasu »

Offline srucontrol

  • Posts: 0
Re: [TMK] USB-USB Converter
« Reply #8 on: Mon, 27 December 2021, 01:02:39 »
Is the default firmware supposed to send keystrokes like normally? Because it doesn't send anything to notepad or switch hitter. Only to qmk toolbox. or is that normal? I disabled the other scripts and tried other computers/keyboards. Is the issue looking like it's the hex file not being correct? The way I understand it is that if the hex file were working, it'd say "hid console connected" right?

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #9 on: Mon, 27 December 2021, 02:16:34 »
- Yes, the default firmware sends keystroke basically as you press.
- No, it is not normal. You can type in notepad with default firmware if there is no problem.

The default firmware is working when you see "TMK:ed7dfa/LUFA:d6a7df/UHS2:e37ed6" on hid_listen console. I believe you flashed the default firmware correctly.

QMK toolbox is not reliable completely in terms of debug console, use hid_listen instead to get debug outputs.
https://github.com/tmk/tmk_keyboard/wiki#hid_listen

If you happen to have one of 'Compatible Keyboards' try it. It should work. Check first post for 'Compatible Keyboards'.
https://geekhack.org/index.php?topic=69169.0





Offline srucontrol

  • Posts: 0
Re: [TMK] USB-USB Converter
« Reply #10 on: Mon, 27 December 2021, 09:12:48 »
So I tested with another keyboard, Drevo Excalibur, and the default firmware seems to be working correctly. Pressing the keys on it while plugged into the converter sends keystrokes regularly. So it seems like my keychron k2 is not compatible while my Drevo is compatible but the hex file I was using seems bad. Thanks again for the help! It looks like I've found out the problem.

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #11 on: Mon, 27 December 2021, 19:25:02 »
Can you post debug outputs when plug-in keychron k2?
It would be helpful for me to improve firmware.

1. Program the converter with debug firmware to get more info.
2. Use hid_listen to see debug outputs.

debug firmware: https://raw.githubusercontent.com/tmk/tmk_keyboard/master/converter/usb_usb/binary/usb_usb_debug.hex
hid_listen: https://github.com/tmk/tmk_keyboard/wiki#hid_listen

And it may be useful to update the keyboard with the latest firmware if possible.
https://www.keychron.com/pages/firmware

Offline srucontrol

  • Posts: 0
Re: [TMK] USB-USB Converter
« Reply #12 on: Tue, 28 December 2021, 21:20:46 »
Ok I will but I want to get the compatible keyboard working first. What can I try now? Is the issue the hex file? Any idea why Taran's hex file isn't working correctly? Is it ok that it doesn't show the blue text in qmk toolbox? Or does it need to show that to show that it was flashed correctly and it's working? It's working for Taran and I assume others as well so how can we get it to work?

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #13 on: Wed, 29 December 2021, 21:59:44 »
Ok I will but I want to get the compatible keyboard working first. What can I try now? Is the issue the hex file? Any idea why Taran's hex file isn't working correctly? Is it ok that it doesn't show the blue text in qmk toolbox? Or does it need to show that to show that it was flashed correctly and it's working? It's working for Taran and I assume others as well so how can we get it to work?

I don't know how the "Taran's hex" was built exactly, but I think it doesn't print any debug info(blue text) intentioanally.
If the hex works for you, it won't be a problem.


Offline glennm

  • Posts: 1
Re: [TMK] USB-USB Converter
« Reply #14 on: Thu, 30 December 2021, 16:36:46 »
Howdy, Hasu!

I'm not sure which site you prefer for questions.  The other geekhack page ( https://geekhack.org/index.php?topic=69169.0) was very helpful, and I can use that if you prefer.

I got the (3) HASU USB-USBs from you about a year ago.  Great service, btw.

I was trying to update firmware using the "virtual - box" instructions, but it seems that that image  (2021-12) is no longer available -- It says its in the trash.  I'm guessing it is linked to one that you build and update?

Should I just skip trying to update the firmware?   I can use the firmware on the device and then if it "blows up", I can try updating the firmware.  Your recommendation?  I am pretty good technically, but not very good with Linux.  Your instructions look pretty complete though.

Or should I try again in a few weeks?

Thank you -- and very best wishes for the New Year.   -glenn

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #15 on: Thu, 30 December 2021, 18:11:36 »
Fixed the link of VM image in wiki.
https://github.com/tmk/tmk_keyboard/wiki/Build-on-VirtualBox

thanks


Offline ChewChew

  • Posts: 0
Re: [TMK] USB-USB Converter
« Reply #16 on: Mon, 31 January 2022, 20:53:12 »
Hey Folks!

It's 2022, I just bought one of these excellent devices from hasu (thanks bro!) and it arrived yesterday. I thought I'd write how an outsider can go from 'no idea what I'm doing', to having my own macro keyboard working. (Hope this hasn't been posted elsewhere before).

Step 1: Plug the converter into both your keyboard and the computer, and type something in notepad.
* If it works then your keyboard is compatible. If you get to the end of this process and nothing works, you know you've done something wrong.
* If nothing is typing, your keyboard isn't compatible. Try another keyboard I guess?

Step 2: Go to hasu's 'TMK Keymap Editor' webpage (google it) and reassign whatever keys you want.

Note, I needed a lot of Ctrl+# or Shift+# shortcuts and initially struggled how to make this work. The trick is to assign the key with the letter, then below the keyboard click on the 'Code Edit' tab. Change the dropdown from ACTION_KEY to ACTION_MODS_KEY, and use the next dropdown to select the Shift or Ctrl key etc, then click the Action Apply button.

Step 3: Under the 'Firmware Hex File Download' part of the webpage, click the 'Download' button. This is the file you will need to load onto the USB converter.

Step 4: Find a copy of Flip by Atmel somewhere on the internet! When you google it, it takes you to a Microchip website and says there's two files available; but only the one that requires Java Runtime Environment is listed. Someone else here on this website had uploaded a copy of Flip 3.4.7 for windows that doesn't need JRE, so I just used that (thank you!).

Step 5: Once Flip is installed, you will need to force the Device Manager to use the Flip driver. Press the little button on the USB converter to enter flash mode. You'll hear the USB disconnect sound. Open the device manager and you'll see under 'Other Devices' that there's an issue with the 'ATmega32U4'. If device manager is only showing 'PCI Encryption Controller' it means you aren't in flash mode!

Once in flash mode, do the following:
* Right click the 'ATmega32U4', and select 'Update Driver'.
* Select 'Browse My Computer for Drivers'
* Select 'Let me pick from a list of available drivers etc'
* Select 'Show All Devices' and click 'Next'
* Select 'Have Disk'
* Browse to the 'Atmel' -> 'Flip' -> 'usb' folder, and select the 'atmel_usb_dfu.inf' file then hit 'OK'
* Select the 'ATmega32U4' driver and select 'next'

Step 6: Disconnect and reconnect the USB converter, and re-enter Flash mode by pressing the little button again.

Step 7: Open Flip and click on the icon that looks like a USB with a cable and select 'USB' and click 'Open'.
* If you get an error saying 'AtLibUsbDfu.dll not found' error then you didn't do step 5 properly.
* If you click 'Open' and you get 'Could not open USB device' error, your USB converter isn't in flash mode. Press the little button.

Step 8: Click on the red book with a down arrow icon (Load HEX file). Navigate to the hex file you downloaded in Step 3. On the main page of the Flip program in the bottom middle you should now see the name of the hex file in blue writing.

Step 9: In the bottom left of the Flip program click the 'Run' button and cross your fingers! It will erase the default hex, load your custom one and verify it.

Step 10: unplug and replug the USB converter, and type away. You should now have a working custom keyboard! Good luck!

Disclaimer: I'm a total newcomer at this and I was maxed out figuring out the above process, so I'm very sorry if you run into dramas. I would have little to no idea how to help.

Offline OwariDa

  • Posts: 0
  • Location: Limassol, Cyprus
    • ClevCode
Re: [TMK] USB-USB Converter
« Reply #17 on: Tue, 08 November 2022, 19:50:55 »
Hey!

I am using the converter with a custom 34-key layout I'm developing with QMK for the Kinesis Advantage 2, and it works great! The only issue I'm having is that my firmware is currently just 142 bytes smaller than the maximum for the MCU in question at the moment, and I would like to be able to do a few more customizations. I have already enabled link-time-optimization and disabled everything I can disable in the config, so my question right now is whether it would be possible to buy or possibly build a converter based on an MCU with more flash storage.

I'm sure I'm not the only one with this issue, so maybe it would be a good idea to make an iteration / a version of this awesome converter based on a slightly more powerful (at least a larger flash) MCU?

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #18 on: Tue, 08 November 2022, 20:19:17 »
What version of gcc are you using?  I think optimisation for AVR is not supported/developped actively at recent versions, you may want to stick with older version like 6, 7 or even 5.
In general newer GCC tends to produce bigger binary.

AT90USB1286 would be easy straight upgrade without big change of current firmware if you want to try. I don't know if that hardware upgreade deserves in this case(Just 142 bytes excess).

Offline OwariDa

  • Posts: 0
  • Location: Limassol, Cyprus
    • ClevCode
Re: [TMK] USB-USB Converter
« Reply #19 on: Tue, 08 November 2022, 20:33:43 »
I'm using GCC 5.4.0, so pretty old. It's the version being included in the avr-gcc package on Ubuntu.

Actually I have 142 bytes left, not 142 bytes in excess :) But the only reason I have those 142 bytes free is because I stopped tweaking my keymap.c now when I have so little space left, but would like to continue. 😅

AT90USB1286 would be perfect. Any chance of ordering a pre-built one based on that MCU? I'd be willing to give it a try to build it / modify my existing one myself, if it's something that can be done with (so far) quite minimal hardware hacking experience.

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #20 on: Tue, 08 November 2022, 22:18:46 »
Ah, I read it incorrectly about the memory space.

Version 5.4.0 is a good choice for AVR in general. But you may still want to use newer version. Check this.
https://www.microchip.com/en-us/tools-resources/develop/microchip-studio/gcc-compilers

I use 7.3.0 from the Microchip toolchain build now and it seems to be a bit better than 5.4.0 for me when enabling LTO option.



I thnk you can buy Teensy 2.0++ and Mini USB Host Shield to make a converter with 128KB flash.
https://www.pjrc.com/teensy/td_libs_USBHostShield.html

Offline OwariDa

  • Posts: 0
  • Location: Limassol, Cyprus
    • ClevCode
Re: [TMK] USB-USB Converter
« Reply #21 on: Wed, 09 November 2022, 04:42:55 »
Ok, thank you! I might give that a try! :) And thanks once again for your great work with building this converter!

Offline OwariDa

  • Posts: 0
  • Location: Limassol, Cyprus
    • ClevCode
Re: [TMK] USB-USB Converter
« Reply #22 on: Wed, 09 November 2022, 04:48:48 »
PS. Using GCC 7.3.0 from the Microchip 3.7.0 toolchain saved me about 350 bytes, so that was a great suggestion :)

Offline OwariDa

  • Posts: 0
  • Location: Limassol, Cyprus
    • ClevCode
Re: [TMK] USB-USB Converter
« Reply #23 on: Wed, 09 November 2022, 09:12:35 »
Even better, this time with the Microchip toolchain EXTRAFLAGS += -flto actually had an effect, now I have >900 available bytes! I tried both with and without EXTRAFLAGS += -flto before and it did not have an effect at the time, and I also set LTO_ENABLE = yes, but apparently that did not add the -flto flag by itself. Perfect! :)

Offline Draconian

  • Posts: 18
Re: [TMK] USB-USB Converter
« Reply #24 on: Fri, 17 March 2023, 10:47:57 »
VIA Support?

I've been using Hasu's USB-USB Converter with my HHKB Hybrid and it works perfectly!

I've managed to install QMK on it in order to use Tap Dance and other features.

I've tried to install VIA support, but the firmware always ends up being too large.

I've tried all the flags in order to reduce the size, but it's always too large.

I was wondering - has anyone managed to compile the firmware with VIA support, and if so, could you share any tips for getting the firmware to fit?

Thanks

Nick

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #25 on: Fri, 17 March 2023, 19:50:12 »
I don't know about VIA much and how it works internally.

What if you build from QMK source?
USB-USB firmware requires quite a few flash memory room by default you will have to reduce some of uneeded features to enable one you need. I guess you can do this more on Makefile than VIA?

Disabling features is the first option to reduce firmware size.
But there are some useful compiler options for reducing size and also try GCC 7.3 if possible, the version would support its microcontroller AVR better.

https://p5r.uk/blog/2008/avr-gcc-optimisations.html

These options reduced firmware size more with TMK source code for reference.
Code: [Select]
EXTRALDFLAGS += -Wl,--relax
EXTRALDFLAGS += -Wl,--gc-sections
EXTRALDFLAGS += -flto

EXTRACFLAGS += -flto
EXTRACFLAGS += -ffunction-sections
EXTRACFLAGS += -fdata-sections
EXTRACFLAGS += -fno-move-loop-invariants
EXTRACFLAGS += -fno-tree-scev-cprop
EXTRACFLAGS += -fno-inline-small-functions

EXTRACPPFLAGS += -flto
EXTRACPPFLAGS += -ffunction-sections
EXTRACPPFLAGS += -fdata-sections
EXTRACPPFLAGS += -fno-move-loop-invariants
EXTRACPPFLAGS += -fno-tree-scev-cprop
EXTRACPPFLAGS += -fno-inline-small-functions

Offline Hypersphere

  • Posts: 1886
  • Location: USA
Re: [TMK] USB-USB Converter
« Reply #26 on: Tue, 21 March 2023, 12:57:02 »
@hasu
@Draconian
I have been trying to get my Hasu USB-USB converter working with my HHKB Pro Hybrid Type-S. I have tried flashing the converter with my hex file both with Flip 3.4.7 and with the latest version of QMK Toolbox, but neither method yields the expected results. For example, although I have used the TMK online editor to configure the keyboard layout, and I have set the Backslash (\) key to Backspace, when I flash the converter, the key that is supposed to be Backspace is instead the Backtick (Grave) (`) key.

My main impetus for doing this is to be able to have an embedded numeric keypad in my HHKB Pro Hybrid. In addition to the normal keypad functions, I would like to be able to use Alt Codes; for example, Alt+019 for upper-case A-umlaut.

FYI, I have the DIP switches set to 2 and 3 = ON and all others = OFF (Mac mode with Del = Backspace).

Thank you for any suggestions you might have.

EDIT: I finally figured it out. It is probably not the most elegant solution, but it works. If anyone is interested, here is the short URL:

https://bit.ly/3yWi3xX

Another question: In order to go to Layer 2 for the embedded numeric keypad, I have sacrificed the Right-Alt (Right-Opt) key as the toggle. How could I use this key as the toggle and still have it available for other uses?

Thanks again.


« Last Edit: Tue, 21 March 2023, 18:55:52 by Hypersphere »

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #27 on: Wed, 22 March 2023, 07:30:28 »
https://bit.ly/3yWi3xX

Another question: In order to go to Layer 2 for the embedded numeric keypad, I have sacrificed the Right-Alt (Right-Opt) key as the toggle. How could I use this key as the toggle and still have it available for other uses?

In current implementation you can't assign the two functions(toggling layer for tapping and Alt for holding) to a key using keymap editor. It would be possible if you write your own custom action in your unimap(keymap) file.(I don't explain the detail here. Let me know if you are interested. See code below.)

See and try this kemap trick first, instead.
This is not a straight soltuion but it is a trick that retains Alt function somehow. With this configuration you need to press **both Alt keys** to toggle the Layer 2, but the two keys can be still used as Alt.
On Layer 0 both Alt keys have ACTION_LAYER_MODS() that enables Layer 3 momentarily and registers 'Alt' on computer at same time during holding. See Layer 3, the Alt keys are assigned 'Toggle Layer 2' action there. In the result, when you press one of Alt keys the other can toggle the Layer 2.
https://github.com/tmk/tmk_keyboard/wiki/Keymap#35-momentary-switching-with-modifiers

https://bit.ly/405mouQ



EDIT: This is example code of the custom action(in unimap.c).
Code: [Select]
#include "unimap_trans.h"
#include "action_layer.h"


enum function_id {
    ALT_TOGGLE,
};

#define AC_FN0      ACTION_LAYER_MOMENTARY(1)
#define AC_ATGL     ACTION_FUNCTION_TAP(ALT_TOGGLE)


#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,ATGL,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,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,TRNS,     HOME,PGDN,END,     TRNS,     TRNS,TRNS
    ),
    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,P7,  P8,  P9,  P0,  PMNS,PEQL,TRNS,TRNS,     TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,P4,  P5,  P6,  PENT,TRNS,NLCK,     TRNS,     TRNS,TRNS,TRNS,    TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,P1,  P2,  P3,  PPLS,PAST,     TRNS,PENT,                        TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,P0,  PCMM,PDOT,PSLS,     TRNS,TRNS,          TRNS,         TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,          TRNS,          TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,TRNS,TRNS,    TRNS,     TRNS,TRNS
    ),
};


void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case ALT_TOGGLE:
            if (record->event.pressed) {
                if (record->tap.count > 0 && !record->tap.interrupted) {
                } else {
                    register_mods(MOD_BIT(KC_RALT));
                }
            } else {
                if (record->tap.count > 0 && !(record->tap.interrupted)) {
                    layer_invert(2);
                } else {
                    unregister_mods(MOD_BIT(KC_RALT));
                }
            }
    }
}
« Last Edit: Wed, 22 March 2023, 09:17:48 by hasu »

Offline Hypersphere

  • Posts: 1886
  • Location: USA
Re: [TMK] USB-USB Converter
« Reply #28 on: Wed, 22 March 2023, 07:57:20 »
@hasu
Many thanks for your quick and helpful reply!

Another question: Should the short URL to my tmk editor page be persistent? I noticed when I tried the previous one this morning, I got an error saying that the URL could not be found. Now I have a new one after making some modifications to my keymap:

https://bit.ly/3LLqkfN

For the time being, I think that I will keep my keymap in which I "sacrifice" the Right-Alt as the toggle for Layer2. I have also sacrificed the Right-Gui as the Numlock (but perhaps a Numlock key is not necessary). If I later find that I need to preserve the Right-Alt key, I will try your kind suggestion.

Thank you again for creating the Hasu USB-USB converter and for your incredible willingness to help others to use it.

Offline hasu

  •  Moderator
  • Thread Starter
  • Posts: 3430
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] USB-USB Converter
« Reply #29 on: Wed, 22 March 2023, 08:49:02 »
I believe that bit.ly link is persistent once it is created successfully. Though, I've used bit.ly free plan(since google stopped their goo.gl serivce).  It is very limited, we can create only 10 links per month according to this page :-X https://bitly.com/pages/pricing

If 'URL Shortner' button fails due to the limit you have to use the very long 'Raw URL' instead.

Offline Hypersphere

  • Posts: 1886
  • Location: USA
Re: [TMK] USB-USB Converter
« Reply #30 on: Wed, 22 March 2023, 09:43:27 »
Thanks, Hasu!

Now another problem has arisen. Previously, I had done the configuring of my keymap on a Windows machine, but this morning, I tested the USB-USB converter on a Linux Machine (Linux Mint 21.1 Xfce, based on Ubuntu 22.04 LTS). I found that when I try the embedded keypad on the Linux machine, it works only if I also use the Numlock key. However, it does not work completely. When I try to do Alt Codes, I get no output in a text editor (Xed, or Notepad++ using Wine). Do you have an idea of why the Alt codes are not working and how I might be able to fix this? Thank you.

EDIT1: After Googling this issue, I discovered to my great disappointment that "Alt Codes" do not work in Linux! Do you happen to be aware of a Linux version of Alt Codes? Thanks again!

EDIT2: Well, I have a Windows VM on my Linux machine, and I found that the Alt Codes work in the VM. So, this would provide a workaround when I am using the Linux machine and wish to output Alt Codes. It would, however, be nice to be able to generate Alt Codes (or something similar) directly in Linux. Ideas welcome! Thanks.

EDIT3: After some additional Googling, I ran across various Linux alternatives to Alt Codes. These include Unicode numbers, Unicode hex codes (accessed via Shift+Ctrl+U), and keyboard shortcuts. With these discoveries, I think that I have answered my own question.

« Last Edit: Wed, 22 March 2023, 10:24:47 by Hypersphere »