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

0 Members and 1 Guest are viewing this topic.

Offline bibobim

  • Posts: 22
Re: ADB to USB keyboard converter
« Reply #950 on: Fri, 17 April 2020, 16:17:27 »
From the error messages compiler doesn't seem to find declaration of 'clock_prescale_set' and 'clock_div_1' for some reason.

Frist, you can use github.com search feature to check if those words are defined somewhere in tmk_firmware repository. Enter the word in text box at top of this page and then click 'in this repository' button.
https://github.com/tmk/tmk_keyboard

Hmm, they are used in tmk_firmware but not defined there. There is no useful info in this case.

I use google when I don't have clear idea. Google is your friend and extremely useful in particular when in trouble.
Google with 'clock_prescale_set' or 'clock_div_1', it will lead you to avr-libc pages.

https://www.nongnu.org/avr-libc/user-manual/group__avr__power.html

Now we get to know that those words are defined in avr-libc.

Did you install avr-libc? If so what is its version?
Hi Hasu, I am able to create a hex file but I have no idea where it was lol.  I use git command to clone the folder so I don't know where the directory that locates adb_usb.hex goes.
EDIT: Nevermind I got the file but it does nothing. When I try hid_listen, the only thing I got is RRRRRRRR

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #951 on: Fri, 17 April 2020, 20:25:58 »
Great, you can build firmware?
You can post how to solve your problem related to compile firmware. What step was needed for your setup?
It would be useful for future reference.

As for the 'RRRR' it is typical error for wrong wirings, check the first post.


Offline bibobim

  • Posts: 22
Re: ADB to USB keyboard converter
« Reply #952 on: Fri, 17 April 2020, 20:57:13 »
Great, you can build firmware?
You can post how to solve your problem related to compile firmware. What step was needed for your setup?
It would be useful for future reference.

As for the 'RRRR' it is typical error for wrong wirings, check the first post.
I have to delete the WinAVR in order to use the newest avr-libc which I've already installed. After that everything runs smoothly.
As you said, it's the wiring issue and I am able to fix it as well as changing the resistor to 1k Ohm.
But now when I plug the keyboard in and try hid_listen, all I have is
Listening:

Attached are my Makefile (I only change the model and bootsize) and a screenshot of hid_listen:(
« Last Edit: Fri, 17 April 2020, 20:59:37 by bibobim »

Offline shacintom

  • Posts: 1
Re: ADB to USB keyboard converter
« Reply #953 on: Sat, 02 May 2020, 12:20:40 »
Hello Everyone,

since a while i have a cheap digispark Attiny85 laying around.
I was wondering if it's possible to build an ADB converter out of it.
Found this project on Github: https://github.com/jammi/digidb
But when i try to compile it in ArduinoIDE, it gives me a bunch of errors  :-\
Does someone have already a solution or know how to make it work?

Best Regards

----------

EDIT: Found it out! Had to install the Old Arduino IDE :-)
« Last Edit: Sat, 02 May 2020, 15:28:14 by shacintom »

Offline notyou

  • Posts: 6
Re: ADB to USB keyboard converter for Teensy
« Reply #954 on: Tue, 12 May 2020, 22:51:58 »
Hi all - it doesn't look like nodnerb is active anymore, but I have a Datadesk Switchboard, and I'm wondering if I'm running into the same problem that he had.

I believe my wiring is correct (power and caps lock are on), and when I look at the System Report on my MacBook Air, it shows "ADB keyboard converter", so I think I flashed it correctly.

But when I run hid_listen.mac, I get nothing, just
Waiting for device:
Listening:


I *don't* have an oscilloscope, nor do I have another ADB keyboard around to test. But worse still, I can't quite understand what changes I could make to the code address what nodnerb discovered. Could you possibly provide a diff/patch or a branch that implements a fix for what he found?

Thank you so much! And just in case I did screw up the wiring, here's some photos.



nodnerb,
Thank you for your feedback! This is good to know.

Quote from: nodnerb;441636
I had some problems with a Datadesk Smartboard, and it wasn't until I got it on an oscilloscope that I found out why...
For some reason, this keyboard sends a '1' as a stop bit (which is against the ADB standard... how did this keyboard ever work on a Mac?).
Also, the timing of the signals is a bit screwy,
__~~~ after 35 us for '1'
___~~ after 56 us for a '0' (This should be 65 us!) - this one is causing random bit-swapping with the default 55 us delay before reading the bit value.
So, for this board, I've changed the read delay to 45 us and disregard the value of the stop bit.
Your keyboard might be compliant for ADB spec though it is not good implementation without enough margin.
If my code could read a bit exactly after 55us it seems to has no problem.  My code intends to read a bit after 55us delay,
but delay time is not so accurate because the code is written in C as you know. It may be imposed a few excess micro seconds in addition to the 55us.

