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

0 Members and 2 Guests are viewing this topic.

woody

  •  Guest
ADB to USB keyboard converter for Teensy
« Reply #50 on: Wed, 11 January 2012, 09:22:59 »
Ha, hello and welcome, blargg!

Offline HILO

  • Posts: 6
ADB to USB keyboard converter for Teensy
« Reply #51 on: Thu, 26 January 2012, 07:46:34 »
Hello, I'm beginner of Electronics.
Last day, I got an Apple Extended Keyboard2. But I don't have ADB Port Macintosh.
I tried to make the ADB to USB keyboard converter for Teensy.
But, it's doesn't work.

I tried to trouble shooting.
Maybe, I missed to build.

1. Define following macros for ADB connection in config.h:
   ADB_PORT
   ADB_PIN
   ADB_DDR
   ADB_DATA_BIT
   ADB_PSW_BIT

Then, I refferd to Config.h.
/* ADB port setting */
#define ADB_PORT PORTF
#define ADB_PIN PINF
#define ADB_DDR DDRF
#define ADB_DATA_BIT 0

 I use Teensy 2.0. in this case, I connected Data-Line to Teensy PF0 with 10kOHM PullUp. PSW-Line to Teensy PF1.
What shall I do the source code and Teensy2.0.
Please teach me.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #52 on: Thu, 26 January 2012, 21:00:20 »
If you use Teensy 2.0(not++) you don't need to edit any file.
Just 'make' and program your Teensy.
Double check signal and power lines. PSW line is not needed actually.

And try PJRC hid_listen to see debug print.

Offline blargg

  • Posts: 45
    • My github
ADB to USB keyboard converter for Teensy
« Reply #53 on: Sun, 29 January 2012, 23:42:42 »
Seconded; I didn't have to modify config.h even for a Teensy++ 2.0. I just used the same port pin as listed (F0). Be sure you've got the keyboard wired up properly. The pinout in adb.txt is for the female plug on the keyboard, so your male cord will be mirrored horizontally. You can verify it by ensuring that the GND from the Teensy has continuity to the metal shell of the other ADB connector on the keyboard, and non-continuity to +5V (with the Teensy unplugged from USB of course). Also, when I first connect my keyboard, the caps lock LED lights at first, so that's confirmation that +5V and GND are connected properly. I hope you didn't get them backwards.

Offline HILO

  • Posts: 6
ADB to USB keyboard converter for Teensy
« Reply #54 on: Mon, 30 January 2012, 07:06:21 »
Thanks to Advice.
Yes, I use Teensy2.0(not 2.0++).
I'll Retry it.

Thank you.

Offline HILO

  • Posts: 6
ADB to USB keyboard converter for Teensy
« Reply #55 on: Thu, 09 February 2012, 06:28:41 »
Hello.
By your advice, AEK2 worked. Thank you.

