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

0 Members and 1 Guest are viewing this topic.

Offline Noodloodle

  • Posts: 4
Re: ADB to USB keyboard converter
« Reply #1050 on: Mon, 22 February 2021, 21:10:18 »
New errors I have no ideas how to deal with. I downloaded the latest version of Cygwin and am trying to build the firmware from the Tmk_master file. Was I supposed to unzip the file or leave it zipped? I'm trying to follow the guide that you sent earlier to use with a Teensy 2.0, but when I am trying to build the firmware, the line where it asks for me to
Code: [Select]
make -f Makefile.<variant> clean it keeps erroring saying:

Code: [Select]
../../tmk_core/protocol/Lufa.mk:12: *** LUFA may be too old or not found: try 'git submodule update --init'. Stop. 262825-0

when trying this command it fails to find a repository and update the Lufa. What do I do from here? am I stuck because I have too new of a system or is there a way to get around this? Is there any way to bypass this by just getting a pre-created hex file for the ADB_USB variant that I can just flash?

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #1051 on: Mon, 22 February 2021, 21:16:11 »
Use the online configurator (link in previous post). At the bottom of the configurator page you can download a hex file to flash to the teensy.
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 Noodloodle

  • Posts: 4
Re: ADB to USB keyboard converter
« Reply #1052 on: Mon, 22 February 2021, 22:12:33 »
Thank you for all the help Nevin, sorry for not seeing it the first time.

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #1053 on: Tue, 23 February 2021, 07:30:31 »
No worries. It's always a bit confusing until you learn the terminology & tools when your first getting started.
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 Potatomonkey

  • Posts: 41
  • Location: Inside a WYSE keyboard
  • Tsangan best row
Re: ADB to USB keyboard converter
« Reply #1054 on: Mon, 01 March 2021, 21:21:36 »
Hey guys, I just made a converter for my AEK II and when I plug it in, the leds on the keyboard flash once, then all turn on solid. The converter is being recognized in hid_listen, but I'm not getting any scancodes or error messages. I have 6ish-k resistor between the gnd and data lines. Any ideas as to what is happening?
     

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #1055 on: Tue, 02 March 2021, 08:51:28 »
not really sure, need a little more info.

what controller are you using?
which firmware did you use?
- with the adb converter there are two variants one for 32u4 (rev 1) for teensy & promicros & similar
and 32u2 (rev 2) for the one hasu sells

sounds like it didn't flash right or is not the right firmware for your controller?
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 Potatomonkey

  • Posts: 41
  • Location: Inside a WYSE keyboard
  • Tsangan best row
Re: ADB to USB keyboard converter
« Reply #1056 on: Tue, 02 March 2021, 18:49:32 »
Sorry for not clarifying, I was using the QMK variant on a promicro (32u4), however I also tried hasu's rev1 for TMK and I'm getting the same result. The keyboard still shows up correctly in hid_listen on the TMK version.

Code: [Select]
    TMK:a36eff92/LUFA
   
   
    Scan:
   
    Keyboard:
    handler: 00, ISO: no
   
    Scan:
   
    USB configured.
   
    Keyboard start.

Is the output I get from the hid_listen on the QMK toolbox, which is what i use to flash.
     

Offline Potatomonkey

  • Posts: 41
  • Location: Inside a WYSE keyboard
  • Tsangan best row
Re: ADB to USB keyboard converter
« Reply #1057 on: Tue, 02 March 2021, 19:39:50 »
ok this is kinda awkward, but after pouring over my wiring for the 15th time i noticed that the GND trace on my adb breakout was broken right by the pad, kind of embarrassing but jumping that trace fixed my issue.
     

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #1058 on: Tue, 02 March 2021, 20:54:41 »
glad you figured out what it was. congrats
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 DwieDave

  • Posts: 10
Re: ADB to USB keyboard converter
« Reply #1059 on: Mon, 29 March 2021, 13:16:33 »
Hello;

Today I tried to built my own ADB Converter using a (non-official) ProMicro.
First I had issues flashing the ProMicro with the Rev.1 Firmware provided on the Keymapping website
(http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1)
but in the end it worked out and it shows as  "ADB keyboard converter" in my system settings.

Sadly the keyboard (Apple Extended Keyboard II) is not working.
There are no lights on capslock or numpad.
Sometimes after connecting the usb cable to the ProMicro the LED
dies after some seconds and the adapter is not visible in system info anymore.