Quote from: nodnerb;441636
I'm going to look into your source code to see how the layer switching works.
Ah, it is a very confusing and chaotic part of my firmware :(
and its broken English comment doesn't work even for me :)

Offline notyou

  • Posts: 6
Re: ADB to USB keyboard converter for Teensy
« Reply #955 on: Tue, 12 May 2020, 23:19:38 »
Welp, I'm a dummy. Wrong resistor!

However, there's still some issues - seems like Caps Lock is stuck. But woo, progress!

Offline notyou

  • Posts: 6
Re: ADB to USB keyboard converter for Teensy
« Reply #956 on: Tue, 12 May 2020, 23:49:53 »
Welp, I'm a dummy. Wrong resistor!

However, there's still some issues - seems like Caps Lock is stuck. But woo, progress!

Well, here's the output from hid_listen.mac:


$ ./hid_listen.mac
Waiting for device:
Listening:


RRRRRRRRRRRRRRRRRRRM:addr3 reg3: 6301
M:addr15 reg3: 6F04
Ext: [00 00 ] cpi=100
Unknown


Not sure what that means.

And prior to plugging in USB, then ADB, then running hid_listen sometimes the Command-key gets stuck, or the Shift-key. Or now it's the Ctrl-key.

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #957 on: Tue, 12 May 2020, 23:52:20 »
notyou,
As for capslock, it is probably keymapping.
Default firmware has 'Locking Caps Lock' mapping for Caps Lock key, most of ADB keyboard has mechanical locking switch on the key.
I guess Datadesk Switchboard use normal switch for the key.


According to Deskthority wiki Datadesk Switchboard seems to support PC/XT and PS/2 protocol too.
The keyboard came with other cables for XT or PS/2?

https://deskthority.net/wiki/Datadesk_Switchboard
https://deskthority.net/wiki/File:DSI_Modular_Pro_--_DIP_switch_legend.jpg


It would be helpful if you can try my IBMPC converter with the keyboard on XT and PS/2 protocol.
https://geekhack.org/index.php?topic=103648.0

Offline notyou

  • Posts: 6
Re: ADB to USB keyboard converter
« Reply #958 on: Wed, 13 May 2020, 12:26:58 »
Yes, the Switchboard uses a normal switch for Caps Lock (there is a DIP switch to have it be used as Ctrl).

I see this in config.h:

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */


But the plain keymap uses LCAP, not KC_LCAP.

I will try commenting out Mechanical Locking support to see if that makes a difference.

Yes, the Switchboard is also PS/2 compatible, but unfortunately it uses a proprietary plug. Or the XT/PS2 interface is broken on my keyboard. I already have a Monoprice PS/2->USB converter, but need to get the right pinouts on the cable.

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #959 on: Wed, 13 May 2020, 20:19:54 »
Yes, the Switchboard uses a normal switch for Caps Lock (there is a DIP switch to have it be used as Ctrl).

I see this in config.h:

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */


But the plain keymap uses LCAP, not KC_LCAP.

I will try commenting out Mechanical Locking support to see if that makes a difference.

LCAP and KC_LCAP are identical, you can omit 'KC_' in keymap file.
Just use CAPS instead of LCAP in you keymap file, or use normal 'Caps Lock' in Keymap Editor.


Quote
Yes, the Switchboard is also PS/2 compatible, but unfortunately it uses a proprietary plug. Or the XT/PS2 interface is broken on my keyboard. I already have a Monoprice PS/2->USB converter, but need to get the right pinouts on the cable.

OK. No problem. Thanks for the explanation.

Offline notyou

  • Posts: 6
Re: ADB to USB keyboard converter
« Reply #960 on: Thu, 14 May 2020, 17:25:24 »
More on the Switchboard:

So the left and right Shift Keys seem to work fine. I believe the Left and Right Command Keys work ok.

Where things get wonky is with the Caps Lock and Left Control key.

I think part of the issue is that the Switchboard has a weird DIP switch setting to let you make Caps Lock into a Control key.

The Caps Lock does *not* mechanically lock, but sometimes it seems to trigger a Shift Lock.

The Left Control key doesn't seem to do anything, but when I use the Right Control key, it seems to get locked.

I've tried running hid_listen to get some diagnostics out of the keyboard, but I'm not seeing anything for the Caps Lock/Control keys. Is there a way to view what's actually getting sent by the keyboard?

Thank you!

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #961 on: Thu, 14 May 2020, 18:36:13 »
Some ADB keyboards emulate locking CapsLock by firmware, so you can't remap Caps Lock key to Control and have to use 'LCAP' on the key in the case.

How do you configure the DIP switches?  'SHIFTED PERIOD' affects something on the key?
Didn't  you get manual or something with the keyboard?

Press Power and x to see keyboard matrix state and scancodes on hid_listen.

Offline kelvinhall05

  • Posts: 69
  • Location: London, Ontario
    • LinusTechTips
Re: ADB to USB keyboard converter
« Reply #962 on: Mon, 18 May 2020, 09:15:29 »
Can I use a 180ohm resistor as my pull-up resistor? Literally the only thing I have around...

Offline notyou

  • Posts: 6
Re: ADB to USB keyboard converter
« Reply #963 on: Mon, 18 May 2020, 14:44:16 »
Some ADB keyboards emulate locking CapsLock by firmware, so you can't remap Caps Lock key to Control and have to use 'LCAP' on the key in the case.

How do you configure the DIP switches?  'SHIFTED PERIOD' affects something on the key?
Didn't  you get manual or something with the keyboard?

Press Power and x to see keyboard matrix state and scancodes on hid_listen.

Hi, I have not enabled SHIFTED PERIOD. I believe it would basically disable the > character on this keyboard (which is weird.) The manual is long gone (although I'm sure somebody has posted a scan of it), but the DIP switch settings are printed on the lid.

Anyways, thank you for the key combo to get scancodes. Here's what I saw. I appreciate any help!

Left Control:
Code: [Select]
(Nothing)

Left Option:
Code: [Select]
adb_host_kbd_recv: FF3A
r/c 01234567
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000000
05: 00000000
06: 00000000
07: 00100000
08: 00000000
09: 00000000
0A: 00000000
0B: 00000000
0C: 00000000
0D: 00000000
0E: 00000000
0F: 00000000
adb_host_kbd_recv: FF3A

Left Alt:
Code: [Select]
adb_host_kbd_recv: FF37
r/c 01234567
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000000
05: 00000000
06: 00000001
07: 00100000
08: 00000000
09: 00000000
0A: 00000000
0B: 00000000
0C: 00000000
0D: 00000000
0E: 00000000
0F: 00000000
adb_host_kbd_recv: FF37

Left Shift:
Code: [Select]
adb_host_kbd_recv: FF38
r/c 01234567
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000000
05: 00000000
06: 00000001
07: 10100000
08: 00000000
09: 00000000
0A: 00000000
0B: 00000000
0C: 00000000
0D: 00000000
0E: 00000000
0F: 00000000
adb_host_kbd_recv: FF38

Caps Lock (with DIP switch set to normal):
Code: [Select]
adb_hos5: 00000000
06: 00000001
07: 11100000
08: 00000000
09: 00000000
0A: 00000000
0B: 00000000
0C: 00
0F: 00000000

Right Alt:
Code: [Select]
adb_host_kbd_recv: FF37
adb_host_kbd_recv: FF37

Right Option:
Code: [Select]
adb_host_kbd_recv: FF7C
r/c 01234567
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000000
05: 00000000
06: 00000001
07: 11100000
08: 00000000
09: 00000000
0A: 00000000
0B: 00000000
0C: 00000000
0D: 00000000
0E: 00000000
0F: 00001000
adb_host_kbd_recv: FF7C

Right Control:
Code: [Select]
adb_host_kbd_recv: FF7D
r/c 01234567
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000000
05: 00000000
06: 00000001
07: 11100000
08: 00000000
09: 00000000
0A: 00000000
0B: 00000000
0C: 00000000
0D: 00000000
0E: 00000000
0F: 00001100
adb_host_kbd_recv: FF7D

Right Shift:
Code: [Select]
F7B
r/c 01234567
00: 00000000
0100000
09: 00000000
0A: 00000000
000000
0E: 00000000
0F: 00011100
db_host_kbd_recv: FF7B

Offline macDaf

  • Posts: 1
  • Location: Russia
open
« Reply #964 on: Sat, 30 May 2020, 21:19:31 »
Hello, where server will reopen?

Offline zammykoo

  • Posts: 10
Re: ADB to USB keyboard converter
« Reply #965 on: Sun, 12 July 2020, 00:20:40 »
My first mechanical keyboard came in the mail today and I got my converter protoype working fairly quickly. Thank you Hasu!



Offline envyy24

  • Posts: 156
  • Location: UK
Re: ADB to USB keyboard converter
« Reply #966 on: Wed, 22 July 2020, 15:10:01 »
Hi Hasu any everyone,

First off thanks for sharing this great knowledge. I have managed to make on converter myself for my m0116. However it works only once, as when I unplugged it to fix one of the switch (it is broken) and plugged it back in, it now does not work. Any suggestions on how to troubleshoot this?

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #967 on: Wed, 22 July 2020, 15:25:01 »
Hi Hasu any everyone,

First off thanks for sharing this great knowledge. I have managed to make on converter myself for my m0116. However it works only once, as when I unplugged it to fix one of the switch (it is broken) and plugged it back in, it now does not work. Any suggestions on how to troubleshoot this?
- Double check all your connections make sure nothing came loose.
- unplug everything & plug it all back in
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 envyy24

  • Posts: 156
  • Location: UK
Re: ADB to USB keyboard converter
« Reply #968 on: Wed, 22 July 2020, 15:32:28 »
Hi Hasu any everyone,

First off thanks for sharing this great knowledge. I have managed to make on converter myself for my m0116. However it works only once, as when I unplugged it to fix one of the switch (it is broken) and plugged it back in, it now does not work. Any suggestions on how to troubleshoot this?
- Double check all your connections make sure nothing came loose.
- unplug everything & plug it all back in

Thanks man check and plug everything in still does not work. It is not the prettiest but i think i soldered the pins in pretty good
https://i.imgur.com/uvVJnpn.jpg
https://i.imgur.com/Soj3TxS.jpg

Could it be something wrong with the pro micro? As my oc once recognize it as a keyboard and now it does not?

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #969 on: Wed, 22 July 2020, 15:37:34 »
Make sure nothing is shorting on those legs of the resistor
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 envyy24

  • Posts: 156
  • Location: UK
Re: ADB to USB keyboard converter
« Reply #970 on: Thu, 23 July 2020, 02:35:37 »
Make sure nothing is shorting on those legs of the resistor

Can you specify more what should I look for? Thanks man

Offline envyy24

  • Posts: 156
  • Location: UK
Re: ADB to USB keyboard converter
« Reply #971 on: Thu, 23 July 2020, 09:50:18 »
@Nevin: it is working now. I did two things differently, they may contribute to it or not IDK. One is that i start to plug things in in order of keyboard -> adapter -> to pc. The other thing i did is changing to the other port of the keyboard.

So it works now. it could be that one of my port is broken. Cheers for all your help mate.

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #972 on: Thu, 23 July 2020, 09:57:47 »
yes, that's the order you should do it. that way there is a keyboard connected to the converter when you plug it into the computer

glad you got it working.

....when you get a chance, tidy up the converter. there should not be that much wire/resistor legs exposed (you're just asking for trouble).
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 envyy24

  • Posts: 156
  • Location: UK
Re: ADB to USB keyboard converter
« Reply #973 on: Thu, 23 July 2020, 10:15:14 »
yes, that's the order you should do it. that way there is a keyboard connected to the converter when you plug it into the computer

glad you got it working.

....when you get a chance, tidy up the converter. there should not be that much wire/resistor legs exposed (you're just asking for trouble).

definitely, first time doing this sort of thing. I will get on it right tonight i think, now im pretty confident of how to get this working woohoo.

Offline Verseus Tahl

  • Posts: 3
Re: ADB to USB keyboard converter
« Reply #974 on: Thu, 01 October 2020, 16:29:24 »
Hello, I am attempting to make my own ADB to USB converter, and I am attempting to make the hex file, but I am getting an error.

I am using OS X, and after I navigate the the correct project folder, I run the command "make -f Makefile.rev1 clean" followed by "make -f Makefile.rev1." Both commands result in this error message:
'''
../../tmk_core/protocol/lufa.mk:12: *** LUFA may be too old or not found: try 'git submodule update --init'.  Stop.
'''

I've tried searching for additional info, but I haven't had any luck thus far.

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #975 on: Thu, 01 October 2020, 18:31:27 »
The error message was not helpful enough?

Offline Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #976 on: Mon, 30 November 2020, 19:28:50 »
I'm awaiting a NeXT ADB keyboard (QWERTZ). As I understand, there isn't a mapping for it - yet.
To be prepared for this, I've decided to test the HID Listen program with my Teensy and my AEK II. And e.g. later find out which handler id the NeXT keyboard has got, etc.
But, alas! on my Mac with OSX 11 (Big Sur), I've get the message "Bad CPU type in executable".
Any hints on how to build HID Listen for OSX 11?
Or has even anyone experimented with such a keyboard?

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #977 on: Tue, 01 December 2020, 02:00:43 »
I'm awaiting a NeXT ADB keyboard (QWERTZ). As I understand, there isn't a mapping for it - yet.
To be prepared for this, I've decided to test the HID Listen program with my Teensy and my AEK II. And e.g. later find out which handler id the NeXT keyboard has got, etc.
But, alas! on my Mac with OSX 11 (Big Sur), I've get the message "Bad CPU type in executable".
Any hints on how to build HID Listen for OSX 11?
Or has even anyone experimented with such a keyboard?

Try this 64-bit binary. From Catarina 10.15 Mac OS doesn't support 32-bit binary anymore.
https://github.com/tmk/hid_listen/raw/master/binaries/hid_listen.mac64


Offline Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #978 on: Tue, 01 December 2020, 06:36:37 »
@hasu
Thanks - the 64bit binary works great!

Offline Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #979 on: Fri, 25 December 2020, 15:59:06 »
Hello,
I need help to modify the source code for my QWERTZ NeXT keyboard (ADB).
Problem: How can I remap e.g. <ALT>-8, which gives { to send [ to the computer? Of course I could re-map it in the OSX settings, but it would be much more elegant to solve it in tmk_keyboard.
I've looked into the source code, e.g. action map.h etc., but I couldn't identify the right spot. And I couldn't find the right type of macro. I've also liked into ACTION_MODS_KEY, but this is also not the right way.

Thanks in advance!

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #980 on: Fri, 25 December 2020, 18:40:03 »
What is your layout on the OS and how can you get [ with normal USB keyboard there?
« Last Edit: Fri, 25 December 2020, 18:42:32 by hasu »

Offline Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #981 on: Sat, 26 December 2020, 09:31:04 »
Hello,

this is the normal layout of a QWERTZ keyboard on OSX.

<ALT-5> maps to "[", <ALT-6> to "]", <ALT-7> to "|", etc.
The standard adb-usb mapping works this way. And normally you want exactly this behaviour, e.g. with an QWERTZ AEK II keyboard.
So, to get "[" either on an AEK II (QWERTZ) with ADB-USB converter or on an QWERTZ USB keyboard, you press <ALT-5>.

But unfortunately, on the QWERTZ ADB NeXT keyboard, the printing on the keys mirrors in this area a PC keyboard:

Here <ALT-7> should map to "{" instead of "|", etc.

In OSX I've got the standard keyboard settings and behaviour.

Perhaps helpful: The key "7" gives in the matrix-scan function of matrix.c the value 0x1A when pressed, and 0x9A when released, "8" 0x1C and 0x9C, "9" 0x19 and 0x99. So the scan codes(?) on the NeXT ADB keyboard are basically sound.

« Last Edit: Sat, 26 December 2020, 09:34:18 by Fritz the German »

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #982 on: Sat, 26 December 2020, 10:35:06 »
The converter works as expected and this is not a bug. The scan codes are identilcal to Apple ADB keyboard, NeXT supplied that layout on computer(not keyobard).

Are you just curious or really eager to use the NeXT layout? You don't care legends on key when you can touch type :D

You will have to send 'Alt + 5' to get '[' on MacOS when depressing Alt and 8 key probably, for example.
(Alt should be AltGr(Right Alt) here, right? I don't know how QWERTZ keyboard actually works.)

First, you should set ACTION_LAYER_MODS(layer-3, KC_RALT) on the Alt key and map 8 key to 5 on layer-2.

I think you get '[' with AltGr + 8 key using this mapping. Check Right Alt on layer0 and 8 on layer3.
Use 'Code Edit' tab to see/edit 'ACTION_LAYER_MODS()'.
https://bit.ly/2WIVB8q




Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #983 on: Sat, 26 December 2020, 11:05:41 »
Can you share hid_listen log at startup?
https://github.com/tmk/tmk_keyboard/wiki#hid_listen

I like to know halder_id of the NeXT QWERTZ keyboard and how the converter recognize it.

Offline Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #984 on: Sat, 26 December 2020, 13:15:28 »
Can you share hid_listen log at startup?
https://github.com/tmk/tmk_keyboard/wiki#hid_listen

I like to know halder_id of the NeXT QWERTZ keyboard and how the converter recognize it.

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


TMK:93e9ee22+/LUFA


Scan:
 addr:2, reg3:6103

Keyboard:
handler: 03, ISO: no

Scan:
 addr:2, reg3:6603

USB configured.

Keyboard start.


Offline Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #985 on: Sat, 26 December 2020, 13:56:21 »
The converter works as expected and this is not a bug.
ACK. I don't count this as bug - the NeXT QWERTZ ADB keyboard simply differs much from other keyboards, as we can see.

Quote
Are you just curious or really eager to use the NeXT layout? You don't care legends on key when you can touch type :D
I'm no touch typist, so I'm eager to use the NeXT layout.  :)

Quote
You will have to send 'Alt + 5' to get '[' on MacOS when depressing Alt and 8 key probably, for example.
Works with your hints (lay 3 etc., but... the Mac interprets it as "ü".  :rolleyes: As intended by the software, no bug, either.

But now I have to work out how to use a macro to get "[" etc.

« Last Edit: Sat, 26 December 2020, 20:49:09 by Fritz the German »

Offline Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #986 on: Sat, 26 December 2020, 14:04:57 »
The layout of the QWERTZ ADB NeXT keyboard is really unique, is it?
258639-0

<CRTL> and <CAPSLOCK> (the locking type, but without indicator LED) are reversed.
Notice the two [ i ]-keys right and left from the spacebar, and the command key right under the spacebar. And the position of the "|,\,˜" on the right of the bottom row - interesting.

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #987 on: Sun, 27 December 2020, 00:31:28 »
The converter recognzies it as non-ISO keyboard according to that debug output. NeXT german keyboard should be handled in different way from Apple ISO keyboard probably.

Esc, '<'(between left shift and Y) and #(next to return) key work as expected?

Offline Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #988 on: Sun, 27 December 2020, 05:18:48 »
The converter recognzies it as non-ISO keyboard according to that debug output. NeXT german keyboard should be handled in different way from Apple ISO keyboard probably.
Yes, I think so, too.

Quote
Esc, '<'(between left shift and Y) and #(next to return) key work as expected?
Yes, without a flaw.

So far, I've managed to modify * matrix.c so that nearly everything works fine. I believe the way I've achieved this was a little bit crude, but it works. This is still work in progress! E.g. I need to translate some comments to english, insert more comments, etc., etc.

What remains is the "|\˜"-key (code 0x32 / 0xB2) on the bottom row to work as intended. For this, I need to use macros. Problem here: I've found fine examples how to implement action_get_macro, but as far as I can see, they can only be used in keycap.c, which isn't part of adb_usb, or in some xxx_hasu files. I'm a little bit stuck here. :-(
EDIT: I've managed macros! So I will hopefully soon be able to post my solution here.
« Last Edit: Mon, 28 December 2020, 17:43:47 by Fritz the German »

Offline Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #989 on: Sat, 02 January 2021, 12:16:01 »
NeXT QWERTZ ADB keyboard on a Mac
Hello,
first, I like to thank hasu for his valuable advice. It has been of great help for me!

Now the good news: I was able create a modified version of the firmware - see below * matrix NeXT.c and * unimap_plain NeXT.c - that maps the NeXT ADB QWERTZ keyboard according to its layout and the imprints on the keys.
The bad news: This modified version is suitable only for OSX (german keyboard setting), not for Windows or Linux. The macros e.g. to get "[" are OSX specific. Some experiments with a windows PC have shown that most keys are mapped correctly with the standard firmware. But not all. So in my opinion, to use this NeXT keyboard with a Windows or Linux PC another version of the firmware tailored for this is needed.

Here the layout of the keyboard:
258926-2

Some remarks about my modifications:
  • I was in need of a firmware that maps the keys according to their imprints and works with my Mac and OSX, since I'm no touch typist.
  • Since I'm using also an AEK II on my Mac, I've mapped some of the function keys (which aren't present on the NeXT keyboard) to brightness and media. So the function keys of the AEK II act more like the ones on a modern Apple keyboard.
  • For the same reason, the firmware distinguishes between ISO, NeXT QWERTZ and normal keyboards.
  • Although I'm no touch typist, my hands have some muscle memory. So I didn't corrected the behaviour of <Shift>-<#>. It still gives "'" (apostrophe) as on Apple and PC QWERTZ keyboards. Since I'm writing in german and in english (QED), this suits me better. If someone else wants the "correct" result for <Shift>-<#> -"^" (grave) -, it's easy to create a macro for that. For now, <R-Alt>-<Shift>-<\> creates "^" (grave).
  • Since the NeXT keyboard distinguishes between <Right-Alt> and <Left-Alt>, I've decided to use <R-Alt> in the manner of an <Alt Gr>-key.
  • Although you can get used suprisingly fast to the big <Command> key located under the spacebar, I've decided to map both <[ i ]> keys right and left from the spacebar also as <Cmd>.


EDIT: For an unknown reason, the original file attachments have been empty. Second try.
« Last Edit: Sun, 03 January 2021, 13:21:00 by Fritz the German »

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #990 on: Sat, 02 January 2021, 21:10:45 »
Fritz the German,
Attached files is downloaded as empty file, can you check them again?
Thanks to share your work.

Offline Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #991 on: Sun, 03 January 2021, 06:42:06 »
Fritz the German,
Attached files is downloaded as empty file, can you check them again?
Thanks to share your work.
Here they are.
* matrix_NeXT.c (19.98 kB - downloaded 101 times.)
* unimap_plain_NeXT.c (10.48 kB - downloaded 97 times.)

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #992 on: Sun, 03 January 2021, 10:10:36 »
Interesting. NeXT seems to use ADB scan codes in a bit different way.
I'm curious about its scan code of keys below especially.

1. <>(between Left Shift and Y)
2.  #^(next to Return),
3.  '`@(next to Backspace)
4. \|~(at right bottom) [0x32 you refered this before]
5. ESC
6. 'Command' bar
7. [ i ] keys

Can you check scan code of the keys with applying this patch?

Thanks


Code: [Select]
diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c
index f4bf50c1..ac88cab5 100644
--- a/converter/adb_usb/matrix.c
+++ b/converter/adb_usb/matrix.c
@@ -387,10 +387,12 @@ uint8_t matrix_scan(void)
         tick_ms = timer_read();
 
         codes = adb_host_kbd_recv(ADB_ADDR_KEYBOARD);
+        if (codes) xprintf("%04X ", codes);
 
         // Adjustable keybaord media keys
         if (codes == 0 && has_media_keys &&
                 (codes = adb_host_kbd_recv(ADB_ADDR_APPLIANCE))) {
+            xprintf("m:%04X ", codes);
             // key1
             switch (codes & 0x7f ) {
             case 0x00:  // Mic

You will see raw scan codes like below on 'hid_listen' tool with this patch. 'FF' should be ignored here.
Code: [Select]
TMK:e7aa9e5c+/LUFA


Scan:
 addr:2, reg3:6C01

Keyboard:
handler: 01, ISO: no

Scan:
 addr:2, reg3:6701

USB configured.

Keyboard start.
32FF B2FF 2AFF AAFF 00FF 80FF 01FF 81FF
« Last Edit: Sun, 03 January 2021, 10:13:52 by hasu »

Offline Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #993 on: Sun, 03 January 2021, 11:55:22 »
Hello,
here are the scan codes of the NeXT QWERTZ keyboard. To complete the picture, I've included some other scan codes of it as well. The green power button doesn't show up, in contrast to the power button on my AEK II, which gives 7F7F FFFF.
  • <>: 0AFF 8AFF
  • #^: 2AFF AAFF
  • ´`: 18FF 98FF
  • \|˜: 32FF B2FF
  • ESC: 35FF B5FF
  • <Command bar>: 37FF B7FF
  • <Left-[ i ]>: 72FF F2FF
  • <Right-[ i ]>: 72FF F2FF
Additional scan codes.
  • <Left-alt>: 3AFF BAFF
  • <Right-alt>: 7CFF FCFF
  • <Vol-up>: 73FF F3FF
  • <Vol-down>: 77FF F7FF
  • <Brght-up>: 74FF F4FF
  • <Brght-down>: 79FF F9FF
  • <Left-shift>: 38FF B8FF
  • <Right-shift>: 7BFF FBFF



« Last Edit: Sun, 03 January 2021, 12:01:36 by Fritz the German »

Offline hasu

  • Thread Starter
  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #994 on: Mon, 04 January 2021, 00:32:25 »
Thanks for the your work.
NeXT German keyboard works deferently from Apple ISO keyobard, but I think current firmware can recognize the keys as expected. Good to know.

As for Power key of the NeXT keyboard you can read PSW pin for the key. PSW pin support is disabled on default firmware but you can eanable it.


You can check PSW line state with this patch, for example.

Code: [Select]
diff --git a/converter/adb_usb/config.h b/converter/adb_usb/config.h
index 3500188d..fb7777c0 100644
--- a/converter/adb_usb/config.h
+++ b/converter/adb_usb/config.h
@@ -45,7 +45,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define ADB_PIN         PIND
 #define ADB_DDR         DDRD
 #define ADB_DATA_BIT    0
-//#define ADB_PSW_BIT     1       // optional
+#define ADB_PSW_BIT     1
 
 /* key combination for command */
 #ifndef __ASSEMBLER__
diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c
index f4bf50c1..89ba3adc 100644
--- a/converter/adb_usb/matrix.c
+++ b/converter/adb_usb/matrix.c
@@ -380,6 +380,12 @@ uint8_t matrix_scan(void)
     codes = extra_key;
     extra_key = 0xFFFF;
 
+#ifdef ADB_PSW_BIT
+    if (!adb_host_psw()) {
+        xprintf("psw ");
+    }
+#endif
+
     if ( codes == 0xFFFF )
     {
         // polling with 12ms interval

Offline casualdehid

  • Posts: 32
  • Location: Hungary
Re: ADB to USB keyboard converter
« Reply #995 on: Thu, 21 January 2021, 07:42:23 »
Hi there.
I have an AEKII, and I set up the keys. I attached it down bellow.
It works fine, except the Alt Gr key. It's set as an RAlt, but it doesn't quite work that way seemingly. Since I'm using a hungarian layout, this is a problem for me. Literally everything is hidden under the Alt Gr key, incl. the @, #, [, ], { ,} keys. Using the simple Ralt, Sharpkeys doesn't even know what it is really. Control Alt Delete works. So it knows it is an alt. But a wrong kind of alt.
However, it works an an AltGR if I map it to the REAL altGR of the AEKII. And the windwos key does not work now. I'm confused af.

Can someone help me set it up correctly please? Thanks a lot. I want to make this, and an M0118 as my primary.

EDIT: It is only willing to send the Alt Gr scancode (checked with sharpkeys) when it's set to the Real alt gr. Any other combinations, and it will not work as an alt gr. This is annoying on windows especially.
EDIT 2: I've used this: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1
on my Teensy 2.0. Seems like my only way to do this is to rewire the keys... Which, I REALLY don't want to do.
« Last Edit: Thu, 21 January 2021, 07:58:49 by casualdehid »
M0116, Model M, AEK II

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #996 on: Thu, 21 January 2021, 10:50:50 »
this is a known limitation on some of the apple boards. whether it be how they are wired electrically or how they are implemented in the adb protocol.

was mentioned here as well
https://geekhack.org/index.php?topic=14290.msg1495044#msg1495044
but it says
Quote
While Extended keyboard(AEK and AEKII) has discriminate between left and right modifier keys except Command keys.
so you might be in luck, just have the wrong keycode in the keymap or something.

there has also been a replacement pcb that was started for the AEK/AEKII. (not sure how far along it is)
https://geekhack.org/index.php?topic=94144.0

what does your board look like? pic? ansi? iso? (not positive about international models)
i can help you with a keymap if you're not finding what you're looking for.
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 casualdehid

  • Posts: 32
  • Location: Hungary
Re: ADB to USB keyboard converter
« Reply #997 on: Thu, 21 January 2021, 12:33:32 »
this is a known limitation on some of the apple boards. whether it be how they are wired electrically or how they are implemented in the adb protocol.

was mentioned here as well
https://geekhack.org/index.php?topic=14290.msg1495044#msg1495044
but it says
Quote
While Extended keyboard(AEK and AEKII) has discriminate between left and right modifier keys except Command keys.
so you might be in luck, just have the wrong keycode in the keymap or something.

there has also been a replacement pcb that was started for the AEK/AEKII. (not sure how far along it is)
https://geekhack.org/index.php?topic=94144.0

what does your board look like? pic? ansi? iso? (not positive about international models)
i can help you with a keymap if you're not finding what you're looking for.

Dude... you're awesome.
Really, they appear to be the same. Now I solved the problem, well... a bit weirdly, but I did anyway. I set Alt Gr to Left Apple Key, and it works flawlessly since they are the same. If I ever needed Left Alt, I set it to Right Apple Alt Gr (the only reason is to use Alt F4 to exit form a few programs), and set a windows key to Left apple alt. Best of both worlds in my honest oppinion.

Now another question: The Num Equal outputs a "5". Scancode according to sharpkey: 0x0059. Is there any way I can make it spit out Equals in hungarian keyboard layout set in windows?
M0116, Model M, AEK II

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #998 on: Thu, 21 January 2021, 12:52:33 »
glad you got it partly sorted.

keypad equal...
what does the "5" output?
what keymap are you using? unicode?
international gets a little funky... not real good documentation... check http://kbdlayout.info/kbdhu/scancodes+scancodes (hopefully this will help)
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 casualdehid

  • Posts: 32
  • Location: Hungary
Re: ADB to USB keyboard converter
« Reply #999 on: Thu, 21 January 2021, 13:49:28 »
Num 5 outputs: 4C. Corresponds with the page you sent me.
5/% (Num row) outputs: 06. Corresponds with the page
Apple EKII Numpad Equal: 00_59, Unknown according to sharpkey.

EDIT: Fck... Altgr prtscrn messed it up xD Sorry, my bad. Just pretend that it says: 00_59, Unknown
EDIT2: I'm just asking, is there a way to implement macros in this? I think quite a few people would find it useable, and it'd make it the ultumate macro board, like the Gateway anykey xD
« Last Edit: Thu, 21 January 2021, 13:57:34 by casualdehid »
M0116, Model M, AEK II