And, I have an problem. I tuned Windows Registry, swapping CTRL  and CapsLock.
My ThinkPad's keyboard can swapping. But, ADBtoUSB Keyboard converter for Teensy can't swap.
Of course, CAPS's latch mech.
That there was a discussion about the CAPS in the past you know the log. My problem is different and the like.
1st, Windows Registry roll back.
2st, /adb_usb/keymap.c rewrite. Swap,
at
 #define KEYMAP( \   ... K36 <- ->K39 ...
  ... KB_##K36 <--> KB_##39 ...
 and
 KEYMAP(  ... LCTL <--> CAPS ...

I tried to swap LGUI and  LALT by 2st modify. It's successfull.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #56 on: Thu, 09 February 2012, 07:19:16 »
You need not to edit definition of KEYMAP macro, just edit key symbols in keymaps[] array.

I think this keymap.c patch is enough to swap Left Control and Caps Lock.
Code: [Select]
130c130
<     CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
---
>     LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
132c132
<     LCTL,LGUI,LALT,          SPC,                                              LEFT,DOWN,RGHT,    P0,       PDOT,PENT
---
>     CAPS,LGUI,LALT,          SPC,                                              LEFT,DOWN,RGHT,    P0,       PDOT,PENT

Offline HILO

  • Posts: 6
ADB to USB keyboard converter for Teensy
« Reply #57 on: Thu, 09 February 2012, 08:28:22 »
Quote from: hasu;510063
You need not to edit definition of KEYMAP macro, just edit key symbols in keymaps[] array.

I think this keymap.c patch is enough to swap Left Control and Caps Lock.


Thank you!
I'll try it tomorrow.

Offline HILO

  • Posts: 6
ADB to USB keyboard converter for Teensy
« Reply #58 on: Fri, 10 February 2012, 03:15:31 »
I tried to change the /adb_usb/keymap.c .
But cannot work, partly.
CAPS Lock could swap the Original CTRL position.

So, I set the Windows's Mouse Cursor , If I push CTRL key, then brinking Cursor.
At this case, changed keymap.c are correct CTRL signal recieved.

I see the Teensy's LED.
When Original keymap.c use. and I push Original CTRL key ,LED brinking two or three time.
When Rewrite Keymap.c use. I Puch New CTRL key (the position was capslock) , LED brinking one.
Maybe, AEK2's Original Capslock key switch/circuit cannot adapt N-key roll over.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #59 on: Fri, 10 February 2012, 04:02:21 »
Ah, maybe 'locking caps' feature prevents you from swap the keys.

Try to comment out the macro in config.h like this:
Code: [Select]
/* Locking Caps Lock support */
//#define MATRIX_HAS_LOCKING_CAPS

Offline Koplimi

  • Posts: 5
ADB to USB keyboard converter for Teensy
« Reply #60 on: Sat, 11 February 2012, 19:57:57 »
Is it possible to get a debug output to uart?
I'm trying to implement this on a swedish version of the Apple Extended Keyboard II, but it doesn't seem to be working.
The device is recognized in Mac OS, but no key presses are recognized.

Also, does this firmware depend on some functions in the teensy boot loader or are all functionality loaded into the .hex you get after compiling?
(I'm using a bare Atmega32u4)

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #61 on: Sat, 11 February 2012, 22:28:49 »
It doesn't support UART as debug channel, instead you'll be able to use 'hid_listen' from PJRC even though your board is not Teensy.

And the converter does not depend on PJRC's bootloader, I think it can also work on other board with ATMega32U4.

Offline Koplimi

  • Posts: 5
ADB to USB keyboard converter for Teensy
« Reply #62 on: Sun, 12 February 2012, 04:54:53 »
Quote from: hasu;512225
It doesn't support UART as debug channel, instead you'll be able to use 'hid_listen' from PJRC even though your board is not Teensy.

And the converter does not depend on PJRC's bootloader, I think it can also work on other board with ATMega32U4.

Ok. I see a lot of references to debug-modes and so on in the code. But most seems to depend on key presses. Where should I edit to enable it by default?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #63 on: Sun, 12 February 2012, 05:15:50 »
Debug print is enabled by default.
Though code of debug print is immature and mess, debug flags are tinkered in pjrc/main.c and adb_usb/matrix.c.

Offline Koplimi

  • Posts: 5
ADB to USB keyboard converter for Teensy
« Reply #64 on: Sun, 12 February 2012, 08:45:12 »
Yes, the debug-output seems to work now, thanks!

But there seems to be weird time-issues. For example, the delays are way off.
When you run the code _delay_ms(5000), do YOU really get a delay lasting 5 seconds? Because I don't.
I'm not sure if that's a problem with the code itself or just me. _delay_ms isn't defined for large delays. Or am I wrong?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #65 on: Sun, 12 February 2012, 09:12:40 »
I think _delay_ms works well for me.

What frequency is your crystal on the board? Teensy has 16MHz crystal oscillator.
You may need to edit F_CPU in Makefile.

If you have wrong F_CPU setting _delay_ms() will not work properly.

Offline Koplimi

  • Posts: 5
ADB to USB keyboard converter for Teensy
« Reply #66 on: Sun, 12 February 2012, 09:22:26 »
That's just the thing. I'm using a 16MHz crystal as well, and the makefile is already set up for that, as you just said.

Could it be something to do with the environment that i'm compiling in? What software do you have installed?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #67 on: Sun, 12 February 2012, 10:17:26 »
I compile with WinAVR 20100110 which consists of:
- binutils 2.19
- gcc 4.3.3
- avr-libc 1.6.7cvs

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #68 on: Sun, 12 February 2012, 10:30:02 »
Added firmware binary built in my environment on the article page. Try it.

Offline Koplimi

  • Posts: 5
ADB to USB keyboard converter for Teensy
« Reply #69 on: Sun, 12 February 2012, 10:39:01 »
Ok, I have uninstalled all that is remotely connected to AVR Studio. And I'm getting timings that are correct! That's positive! :)

Will do further testing and see if it might just work now.

EDIT: YES! It's working now! Thank you for the support! =)

Now I wil need to edit the layout.

Offline HILO

  • Posts: 6
ADB to USB keyboard converter for Teensy
« Reply #70 on: Mon, 13 February 2012, 02:46:52 »
Thanks to Advice.
I succeeded, perfectly.
Thank you very much.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #71 on: Mon, 13 February 2012, 05:04:08 »
welcome. nice to hear that.

Offline signet

  • Posts: 8
ADB to USB keyboard converter for Teensy
« Reply #72 on: Sat, 16 June 2012, 12:42:46 »
I was in the market for a new keyboard to replace my MS Ergonomic 4000 (which has serious mechanical design issues with the space bar) when I came across a link to your article. I went down to my local electronics shop and purchased a LeoStick, uploaded your firmware and got out my ancient M0116 which I use on a SE/30 I have had since new.  It worked first time!

I would like to thank you for the work you have done with this firmware.  I think I will get an Extended II keyboard now that I know it works.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #73 on: Sat, 16 June 2012, 20:11:39 »
signet, Thanks for letting me know my converter went well.

I'm a kinda fan of ALPS. AEKII has good quiet switches but AEK with orange ALPS is also nice and very popular here in Japan.
Anyhoo, every old ALPS switches tend to require to be lubed inside, it is worth doing though very tedious.

LeoStick with piezo and RBG LED seems to be fun though I haven't hear about. We also have a Leonardo compatible board like Teensy in Japan:
http://strawberry-linux.com/catalog/items?code=25005
I think Leonardo and its compatibles are good alternative for Teensy now though Leonardo bootloader is a tad tricky.

Offline signet

  • Posts: 8
ADB to USB keyboard converter for Teensy
« Reply #74 on: Sat, 16 June 2012, 22:34:03 »
I had no problems with the LeoStick (a local Australian produced device http://www.freetronics.com/products/leostick#.T91LPXbO97Q). I used a 10K pullup resistor for insurance since my keyboard has a coiled cable. The bootloader was no big deal, I just used the avrdude CLI utility.

I am interested that you mentioned lubrication I lubed the slider support column on the Return key because it was binding a little bit. Do you have to remove the switches from the PC board to lube them inside? I normally use INOX Mx6, a food grade synthetic grease with PTFE to lubricate the sliding parts on my keyboards, but I have no experience of lubing Alps switches.

On a final note, I am thinking of making some changes to your firmware in order to allow the M0116 power key to be used to generate function keys. The M0116 has no function keys. If the PWR switch is depressed in conjunction with the numeric keys I reckon that would work out OK. It is not so easy to find the Extended version of this keyboard here.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #75 on: Sun, 17 June 2012, 11:08:20 »
Right. Not big deal but some annoying. Leonardo bootloader jumps into user application in 8 seconds after pushing reset button. I think 8 seconds is a bit short to confirm COM port and run command occasionally :)

You don't need to desolder ALPS switch to lub,  you can open it with 2 precision screwdrivers like this:
http://www.youtube.com/watch?v=GhxC6AEzBUo
I usually use a dry lub(RO-59) but have no experience of applying grease to inside of switches.

Ah, M0116 has no function keys... I didn't notice ADB converter needs a keymap layer for function keys.
I'll add it to the firmware sometime soon but power key might not be good idea. IIRC Power switch does not behave as normal keys.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #76 on: Sun, 17 June 2012, 23:04:56 »
Quote from: hasu;615492

Ah, M0116 has no function keys... I didn't notice ADB converter needs a keymap layer for function keys.
I'll add it to the firmware sometime soon but power key might not be good idea. IIRC Power switch does not behave as normal keys.


Added new keymap layer for function keys. I confirmed Power key works as normal key as opposed to my memory. You can get keys from Function layer while pressing power key. See below for keymap detail.


Code: [Select]

    /* Function layer
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
     * |`  |   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |Fn0|
     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
     * ,-----------------------------------------------------------. ,-----------. ,---------------.
     * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Delete | |Ins|Hom|PgU| |NmL|Mb1|Mb2|Mb3|
     * |-----------------------------------------------------------| |-----------| |---------------|
     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|PrS|ScL|Pau|Up |Ins|    \| |Del|End|PgD| |MwD|McU|MwU|MwD|
     * |-----------------------------------------------------------| `-----------' |---------------|
     * |CapsLo|VoD|VoU|Mut|  F|  G|  H|  J|Hom|PgU|Lef|Rig|Return  |               |McL|McD|McR|MwU|
     * |-----------------------------------------------------------|     ,---.     |---------------|
     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|End|PgD|Dow|Shift     |     |PgU|     |MwL|McD|MwR|   |
     * |-----------------------------------------------------------| ,-----------. |-----------|Mb3|
     * |Ctrl |Gui |Alt |         Space           |     |    |      | |Hom|PgD|End| |    Mb1|Mb2|   |
     * `-----------------------------------------------------------' `-----------' `---------------'
     */

Offline signet

  • Posts: 8
ADB to USB keyboard converter for Teensy
« Reply #77 on: Mon, 18 June 2012, 01:20:28 »
Wow! Thank you very much.  I have grabbed the source code off GitHub and I'll build it after I finish work today.  It is good that Japan and Australia are almost in the same time zone :)  

I have noticed two strangenesses with the behaviour of the keyboard which I hope to understand better in due time.

1. At seemingly random times when typing fast a nonsense character is sometimes generated.
2. When I restart my computer (i.e. power is not cycled) the keyboard is working OK at the bootloader (I can enter commands into the Chameleon boot loader) however when OSX comes up, more often than not the keyboard is outputting a stream of repeated characters.  If I then replug the USB things get back to normal after the controller reboots.

I suppose #1 could be an issue with the pullup resistor being weak, so I can substitute a 4k7 for the 10k I currently have on the ADB data line. It could also be a bit timing problem. Considering the LeoStick has the same system clock frequency as the Teensy 2.0 I any software delays spins would be the same.  I am pretty sure that the keyboard itself is OK because it works fine on my SE/30.

#2 I have no good idea yet. I can sometimes clear it by hitting any key, but usually it is necessary to unplug/plug the USB connection.

Anyway, thank you very much for the code update. I am looking forward to playing with it tonight.

Offline signet

  • Posts: 8
ADB to USB keyboard converter for Teensy
« Reply #78 on: Mon, 18 June 2012, 06:51:52 »
I now understand what you meant by the Leonardo boot loader being troublesome.  When I installed your firmware the other day, the board was brand new and it always jumped to its bootloader and stayed there.  This evening I have reset the damned thing countless times and have still not succeeded because of the short time window. My OSX computer is an i7950 (fast), yet I think the boot loader is timing out before AVRDude sees the /dev/tty.usbmodem1a11 usb device appear.

Offline signet

  • Posts: 8
ADB to USB keyboard converter for Teensy
« Reply #79 on: Mon, 18 June 2012, 07:36:44 »
Success! I told the LeoStick that I would smash it with a hammer if it didn't run the boot loader for me.  It obviously has ears, because the next time I tried it, it worked.

Your updated firmware works well. The function key layer switch via the power key is perfect. Thanks again. I changed a keymap entry to map the M0116 "Clear" key to DEL otherwise there is no way to generate a DEL code from those keyboards. The Clear code is not used by any OSX software that I use, and the key is adjacent to the Delete key (which generates destructive backspace in a M0116).

I will investigate the strange characters now.

Offline signet

  • Posts: 8
ADB to USB keyboard converter for Teensy
« Reply #80 on: Mon, 18 June 2012, 11:03:45 »
More success.  

I changed the pull up resistor from 10k to 4k7 and the random bad characters became much worse, consequently I removed the pull up completely and tested again. Perfect! I have been using the keyboard now for a few hours and there have been no corrupted characters.

I love this M0116 keyboard.  Last week, I was considering buying a silver conductive ink pen to repair the conductive trace on an old Microsoft Natural Elite whose ESC key had failed. For the same price as the conductive ink pen (A$29) I was able to buy the LeoStick and resurrect my favourite keyboard and have a load of fun in the process.

Thanks again.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
ADB to USB keyboard converter for Teensy
« Reply #81 on: Mon, 18 June 2012, 20:26:02 »
Weird. Pull-up resistor causes making worse signal from keyboard?
Umm, I guess USB voltage could be low if you use bus powered hub and connect some other device to it.
Anyway, it is nice to know some successes.

As for conductive pen, I have some experiences of it on IBM Model M's though I used a nickel pen.
It worked well on flat sheet part but not on folding or curved part. It tend to be brittle on such part after curing.
Instead I used conductive copper tape to patch trace lines. It looks very bad but works :)
http://geekhack.org/showwiki.php?title=Island:29483