I rechecked the wiring multiple times.
Is my Apple Keyboard or my ProMicro broken?

I connected 5V to VCC; GND to GND and DATA to Pin3 on the ProMicro (labeled only with 3)
And I bridged J1 with solder.

I would be really thankful for every bit of help!
Thank you

Kind regards
Dave
« Last Edit: Mon, 29 March 2021, 13:21:03 by DwieDave »

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #1060 on: Mon, 29 March 2021, 13:27:49 »
you are correct in using the rev1 firmware. 32u4

make sure you use a pull-up resistor. also check the pinout of the connector. the diagram of the connector is keyboard side (female)
https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb
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 DwieDave

  • Posts: 10
Re: ADB to USB keyboard converter
« Reply #1061 on: Mon, 29 March 2021, 13:43:45 »
@nevin:
Thank you so much!
It's really embarrassing but I thought the
wiring diagram was for the plug and not the socket.

Just typed this reply on the AEKii  :D


Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #1062 on: Mon, 29 March 2021, 13:44:46 »
it happens more than you think, that's why i mentioned it.
congrats!
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 Fritz the German

  • Posts: 18
  • Location: Germany
    • My Blog
Re: ADB to USB keyboard converter
« Reply #1063 on: Sat, 03 April 2021, 13:43:07 »
I'm a little bit tempted to get an Apple Adjustable Keyboard M1242 and the corresponding separate Numeric Keypad.
But I believe that the converter doesn't support two daisy-chained ADB keyboards, correct?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1064 on: Sat, 03 April 2021, 21:22:27 »
It should support actutally :D
Try it and report if you have problem.

Offline godzillq25

  • Posts: 34
  • Location: australia
Re: ADB to USB keyboard converter
« Reply #1065 on: Sun, 04 April 2021, 04:14:14 »
the converter works fine and thank you sooo much for that, but i can't seem to generate a custom hex from tmk keymap editor and im only able use the standard layout.
i am i following the steps right?

edit layout
press the download button under 'Firmware Hex File Download:'
and then flash hex using qmk toolbox
i have repeated this 3-4 times

im using it for a m0116

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #1066 on: Mon, 05 April 2021, 08:30:08 »
looks like the file downloads fine. are you having trouble flashing it?
- is it one you bought form hasu or one you built?
- if built, what microcontroller did you use teensy 2.0 or promicro (or similar)
    ... i'm asking because they use different bootloaders for flashing.
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 godzillq25

  • Posts: 34
  • Location: australia
Re: ADB to USB keyboard converter
« Reply #1067 on: Tue, 06 April 2021, 05:30:16 »
i built it my self using a promicro, the board works fine as a stock layout, i just cant assign a layer changer to ad volume controls on second layer

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #1068 on: Tue, 06 April 2021, 09:06:41 »
i built it my self using a promicro, the board works fine as a stock layout, i just cant assign a layer changer to ad volume controls on second layer

1. double check witch version of the firmware you are using. it should be the rev.1 version for 32u4 processors
TMK Converter rev.1(ATmega32U4): [ Full-key ]
http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1