Offline signet

  • Posts: 8
ADB to USB keyboard converter for Teensy
« Reply #82 on: Tue, 19 June 2012, 10:12:06 »
I thought it weird too, but it is working perfectly now.  I have not experienced any corrupted characters since removing the pull-up and I am not using a bus powered hub.

I considered copper tape, but the broken traces on the MS Elite keyboard are so thin I think it would be very difficult to apply it. I am not going to bother with the Elite keyboard now anyway, since I am so happy with the resurrected M0116.  

However, I think I have caught the keyboard disease. Now that I know how easy it is to make adapters. I used to be a mainframe system engineer, and remember from my time in Japan the wonderful keyboards on the NEC ACOS mainframe computers.  I think they were better than the IBM keyboards of the time (1980s). The absolute best keyboard I ever encountered were on Pertec XL40 data entry systems. Those keyboards had Honeywell Hall effect switches.  I doubt if it is possible to find any the of the XL40 keyboards now, but you might want to research the NEC keyboards. If you like keyboards you would certainly like them.

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
ADB to USB keyboard converter for Teensy
« Reply #83 on: Tue, 19 June 2012, 11:31:46 »
In the classified... Honeywell Hall effect keypads.  In case you want a taste  ;)
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline retroboy12

  • Posts: 2
Re: ADB to USB keyboard converter for Teensy
« Reply #84 on: Sun, 29 July 2012, 04:32:29 »
Github link isn't working? error 404

Offline retroboy12

  • Posts: 2
Re: ADB to USB keyboard converter for Teensy
« Reply #85 on: Sun, 29 July 2012, 04:56:01 »
ok Github working but this link dead http://geekhack.org/showwiki.php?title=Island:14290 (no input file)

Offline stratmaster458

  • Posts: 3
  • Location: USA
Re: ADB to USB keyboard converter for Teensy
« Reply #86 on: Mon, 30 July 2012, 12:39:33 »
Hello. I have been using this mod for quite some time however I have been experiencing the following problems under Mac OS X:
- Caps lock randomly engages when the switch is not clicked
- Some times a type key gets held down
- sometimes key combinations get held down and stuck
- sometimes the keyboard becomes unresponsive and needs to be unplugged.
- Somethings random characters appear instead of the keys that I press I have to unplug the keyboard to fix this.


Important note: this mod works 100% with no problems what so ever under Windows 7 Ultimate x64

Any ideas? Has the firmware been updated since early June?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter for Teensy
« Reply #87 on: Tue, 31 July 2012, 06:16:13 »
What is revision of firmware?
Recently I've tweaked code drastically to support LUFA stack. This may cause your problems.

Can you try this revision?(225de7a847a511d004bf909b1334e19497cf2f9d)
which should not be affected with that late fix. I think this will work with OSX.