2. delete or move any other .hex files out of the folder your browser downloads to (just in case you're grabbing the wrong one)

3. promicros can be tricky to flash, even with resetting twice in a row you only get 8 seconds to catch the bootloader
so, - edit & download the firmware
- open QMK toolbox and get it ready, select the correct firmware
- reset it twice quickly
- as soon as you see the port open up in the window, click flash.
266008-0
- wait for the confirmation message that flashing was successful
266010-1

4. if you're still having trouble, try clearing the EEPROM.
- reset twice quickly
- soon as the port is found click "Clear EEPROM"
(not sure if the ADB converter stores the keymap in EEPROM but other firmwares do, i've run into this myself with flashing new firmware while there was a previous keymap sitting in the EEPROM from VIA, so my revised keymap in the firmware was being overridden by the keymap in the EEPROM from VIA. this was a QMK keyboard not a converter though)
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 hbloub

  • Posts: 1
Re: ADB to USB keyboard converter
« Reply #1069 on: Wed, 28 April 2021, 07:51:04 »
Hey, first I'd like to thank you for making this converter that's really awesome  :thumb:. I managed to revive an AEKII which is working perfectly with a cheap pro micro.
I also have a question, although it may not really be about the converter itself. I have another AEKII that I wanted to convert, and since I had trouble making it work, I used my functioning converter with it and found out it didn't help. When I'm plugging it, the three LEDs on the keyboard turn on and nothing else happens. Do you have any idea about what I could do to check what could be wrong with the keyboard itself ?

Offline cmdrriker

  • Posts: 4
Re: ADB to USB keyboard converter
« Reply #1070 on: Thu, 06 May 2021, 00:39:02 »
I'm having a bear of a time trying to get my Teensy 2.0 to work with my old Apple Extended Keyboard model M0115.



I added pins to my Teensy so I could try various wire combinations without having to desolder if I got things wrong (preparing for something to be incorrect :().

Image of the top of the board with my 1k Ohm resistor across PD0 and VCC



Bottom of the board showing my jumper wires:



  • red - PD0
  • black - VCC
  • green - ground

I fed my jumpers into either ADB ports on my keyboard shown here:



I was unable to build the firmware because it seems that there are issues with the compiler being 64bit only on Catalina. The Teensyduino/Arduino tools are not recognizing changes made on pointers etc, make barfs on the code.

No biggie I found the V1 firmware on https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb/binary. Using Teensy Loader for MacOS i was able to flash the board and it reports in under System Profiler as it should:



My Mac recognizes it as ADB Keyboard Converter.

However, I plug in my old ADB-E Keyboard in, and anticlimactically nothing seems to work. I went back to rearranging the wiring and it's just stone cold Steve Austin dead lol.

I used hid_listen.mac64 to profile the board and it sees the Teensy fine (also Teensyduino sees it too as well

Code: [Select]
❯ [size=14pt]./hid_listen.mac64
Waiting for device:.....
Listening:


TMK:a36eff92/LUFA


Scan:
RRRRRRRRRRRRR
Keyboard:
Rhandler: 00, ISO: no
R
Scan:
RRRRRRRRRRRRRRRR
USB configured.

Keyboard start.
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR^C
~/Development/tmk_keyboard/converter/adb_usb master* 8s[/size]

I see that Hasu says that the RRRR nonsense being returned means that something is wrong with my wiring but I've run out of ideas as to what I'm doing wrong. Is my Teensy dead? or am I missing something not evident?

Thanks in advance for any thoughtful tips/ideas!

Regards

-riker
« Last Edit: Thu, 06 May 2021, 00:46:51 by cmdrriker »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1071 on: Thu, 06 May 2021, 02:20:34 »
The "R" on debug output means that the conveter didn't get any respnse to a command within specific term(500ms).
https://github.com/tmk/tmk_keyboard/blob/66e97371bacb1ad55096f0407b47f0a73fadc6c7/tmk_core/protocol/adb.c#L160-L164

This happens when connecting keyboard with converter already powered(hotplug/hotswap) because keyobard can't response to the converter during its startup. It is not error in this case. But in many other cases the "R" means that there is something wrong on your converter, keyboard or wiring setup.

I'd check that resistor value and its soldered points. I'm not familiar with that type of color codes, it looks to me brown, black, black, unknown, brown. Is that really 1K?
what if the resistor is removed?


Offline cmdrriker

  • Posts: 4
Re: ADB to USB keyboard converter
« Reply #1072 on: Fri, 07 May 2021, 21:50:29 »
The resistor is supposedly a 1K ohm... but I picked up a new Teensy2.0 and just soldered pins to VCC, PD0, & ground. Then because I misplaced the 1kΩ parts I had and used a 10kΩ part instead and it worked!

I don't know if I burned the other board, perhaps got stray solder somewhere on it, or if it was defective? Oh well!

I can't believe that after sitting in the closet after all these years that my old EK works! You know it took an entire summer of work to save up my after-school job monies to be able to afford a Mac IIcx, 13" AppleColor Monitor, & this here keyboard. My old mouse crapped out years ago lol.

What a great project Hasu! I thank you!

In health,

-Riker

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1073 on: Fri, 07 May 2021, 22:37:35 »
Glad to hear it works with the keyboard from your school days!

In many cases this converter works without pull-up resistor, you can try removing the resistor and cleaning up solder around PD0 pin on the first Teensy.
If you still get too many "R" errors after those remedies the PD0 pin might been burned and latch-up'd.

Offline cmdrriker

  • Posts: 4
Re: ADB to USB keyboard converter
« Reply #1074 on: Fri, 07 May 2021, 23:31:23 »
Good idea about the other board. I have to get a better desolder tool, the one I have is a piece o' cr*p and then I'll try removing the mess I made. A colleague of mine gave me one of those ergonomic apple keyboards that I also have on a shelf somewhere at work so if I get that board resuscitated I'll use it with that one.

I just used the online keyboard layout tool and edited the layout to flip the squiggle key(apple) to the right and move alt leftward, reflashed the teensy and things are working great!

Another satisfied customer  :D

In health & gratitude,

-riker

Offline nevin

  • Posts: 1646
  • Location: US
Re: ADB to USB keyboard converter
« Reply #1075 on: Sat, 08 May 2021, 06:41:59 »
Quote
A colleague of mine gave me one of those ergonomic apple keyboards that I also have on a shelf somewhere at work so if I get that board resuscitated I'll use it with that one.

ahh... the apple adjustable keyboard. nice. i have one of those too, i don't have the "wings" (wrist rests) though. warning though... the switches (Alps SKFS) feel a bit different than apple's other boards. they're a low profile version of full size alps.

here's some more info on the board:
https://deskthority.net/wiki/Apple_Adjustable_Keyboard
and
http://sandy55.fc2web.com/keyboard/apple_adjustable_e.html

switch info: https://deskthority.net/wiki/Alps_SKFR/SKFS_series

if memory serves, the buttons in the outer bezel won't work with the converter (wired different (not part of the matrix) and non-standard codes), maybe the esc does... i can't remember, iit's been a couple years since i played with that one. even if a couple do work, they are not pleasant to use as they are just tiny tact switches. and with most apple boards you can't differentiate the left & right apple key as they are wired as the same key. (not sure anymore if the same applies to any of the other modifier keys). i remember using the period as a dual role Fn key (period when tapped, Fn when held)
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: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1076 on: Thu, 03 June 2021, 04:25:01 »
[FIRMWARE UPDATE]
Updated prebuild firmware in github repo and Keymap Editor.

With new firmware:
- Power key works on Windows as well https://github.com/tmk/tmk_keyboard/commit/a93677cbf145baf210f92a9129ded55c9ef5657b
- Fix swap issue on LAlt and LGUI(Cmd or WIn) https://github.com/tmk/tmk_keyboard/commit/ea4baf1cb6ed34a88c0d478f71d9f17ae069c3c6


Also I updated the first post about pull-up registor, 1K Ohm is recommended now.
4.7K and 10K Ohm didn't work on daisy-chain with multiple devices. See github issue, this is interesting find, methinks. https://github.com/tmk/tmk_keyboard/issues/683#issuecomment-850190574

Offline djvs

  • Posts: 9
Re: ADB to USB keyboard converter
« Reply #1077 on: Mon, 16 August 2021, 20:31:40 »
Having issues with my own converter.  Connections all secured, firmware flashed & input device registering to lsusb as you'd hope, 1k resistor added, J1 soldered, but getting no response from keyboard ("RRRRRR...") via sudo hid_listen.  Pictures attached...

My fear is I got the connections mirrored?  But I did try it the other way around as well.  I also tried a second pro micro, albeit that one I didn't try with a resistor yet (I had to wait for some in the mail).
« Last Edit: Mon, 16 August 2021, 20:35:12 by djvs »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1078 on: Mon, 16 August 2021, 20:52:15 »
Wiring looks good to me.
But I still think wiring is a problem.

Are you  sure the resistor is 1k? If not you can test without it.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1079 on: Mon, 16 August 2021, 20:56:05 »
Also rework soldering may help. It doesn't look so good at some joints.


Offline djvs

  • Posts: 9
Re: ADB to USB keyboard converter
« Reply #1080 on: Mon, 16 August 2021, 21:10:19 »
Yeah resistor is labelled 1k, brand new and multimeter measures it at 990ohm.  Continuity on all connections and no shorts.  This is AliExpress pro micro by the way, if it makes any difference, but J1 is soldered and crystal reads 16mhz, and I used rev1 (atmega32u4).

Offline djvs

  • Posts: 9
Re: ADB to USB keyboard converter
« Reply #1081 on: Mon, 16 August 2021, 21:37:08 »
Mapping of sockets to main PCB (assuming this is correct - if anyone else is trying to wire directly to board) -

Code: [Select]
Left side AEK2 socket (near Esc key) - facing from the bottom side:

      2   4       8
      G   V       D
    o o o o o o o o o
    1 2 3 4 5 6 7 8 9

    o o
    o o
    o

Offline cmdrriker

  • Posts: 4
Re: ADB to USB keyboard converter
« Reply #1082 on: Tue, 17 August 2021, 12:03:43 »
Having issues with my own converter.  Connections all secured, firmware flashed & input device registering to lsusb as you'd hope, 1k resistor added, J1 soldered, but getting no response from the keyboard ("RRRRRR...") via sudo hid_listen.  Pictures attached...

My fear is I got the connections mirrored?  But I did try it the other way around as well.  I also tried a second pro micro, albeit that one I didn't try with a resistor yet (I had to wait for some in the mail).

Do you have header pins? Some breadboard pin connectors?

I'd suggest using them as if you don't have a steady hand or good soldering skills. Then use IMHO, it's easy to get your wires "crossed" or worse burnout a through-hole or the board. I accidentally torched a through-hole on my 1st attempt.

Offline djvs

  • Posts: 9
Re: ADB to USB keyboard converter
« Reply #1083 on: Sun, 22 August 2021, 11:15:35 »
I got it on a later try with a different Pro Micro - not sure what the issue was, maybe a burnt out pad or the ADB connector, but everything working now.

Tip for people doing M3501 internal adapter - don't use a Pro Micro, use a Teensy, or something else small.  It's a really tight fit in the M3501 case.  You can fit it vertically between the foot and the plate, but it might jam against the foot.
« Last Edit: Sun, 22 August 2021, 11:33:32 by djvs »

Offline jeb

  • Posts: 21
Re: ADB to USB keyboard converter
« Reply #1084 on: Wed, 29 September 2021, 14:19:42 »
I got a MicroSpeed MacTRAC 2.0 trackball, and I was able to make this adapter using a Pro Micro to convert it, which is wonderful. The resistor was required before the adapter would do anything (the trackball's PCB actually had an empty, labeled spot for the resistor, which was nice). It is a three button mouse, and the buttons behave strangely, which I'm wondering if it's possible to fix. Here is some output from hid_listen.

On plugging in:
Code: [Select]
Listening:

TMK:86482d/LUFA:d6a7df

Scan:
 addr:3, reg3:672F

Keyboard:
handler: 00, ISO: no

Scan:
 addr:3, reg3:652F

USB configured.

Loop start.
M:addr3 reg3: 6F2F

Here is a left click (press and release), which looks normal:
Code: [Select]
M:[00 80 00 00 00]
M:[B:01 X:0(0) Y:0(0) V:0 A:1]
M:[80 80 00 00 00]
M:[B:00 X:0(0) Y:0(0) V:0 A:1]

Middle click, press:
Code: [Select]
M:[80 00 00 00 00]
M:[B:02 X:0(0) Y:0(0) V:0 A:1]

Middle click, release:
Code: [Select]
M:[00 80 00 00 00]
M:[B:01 X:0(0) Y:0(0) V:0 A:1]

If middle click is pressed again, there is no result, but then on release:
Code: [Select]
M:[80 80 00 00 00]
M:[B:00 X:0(0) Y:0(0) V:0 A:1]

Right click, press:
Code: [Select]
M:[00 00 00 00 00]
M:[B:03 X:0(0) Y:0(0) V:0 A:1]

Right click, release:
Code: [Select]
M:[80 80 00 00 00]
M:[B:00 X:0(0) Y:0(0) V:0 A:1]

The middle click behavior is especially weird, but is probably somehow intended by the mouse. I might end up just inserting some hacky code into my specific adapter to try to make its behavior more sensible for me, but someone has any better idea that would be more generally useful, that would be great.

Edit:
There appears to be some MicroSpeed specific code in this Linux driver: https://elixir.bootlin.com/linux/v4.4/source/drivers/macintosh/adbhid.c. I will try to understand the relevant segments of code when I have the opportunity.
« Last Edit: Wed, 29 September 2021, 17:51:31 by jeb »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1085 on: Wed, 29 September 2021, 19:04:53 »
Great. Let us know how it goes!

NetBSD code repo was another useful resoruce when I added TurboMouse support.

https://github.com/tmk/tmk_keyboard/wiki/Apple-Desktop-Bus#kensington-turbo-mouse

Edit:
There appears to be some MicroSpeed specific code in this Linux driver: https://elixir.bootlin.com/linux/v4.4/source/drivers/macintosh/adbhid.c. I will try to understand the relevant segments of code when I have the opportunity.


Offline jeb

  • Posts: 21
Re: ADB to USB keyboard converter
« Reply #1086 on: Mon, 18 October 2021, 22:17:29 »
I spent quite a while trying to figure this out. I was able to track down the original Mac drivers for these. I could not run them, as I don't have any Macs or anything with an ADB port and they wouldn't do anything in an emulator without a mouse attached (and I was unable to trick them), so I disassembled them. The important thing from viewing the archive of Microspeed's website, was a note that the newer driver required a mouse with a newer/updated firmware. In the newer driver, I was able to identify the code that was sending the string of bytes that's found in the Linux driver. My trackball didn't respond to these at all, and would never tell me anything for the contents of register 1 (which I don't know if that's normal).

Looking at the older driver, and reading the help text embedded in it, I determined that all of the features of it could be accomplished using the output, along with software logic. I also think that the output is weird, but structured in a clever way so that its button presses would all look like a button 1 click (or a click lock, for the middle button) if the computer were ignoring any additional buttons.

There is also a strange behavior I noticed, which now makes sense: if you hold down the middle button, then press the left or right buttons, the second nibble of the first or second bytes returned will be 1 and movement is no longer sent. The help text mentioned a "signaling" mode, where you hold the middle button, then press either the left or right button 1-4 times, in order to trigger a macro.

I have not decided how I want to implement the logic in the adapter. It may not be worth doing the more complex logic to track if the middle button is held. I think my ideal solution would be to rewire the switches directly to the adapter and ignore the nonsense from the mouse. This would likely be more difficult, as I don't think the adapter can currently look for any buttons on other pins. But if successful, it would be more generally useful.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1087 on: Tue, 19 October 2021, 23:24:50 »
I spent quite a while trying to figure this out. I was able to track down the original Mac drivers for these. I could not run them, as I don't have any Macs or anything with an ADB port and they wouldn't do anything in an emulator without a mouse attached (and I was unable to trick them), so I disassembled them. The important thing from viewing the archive of Microspeed's website, was a note that the newer driver required a mouse with a newer/updated firmware. In the newer driver, I was able to identify the code that was sending the string of bytes that's found in the Linux driver. My trackball didn't respond to these at all, and would never tell me anything for the contents of register 1 (which I don't know if that's normal).

You think your trackball has old firmware, which is not supported by Microspeed new driver and Linux ADB driver.
So you will have to look into old driver version 1.2 to find 'magic' byte string for your old MacTrac? Did you see version 1.2 driver?

I found this note as you said and new/old drivers for MacTrac here. Unfortunately, it is almost no chance to upgrade your MacTrac to the new firmware anymore.
Quote
Note:  If you are using a Mac Trac 2.0 TrackBall with Control Panel software version 1.2, and you wish to download the latest software,
you will need to contact the Support Dept. for an Upgrade Kit.  You Cannot use Software version 3.4 with your current TrackBall configuration.  You WILL require a firmware upgrade.
https://web.archive.org/web/20020124235248/http://www.microspeed.com/pages/support/supdown.html

Offline jeb

  • Posts: 21
Re: ADB to USB keyboard converter
« Reply #1088 on: Wed, 20 October 2021, 21:33:46 »
You think your trackball has old firmware, which is not supported by Microspeed new driver and Linux ADB driver.
So you will have to look into old driver version 1.2 to find 'magic' byte string for your old MacTrac? Did you see version 1.2 driver?

I think the old firmware uses a non-standard implementation, and there is no magic byte or any way to change its output. Its output was meant to work as a one-button mouse with a middle button "click lock" function, if there is no special driver installed. And then if the driver is installed, the driver uses the extra button values sent to handle the extra features. But all three buttons will send a value that contains a left-button click. (Left button -> button 1; Right button -> buttons 1 and 2; Middle button -> button 2 then button 1.)

It's possible the 1.2 driver has something interesting, but I couldn't find anything. At least, it is not calling the Mac system calls to do ADB listen or ADB read, so I think it is just adding a handler to intercept the calls for mice at its address. Unless it is old and listen/read were handled in a different way in earlier versions of the Macintosh OS.

I found this note as you said and new/old drivers for MacTrac here. Unfortunately, it is almost no chance to upgrade your MacTrac to the new firmware anymore.

Also, it's funny, that the circuit board for my MacTrac says "PS/2 Trac" on it. So, I think it could be possible to get a firmware from that model of trackball to work, too. But I think that firmware is also not available. The firmware must be on a microcontroller, because there is no other logic on the board.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1089 on: Thu, 21 October 2021, 00:58:31 »
I  see. Your explanation appears to be reasonable.
I guess Mac supports only button1 and just ignores button2 without specific driver. So Left and Right button would act as button1, and Middle button as a click-lock there, as you said.


I found this 1995 Dec. press release of firmware update and new driver software.
Early version of MacTrac2.0 before this update doesn't seem to support the Microspeed specific protocol unfortunately.
https://web.archive.org/web/19970329135742/http://www.microspeed.com/doc8.htm

Offline kettuz

  • Posts: 2
Re: ADB to USB keyboard converter
« Reply #1090 on: Tue, 16 November 2021, 05:16:35 »
First of all, many thanks to Hasu and everyone who has contributed to this project! Great work!

Almost two years ago I purchased an Apple Extended Keyboard II from a seller, who had made this project and installed a Teensy 2.0 in that keyboard. At first I thought something was broken, as I wasn't able to get the AltGr work what ever I did. But having come back now to that keyboard I read the bugtracker and found out someone else had had the exact same issue and Hasu had fixed it  :thumb:

Now, having tried the keyboard a bit more after this long hiatus from it I'd like to ask if others have some of these small issues I have just discovered - that is, if what I'm facing is just how this keyboard, ADB and this converter are expected to work.

1) Latency. Testing AEKII against an AT keyboard with a proprietary USB converter I feel there is a small lag. It's very small, but somewhat easier to note when playing a game. Using the keyboard with my retro setup and playing a game, for example like Duke Nukem 3D, felt like I was moving underwater: playing needed more effort, something felt off.

2) When using file manager Volkov Commander, the clone of old Norton Commander, I was suddenly wondering: was it really so that moving from one line to another I couldn't keep the down arrow pushed and instead had to make a separate push and move one line at a time? When I switched AEKII to my USB-converted AT-keyboard, the expected behavior returned: I could keep the down arrow pushed and scroll down very smoothly and effortlessly.

I guess my use cases are a bit unusual compared to just writing, but I'd like to hear your comments :)

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1091 on: Tue, 16 November 2021, 22:25:34 »
1) Primary source of the latency is polling interval 12ms key strokes. That interval value is conservative perhaps and II think you can tune it for your keyboard. Some of ADB keyboards requires longer interval than others.

https://github.com/tmk/tmk_keyboard/blob/a76a3ee9147ac9ec912f0799a816e4c99587ab8c/converter/adb_usb/matrix.c#L440-L441

Also refer to these post for the interval value decision.
https://geekhack.org/index.php?topic=14290.msg1068919#msg1068919
https://geekhack.org/index.php?topic=14290.msg1070139#msg1070139

I'm curious about how far AEK can go with faster interval.

Other soruce may be mouse feature, you can disable it.
https://github.com/tmk/tmk_keyboard/blob/a76a3ee9147ac9ec912f0799a816e4c99587ab8c/converter/adb_usb/matrix.c#L131-L418

2) You use the application on MS-DOS, right?
The converter works in boot mode(6KRO) with DOS and it may has a bug in the mode.(no bug there)

Does normal keys like 'a' can repeat?

You don't have the problem on modern OS, right?

What is exactly "USB-converted AT-keyboard" and what controller or converter do you use for it?
« Last Edit: Tue, 16 November 2021, 22:32:34 by hasu »

Offline kettuz

  • Posts: 2
Re: ADB to USB keyboard converter
« Reply #1092 on: Wed, 17 November 2021, 09:22:22 »

Thanks Hasu! I'll explore those links in more detail :)

Does normal keys like 'a' can repeat?
I might have seen that behavior but I'm not certain. I'll have to test more thoroughly

You don't have the problem on modern OS, right?
Well, one of the reasons I wanted to test the games in DOS was that I felt like there was slight sluggishness in Ubuntu 18.04 too.

What is exactly "USB-converted AT-keyboard" and what controller or converter do you use for it?
I have an AST Research Inc. AST102 -- pretty much same as this: https://www.retropcstore.com/product/ast-research-inc-model-astkb102-with-cherry-doubleshot-rubber-dome-keycaps/
Converter seems to be one of these "Blue Cubes": https://deskthority.net/wiki/File:Blue_Cube.jpg

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1093 on: Wed, 17 November 2021, 17:15:44 »
kettuz,
You can get debug log with hid_listen if you have the problem on Ubuntu also. See 'DEBUG' in the first post.


Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter
« Reply #1094 on: Wed, 17 November 2021, 17:19:36 »
[FIRMWARE UPDATE]

Updated prebuilt firmware files in repo and they are available on Keymap Editor too.

Chages:
    - Initialize keyboard dynamically #671
      Extended and ISO keyboard are properly setup even after hot-plug
    - Mouse buttons state integration #101
      This allows users to use mousekey buttons with ADB mouse
    - Reset devices on startup
      This restores devices to default state on warm startup like flashing firmware
    - mouse extended 16-bit report support
    - Add scroll wheel emulation #692


Offline casualdehid

  • Posts: 32
  • Location: Hungary
Re: TMK ADB to USB keyboard converter
« Reply #1095 on: Sat, 18 December 2021, 07:56:05 »
Hi there.
Again (sorry), a small bug report I have here:
Pressing Esc on the Power On key does absolutelly nothing, confirmed with EK Swtich Hitter.

Keyb: M0118, Assembled in Ireland. .hex attached.
M0116, Model M, AEK II

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK ADB to USB keyboard converter
« Reply #1096 on: Sat, 18 December 2021, 18:07:47 »
In TMK ADB converter Power key is used for 'Magic key' and you can access 'Magic commands' by pressing some key while holding the Power key. This means you can't remap the Power key to keys used for 'Magic commands' like below by default unfortunately.

Quote
z e h d x k m v s n c / ` Esc CapsLock Pause
0 1 2 3 4 5 6 7 8 9 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10


Disable 'Magic command' function and build firmware yourself if you need to remap Power key to those keys.
Quote
diff --git a/converter/adb_usb/Makefile b/converter/adb_usb/Makefile
index 3b10a10a..af3e2b54 100644
--- a/converter/adb_usb/Makefile
+++ b/converter/adb_usb/Makefile
@@ -71,7 +71,7 @@ BOOTMAGIC_ENABLE ?= no                # Virtual DIP switch configuration(+1000)
 MOUSEKEY_ENABLE ?= yes         # Mouse keys(+4700)
 EXTRAKEY_ENABLE ?= yes         # Audio control and System control(+450)
 CONSOLE_ENABLE ?= yes          # Console for debug(+400)
-COMMAND_ENABLE ?= yes          # Commands for debug and configuration
+COMMAND_ENABLE ?= no           # Commands for debug and configuration
 NKRO_ENABLE ?= no              # USB Nkey Rollover
 ADB_MOUSE_ENABLE ?= yes                # ADB Mouse support
 UNIMAP_ENABLE ?= yes           # Use unimap

Offline kungfu_jesus

  • Posts: 9
Re: TMK ADB to USB keyboard converter
« Reply #1097 on: Thu, 17 February 2022, 18:01:22 »
I've resurrected this project (M0116) from my closet of shame and it's alive but I'm missing a "column" of keys. I think I resoldered all of these switches at some point... Can anyone speak to the construction of these boards and if I may be looking at a software or a hardware issue here? Not sure if one bad switch would affect the rest in a certain configuration or if a misconfigured layout would do it as well. Trying to look into recompiling but it's been so long my head is spinning.  ;)
« Last Edit: Thu, 17 February 2022, 18:03:06 by kungfu_jesus »

Offline nevin

  • Posts: 1646
  • Location: US
Re: TMK ADB to USB keyboard converter
« Reply #1098 on: Thu, 17 February 2022, 19:37:31 »
Is it a converter you bought or built?
You can use the configurator linked in the 1st post.
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 kungfu_jesus

  • Posts: 9
Re: TMK ADB to USB keyboard converter
« Reply #1099 on: Thu, 17 February 2022, 19:43:31 »
Built using a Teensy 2.0+++. I can't seem to get the latest tmk to make, but the repo from 2018 still works.

I do have the regular Teensy 2.0 handy as well so I may as well just solder the connections to that and try a flash on that as well using the configurator.