Offline stratmaster458

  • Posts: 3
  • Location: USA
Re: ADB to USB keyboard converter for Teensy
« Reply #88 on: Tue, 31 July 2012, 21:47:41 »
What is revision of firmware?
Recently I've tweaked code drastically to support LUFA stack. This may cause your problems.

Can you try this revision?(225de7a847a511d004bf909b1334e19497cf2f9d)
which should not be affected with that late fix. I think this will work with OSX.

Can you provide me a link for the latest .hex ?

Offline drop1410

  • Posts: 1
Re: ADB to USB keyboard converter for Teensy
« Reply #89 on: Fri, 07 September 2012, 09:41:09 »
Hello guys, I'm new here (from Barcelona city in Spain). Well I got a quite new Apple Adjustable keyboard model... and before to buy (also hard to find) iMate adapter I was shocked about this adapter (also love the internal hacking with the mini-sub port). The problem is... I don't have experience with soldering or electronic components :-(... would you able to build one of these converters for me? would be really appreciate it, please let me know how much will cost + shipping costs. Again I have no idea about how to build one of these converters :-(.

You could send me an email to: drop@drop1410.com

I would want to use this keyboard with my mac book pro computer.

Let me know!

Thanks!


The upper solution could solve almost multiple key stroke problem but not all.

By setting USB device as low speed device, this problem could be solved.(I didn't tried)

I made USB controller for Apple desktop bus keyboard(IIgs) with Teensy++2.0 and this multiple key stroke problem exists also. I tried in many ways but I couldn't find what is wrong but I could expect there is some timing issue between USB host and firmware. As a work around, by setting this controller as low speed device this problem has gone.

Here is my work picture
Show Image


Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter for Teensy
« Reply #90 on: Thu, 20 September 2012, 21:15:54 »
I tried this again yesterday after long interval and found a severe problem of random key stuck.
The converter occasionally misses ADB signal and reads wrong bit, this causes registering wrong key and key stuck.

I pushed ad hoc fix for this problem into the source repository minute ago. This fix doesn't cure the bug completely though mitigates greatly. If you experienced the problem try the latest source.

Offline blargg

  • Posts: 45
    • My github
Re: ADB to USB keyboard converter for Teensy
« Reply #91 on: Mon, 15 October 2012, 00:30:08 »
I updated my Teensy to the latest version a couple of days ago and it seems better than an earlier version. I've noticed one sequence that seems to stress it: <space>|<space> (something I often type when piping the output of one command to another, e.g. bla bla | cut ...). It often puts the spaces together and the | after them. I notice that when I type the |, there's an odd delay.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter for Teensy
« Reply #92 on: Mon, 15 October 2012, 04:02:14 »
My personal keymap was committed accidentally. Now I reverted its keymap to plain vanilla one.
Try the latest source.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter for Teensy
« Reply #93 on: Tue, 04 December 2012, 08:51:23 »
Currently my ADB converter has this unsolved issue: https://github.com/tmk/tmk_keyboard/issues/14
Work around is using old repository commit:33d58c2b5647623d2b.

I'll work on this issue later and post here when the issue is resolved.

Offline tufty

  • Posts: 347
  • Location: French Alps
Re: ADB to USB keyboard converter for Teensy
« Reply #94 on: Tue, 04 December 2012, 13:18:57 »
Currently my ADB converter has this unsolved issue: https://github.com/tmk/tmk_keyboard/issues/14
Work around is using old repository commit:33d58c2b5647623d2b.

I'll work on this issue later and post here when the issue is resolved.
I had a look, it seems likely to be caused by the state machine stuff in common/keyboard.c - if this is taking a significant amount of time, the ADB layer will miss incoming events.  I've noticed occasional missed keys even with the previous versions (although I had put them down to typing fast on a heavily used 25 year old keyboard).

It seems to me that, rather than polling the bus directly, the adb reading code might be better off moved to an interrupt handler similar to the way Bernard has implemented adb handling in Waxbee (see http://code.google.com/p/waxbee/source/browse/WaxB_Adb2Usb/adb_codec.cpp).

Simon

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter for Teensy
« Reply #95 on: Tue, 04 December 2012, 23:07:21 »
Thanks for the info.

It looks like better than poling but it still seems to be interrupted by USB task. To avoid this completely we may need to use pin change interrupt which has higher priority than those tasks. I'll look into his code and AVR datasheet later.
And my code does not handle 'Service Request' properly, this also might cause problem.

Anyway it'll take some time to implement those method.

Offline tufty

  • Posts: 347
  • Location: French Alps
Re: ADB to USB keyboard converter for Teensy
« Reply #96 on: Wed, 05 December 2012, 11:09:21 »
Thanks for the info.

It looks like better than poling but it still seems to be interrupted by USB task. To avoid this completely we may need to use pin change interrupt which has higher priority than those tasks. I'll look into his code and AVR datasheet later.
And my code does not handle 'Service Request' properly, this also might cause problem.

Anyway it'll take some time to implement those method.
Occasional interruptions by the USB task shouldn't be a problem - Waxbee handles ADB wacom tablets without a hitch (and without dropping packets), and they push the ADB "spec" well past its limits.  Ideally, yes, you probably want to be giving top priority to handling ADB bits, though.  If I get a chance I'll have a look to see if I can convert Bernard's approach. It shouldn't be too hard, but winter has just arrived, we've had 1.5m of snow over the last 2 days, I'm supposed to start driving my chairlift on Friday, and I need to redo the plumbing in the bathroom tomorrow before we start getting -20c.  And if I get a chance, I'd like to wax and do the edges on my snowboards and the skwal.  So many things to do, so little time.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter for Teensy
« Reply #97 on: Wed, 05 December 2012, 19:32:01 »
Winter looks like fun there.
I can understand. Life is too short to kill time for the keyboard thing.
Enjoy your winter life and snow!

Offline blargg

  • Posts: 45
    • My github
Re: ADB to USB keyboard converter for Teensy
« Reply #98 on: Mon, 10 December 2012, 23:24:06 »
I've been needing the right control/Alt/etc. keys for Linux programs which give these special meanings. I read in the ADB tech note (untold story) that the keyboard's handler ID can be changed from 2 to 3, causing it give distinct codes for left and right modifiers. This would be a really useful fix.

...well, that went smoothly on the first try. I just implemented the above on the latest source. I've atteched the patch (I'm not familiar enough with git to submit it myself, sorry). Currently it only sets the keyboard device handler to 3 on USB init, so if you unplug the ADB and plug it back into the keyboard, right modifiers won't be differentiated until you unplug and plug ADB back in. I broke out an adb_host_listen() function since it has the same guts as used by the led-setting function and my device handler setting in matrix_init().

Note that even with this, the Extended Keyboard II (and maybe all the others) still don't differentiate between left and right Command (Alt), so that both are reported as the left one. :(
« Last Edit: Tue, 11 December 2012, 00:47:21 by blargg »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: ADB to USB keyboard converter for Teensy
« Reply #99 on: Tue, 11 December 2012, 08:21:55 »
Great! Thanks for your contribution, blargg.
I'll merge your patch later.

I found this feature in old Apple document the other day but it had been on my TODO list for some time. You greatly saved my time.

I've been needing the right control/Alt/etc. keys for Linux programs which give these special meanings. I read in the ADB tech note (untold story) that the keyboard's handler ID can be changed from 2 to 3, causing it give distinct codes for left and right modifiers. This would be a really useful fix.
Yes, absolutely useful.


Quote
Note that even with this, the Extended Keyboard II (and maybe all the others) still don't differentiate between left and right Command (Alt), so that both are reported as the left one. :(
Ah, shame :(