geekhack

geekhack Projects => Making Stuff Together! => Topic started by: hasu on Wed, 12 January 2011, 11:53:40

Title: ADB to USB keyboard converter
Post by: hasu on Wed, 12 January 2011, 11:53:40
I needed a ADB to USB keyboard converter to test a feel of ADB keyboards on actual usage. After 2days coding and several hours debug, I made this converter based on my keyboard firmware. If you are interested in ADB keyboard converter, try this.

(http://i.imgur.com/iLMqfslh.jpg)

You can buy preassembled TMK ADB-USB converter here (https://geekhack.org/index.php?topic=72052.0)


Keymap Editor
You can edit keymap and download firmware with web browser.

TMK ADB-USB converter rev2(ATMega32u2) (http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb)
TMK ADB-USB converter rev1 and converter with Teensy2.0 or ProMicro(ATMega32u4) (http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1)

In the Keymap Editor physical key layout is based on Apple Extended Keyboard(AEK) but you can edit keymap of any other ADB keyboards.  For example when you want to edit arrow keys on M0116 you can just change them on the Keymap Editor. The key layout of M0116 is physically different but logically identical to AEK.


README FIRST
https://github.com/tmk/tmk_keyboard
https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb

and optionally,
https://github.com/tmk/tmk_keyboard/wiki
https://github.com/tmk/tmk_keyboard/labels/NOTE


NEED HELP: Your self-made converter doesn't work?

Don't ask help before trying pull-up resistor(1K Ohm) and trying solder on J1!

You are cheap and got Pro Micro from unreliable source, instead of Sparkfun? OK, but confirm it has 16MHz crystal. And probably you need to fill solder on jumper J1 to feed keyboard good power supply 5V if you are in trouble and J1 is not soldered yet. See this post (https://geekhack.org/index.php?topic=96236.msg2625899#msg2625899) and schematic (http://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/Pro_Micro_v13b.pdf).

In most cases your wiring is wrong. Check your wiring yourself again and again, one hundred times! And try swapping wires at your own risk, note that your wiring are already wrong at this point probably :D It won't break your keyboard unless you are extremely unlucky.

Now you need help? OK. If you are not sure about your wiring, post pics of your hardware and wriring this really save our time. Don't save your time by omitting this. Shots of controller side and ADB connector/keyboard side would be helpful. If you edit code post your code. Don't hesitate to show your dirty code! Also output from hid_listen command would be useful to debug hardware and firmware.

[rant]
Many people said they are sure their wiring was fine first but it became clear they failed to do that in the end many times in this thread :( Don't omit pull-up resistor with your laziness, you better have it absolutely.
Don't take advantage of generosity of kind and helpful members(yes, including me, of course  ;))! Their time is more precious than your time, use your time to learn and look into your problem first.
[/rant]



DEBUG
You can use hid_listen (https://github.com/tmk/tmk_keyboard/wiki#hid_listen) to see debug prints.

Debut Outputs
RRR
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.



UPDATE
2012/12/12 Extended keyboard support by blargg (https://geekhack.org/index.php?topic=14290.msg736664#msg736664)
2013/04/08 Fix issue: ADB-USB converter misses keystrokes (NOT FIXED COMPLETELY)
2013/07/22 Changed Pin usage: PD0, NOT PF0 now
2013/10/11 WIP: Fix ADB-USB converter misses keystrokes
2013/11/28 Fix key drop problem finally Thank you, blargg!
2015/04/28 Mouse is supported by mek-apelsin (https://github.com/tmk/tmk_keyboard/pull/207)
2015/12/18 Request for help: extended mouse support
2016/06/04 Added LIMITATION section
2016/06/04 Apple Adjustable Keyboard media keys are supported now
2016/09/03 Keymap editor(unimap) is available now
2018/01/19 Fix lag problem (https://geekhack.org/index.php?topic=14290.msg2549648#msg2549648) on ADB-USB converter
2019/06/23 Added Apple Extended Mouse Protocol and Kensignton Turbo Mouse support
2020-02-13 Updated firmware to fix AEK support
2021-01-24 Change default mapping for 'keypad ='

LIMITATION
- Hotplug/Hotswap of keyboard (https://github.com/tmk/tmk_keyboard/issues/671) is not fully supported, you will have to connect keyboard with the converter first, then plug-in USB port. You can hotplug/hotswap mouse, though.




SOURCE CODE
https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb (https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb)


BUILD FIRMWARE
https://github.com/tmk/tmk_keyboard/blob/master/doc/build.md

Use 'make' to build firmware for TMK ADB-USB converter rev.2.
Use 'make -f Makefile.rev1' to build firmware for TMK ADB-USB converter rev.1, Teensy2.0 or Pro Micro.

You are recommended to use Keymap Editor above, instead build yourself.


BUILD CONVERTER YOURSELF
You can use PJRC Teensy or other dev board with ATMega32U4/2.

Code: [Select]
ADB female socket from the front:
  ,--_--.                 
 / o4 3o \      1: DATA
| o2   1o |     2: Power SW
 -  ===  -      3: VCC
  `-___-'       4: GND

Connect keyboard DATA line to PD0(Pin3 on Pro Micro),  VCC to 5V(VCC on Pro Micro, not RAW) and GND as well. Power SW is not used.


pull-up resistor
You must have an external pull-up resistor(1K Ohm) between VCC(5V) and DATA(PD0) line.

1K ohm is strongly recommended.
You may use 4.7K, 10K or any of 1K-10K Ohm resister, if you don't have 1K in hand. It won't work with longer curled cable or daisy-chained multiple devices.  See this issue. https://github.com/tmk/tmk_keyboard/issues/683

Code: [Select]
Keyboard       Conveter
               ,------.
VCC---------+--|VCC   |
            |  |      |
            R  |      |
            |  |      |
DATA--------+--|PD0   |
               |      |
GND------------|GND   |
               `------'

R: 1K Ohm resistor
https://github.com/tmk/tmk_keyboard/wiki/FAQ#pull-up-resistor





AEK left/right modifiers discrimination, ISO layout and Adjustable keyboard media keys
To use these features you have to connect keyboard to the converter first before plug-in USB port.
Keyboard initilization needed for the features occurs only when the converter powers up with current firmware.

On ADB Standard keyboards left and right corresponding modifiers are logically indentical and can not be discriminated one another by the converter. This is ADB keyboard limitation, not converter's.
Apple Extended keyboard can discriminate them except for 'Command' key.



ISO keys
The ISO keys are supported. To let the converter recognize ISO layout correctly see above.

iMate and uKey have problem on some keys reportedly.
https://geekhack.org/index.php?topic=4185.msg61270#msg61270
https://github.com/randyrants/sharpkeys/issues/225#issue-537872871


Power key
In default configuration Power key works as 'Magic command' trigger key when it is held, or as Power when tapping.
https://github.com/tmk/tmk_keyboard#magic-commands

You may need to change thse line in config.h if 'Magic command' interferes with your keymap.
https://github.com/tmk/tmk_keyboard/blob/7b31d1b9d9f0d9c7d1e4b553e583381552cd8778/converter/adb_usb/config.h#L54-L57


Keypad =
The key is assigned to keycode 'EQL'(usual equal) on default keymap.

Note that keycode 'PEQL'(keypad equal) works on Linux and MacOS but doesn't on Windows. If you are on Windows you will need to use 'EQL'.



Locking CapsLock
Many of old ADB keyboards have mechanically locking switch for Caps lock and TMK supports them.
https://github.com/tmk/tmk_keyboard#mechanical-locking-support

Or you may want to remove locking pin from the push-lock switch to use it as a normal momentary switch.
http://www.youtube.com/watch?v=9wqnt2mGJ2Y (http://www.youtube.com/watch?v=9wqnt2mGJ2Y)

Caps lock key of Apple adjustable keyboard is not mechanical locking switch but it emulates locking switch behaviour. You will have problem when using the key as control, for example.


ADB protocol Resource
This is code for ADB protocol:
https://github.com/tmk/tmk_core/blob/master/protocol/adb.c#L301-L478



Extended mouse protocol support
- Kensington Turbo Mouse 5(by hasu)

Do you have other multiple button mouse to support? Check this issue on github and ask help in this thread.
https://github.com/tmk/tmk_keyboard/issues/274



TESTED DEVICES
- Apple Extended Keyboard M0115
- Apple Extended Keyboard II M3501
- Apple Standard Keyboard M0116, M0118
- Apple Adjustable Keyboard M1242
- Apple Desktop Bus Keyboard(Apple II GS Keyboard) 658-4081

- Apple Desktop Bus Mouse G5431(Taiwan)
- Apple Desktop Bus Mouse II M2706(Taiwan)
- Kensington Turbo Mouse 5 #64210


ISSUES
- Apple Desktop Bus Mouse II(M2706) assembled in Ireland doesn't work due to initialization failure. Meanwhile, M2706 assembled in Taiwan works.
https://geekhack.org/index.php?topic=14290.msg2873443#msg2873443
https://geekhack.org/index.php?topic=14290.msg2875515#msg2875515


OLD STUFF:
More
Anyway pull-up resistor is a must-have.
https://github.com/tmk/tmk_keyboard/issues/249


Key drop problem[SOLVED]
https://geekhack.org/index.php?topic=14290.msg1064567#msg1064567 (https://geekhack.org/index.php?topic=14290.msg1064567#msg1064567)

Finally this was fixed due to blargg's contribution. 2013/11/28
https://geekhack.org/index.php?topic=14290.msg1134847#msg1134847
https://github.com/tmk/tmk_keyboard/pull/80
https://github.com/tmk/tmk_keyboard/issues/14


LIMITATION
- Apple adjustable keyboard keypad is not confirmed yet. Not sure if it works or not at this time. Confirmed finally!(2018 Dec) (https://geekhack.org/index.php?topic=14290.msg2687944#msg2687944)





Title: ADB to USB keyboard converter for Teensy
Post by: lowpoly on Fri, 14 January 2011, 04:51:53
Hah, great.

Strange nobody replied. I thought the Griffin iMate was hard to get (http://geekhack.org/showthread.php?t=11839) these days. The mod forum should have a better place in the forum overview, IMO.

Also, the iMate had issues with intl. 'boards.

So, Colemak converter for ps/2 'boards next? :-)
Title: ADB to USB keyboard converter for Teensy
Post by: Soarer on Fri, 14 January 2011, 06:20:26
Neat. :)

I would like to add ADB support to my adapter in the future, but I have lots of other tasks to complete first! One of them is implementing a key remapping UI ;)

And I recently bought a couple of the Belkin ADB adapters, which work ok, at least on US layout. But it seems they are not generally available either :/
Title: ADB to USB keyboard converter for Teensy
Post by: Findecanor on Fri, 14 January 2011, 06:57:32
Superb! How does it handle latching Caps Lock, though?
Title: ADB to USB keyboard converter for Teensy
Post by: iMav on Fri, 14 January 2011, 07:26:10
Great job!  Love seeing this type of stuff.  How many days have you lost with your head down programming that teensy?  ;)

I may just have to pick up one of these and start playing as well.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Sat, 15 January 2011, 01:08:18
Quote from: Findecanor;278417
Superb! How does it handle latching Caps Lock, though?


It doesn't nothing actually now.
At this time you must remove lock pin form the ALPS or replace with normal switch :)
Or if you don't care about Caps LED, you can remap to Shift.
Title: ADB to USB keyboard converter for Teensy
Post by: kps on Sat, 15 January 2011, 12:12:08
Hasu, would you mind posting your hex file? I am trying to figure out what stupid thing I have done, since I see no keystrokes. The device is recognized as a keyboard, so I know it has been programmed correctly. I have tried two different computers, three different keyboards, and double-checked my wiring.
(http://geekhack.org/attachment.php?attachmentid=14855&stc=1&d=1295114914)

Quote from: hasu;278881
It doesn't nothing actually now.
At this time you must remove lock pin form the ALPS or replace with normal switch :)
Or if you don't care about Caps LED, you can remap to Shift.


This part should be simple; there is a specific USB code for locking Caps keys — 130 rather than 57.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Sat, 15 January 2011, 23:05:37
Quote from: kps;279038
Hasu, would you mind posting your hex file? I am trying to figure out what stupid thing I have done, since I see no keystrokes. The device is recognized as a keyboard, so I know it has been programmed correctly. I have tried two different computers, three different keyboards, and double-checked my wiring.

No, I don't mind at all.

Regarding your wiring, it seems to be OK but you may need to check ADB socket side again.
Following is my ADB socket pinouts, but I think yours is same as mine.

Code: [Select]

    Female socket from the front
    __________
    |        | <--- top
    | 4o  o3 |
    |2o    o1|
    |   ==   |
    |________| <--- bottom
      |    |   <--- 4pins

    Female socket from bottom

    ========== <--- front
    |        |
    |        |
    |2o    o1|
    |4o    o3|
    ---------- <--- back

    1: Data
    2: Power SW(low when press Power key)
    3: Vcc(5V)
    4: GND


   

Quote

This part should be simple; there is a specific USB code for locking Caps keys — 130 rather than 57.


Thank you. I will try the keycode and fix my code.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Sun, 16 January 2011, 00:04:22
I tried the "Locking Caps Lock"(0x82) instead of Caps Lock(0x39) in Windows and it failed to handle the key. I didn't check it on other OSes, but Windows fails at least.

Windows has no translation table for "Locking Caps Lock", thus we can use the key unfortunately :(

See this document for details:
http://www.microsoft.com/whdc/archive/scancode.mspx
Title: ADB to USB keyboard converter for Teensy
Post by: Soarer on Sun, 16 January 2011, 07:38:31
That's a messy problem :(

I suppose the only solution is to send two packets for each change in state of the caps lock - one with the key down, and then one with the key up a millisecond or so later.

That appears to be how the Belkin adapter handles it.

What a hassle though!
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Sun, 16 January 2011, 08:17:58
Quote from: hasu;279286
No, I don't mind at all.

kps,
I misinterpreted your first sentence :)
Sorry. I attached my hex.



Quote from: Soarer;279367
That's a messy problem :(

I suppose the only solution is to send two packets for each change in state of the caps lock - one with the key down, and then one with the key up a millisecond or so later.

That appears to be how the Belkin adapter handles it.

What a hassle though!


Belkin solution will be a problem for someone who want to remap the key.
But it may be good for most people.

I prefer switch conversion solution though it is not for everyone.
Title: ADB to USB keyboard converter for Teensy
Post by: Soarer on Sun, 16 January 2011, 08:32:14
Quote from: hasu;279388
Belkin solution will be a problem for someone who want to remap the key.
But it may be good for most people.

I prefer switch conversion solution though it is not for everyone.


Yes, that would be better.

But... I have a Macally MK96, and it already has a non-locking switch for caps lock! Its keyboard firmware must simulate the locking action, I guess. I don't know how many other ADB keyboards do a similar thing, but the only way to get a normal key action with them would be to replace the keyboard controller (which is what I will do :) ).
Title: ADB to USB keyboard converter for Teensy
Post by: kps on Sun, 16 January 2011, 12:33:21
Quote from: hasu;279388
kps, I misinterpreted your first sentence :)


Sorry, my fault for using idiomatic English.

Thank you; that has helped me narrow down my problem somewhat.

I hacked in some ugly code to send a Shift directly when the power key is pressed, and that worked. With a logic probe, I see "chatter" on the ADB line on the other port of the keyboard, so I think my connections are sound. I suspect my problem may be either noise or timing related, since (by using the LED on the Teensy) it seems I never get past the if (read_bit()) // Stopbit(0) in adb_host_kbd_recv().
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Mon, 17 January 2011, 09:38:47
Quote from: kps;279449

I hacked in some ugly code to send a Shift directly when the power key is pressed, and that worked. With a logic probe, I see "chatter" on the ADB line on the other port of the keyboard, so I think my connections are sound. I suspect my problem may be either noise or timing related, since (by using the LED on the Teensy) it seems I never get past the if (read_bit()) // Stopbit(0) in adb_host_kbd_recv().



My code is very primitive and have not been checked its signal conformity
by logic analyzer nor oscilloscope, thus it could lose the sync under some circumstances.

Another possibility I come up with is  port damage of your Teensy.
My Teensy actually lost one port by latch-up while prototyping/debug :)
If your DATA line port is suspicious, you should try another port.
Title: ADB to USB keyboard converter for Teensy
Post by: kps on Mon, 17 January 2011, 10:52:09
Quote from: hasu;279835
My code is very primitive and have not been checked its signal conformity by logic analyzer nor oscilloscope, thus it could lose the sync under some circumstances.


I may get out those tools next weekend. My logic analyzer is ancient (HP1615A, 1979) but should be adequate for ADB.

Quote
Another possibility I come up with is  port damage of your Teensy.
My Teensy actually lost one port by latch-up while prototyping/debug :)
If your DATA line port is suspicious, you should try another port.


I don't think that is the case, but I will check.

I do own an iMate, so this is not vital to me, but it might help other people later.

Later, I want to try using one of the cheap PS3 dongles with an AT90USB162. That, plus half an s-video cable, would make an ADB converter for under $10.
Title: ADB to USB keyboard converter for Teensy
Post by: jeffreysung on Fri, 11 February 2011, 02:30:41
(http://cfile2.uf.tistory.com/image/136B413E4D54D5661D5B8B)
This week I got Teensy++ 2.0 and tried. As a result I found problems.

1. If ADB cabe is long, OSX couldn't detect keyboard. (In fact, it does but couldn't detect any key strokes) I have short cable which is included in Apple adjustable keyboard and three other normal cables. Short cable works good but others not.
2. key stroke is recognized multiple time.

These problems (I Think) caused by my environment...

I changed adb/config.h (I moved port and bit)

#define ADB_PORT        PORTB
#define ADB_PIN         PINB
#define ADB_DDR         DDRB
#define ADB_DATA_BIT    6
#define ADB_PSW_BIT     5       // optional

I should change ADB_DDR/ADB_PIN as above right ?
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Sat, 12 February 2011, 03:03:55
jeffreysung,
Thank you for your reporting!
I don't use this converter daily, so it is still very immature.
But I am happy to improve this project, any feedback is welcome.

Quote from: jeffreysung;293270

This week I got Teensy++ 2.0 and tried. As a result I found problems.

1. If ADB cabe is long, OSX couldn't detect keyboard. (In fact, it does but couldn't detect any key strokes) I have short cable which is included in Apple adjustable keyboard and three other normal cables. Short cable works good but others not.
2. key stroke is recognized multiple time.

These problems (I Think) caused by my environment...

My code(adb.c) which process ADB signal is very primitive. It use polling & delay method to check the DATA line activity, while it should use interrupt routine.  I think it is prone to lose sync with keyboard under some condition(signal with loose edge or interference by other interrupt code). This perhaps causes your problems.

I will rewrite adb.c using pin chajnge interrupt at an early day.


Quote

I changed adb/config.h (I moved port and bit)

#define ADB_PORT        PORTB
#define ADB_PIN         PINB
#define ADB_DDR         DDRB
#define ADB_DATA_BIT    6
#define ADB_PSW_BIT     5       // optional

I should change ADB_DDR/ADB_PIN as above right ?

You are right. It is OK to use PB6.
Title: ADB to USB keyboard converter for Teensy
Post by: kps on Sat, 12 February 2011, 12:56:17
Quote from: jeffreysung;293270
1. If ADB cabe is long, OSX couldn't detect keyboard.


Ah. I just tried this. (Last time I used a normal coiled ADB cable.)  I made a 3-inch cable from an S-video cable. With this, a IIgs keyboard worked (except for the duplicates) and an Extended partly worked.

Then I did a little searching and found a PIC application note (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011062) on ADB. Based on that, I added a pullup to the ADB data line. With the pullup, both keyboards work, even with a long cable.
Title: ADB to USB keyboard converter for Teensy
Post by: jeffreysung on Sat, 12 February 2011, 19:50:21
Quote from: kps;294046
Ah. I just tried this. (Last time I used a normal coiled ADB cable.)  I made a 3-inch cable from an S-video cable. With this, a IIgs keyboard worked (except for the duplicates) and an Extended partly worked.

Then I did a little searching and found a PIC application note (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en011062) on ADB. Based on that, I added a pullup to the ADB data line. With the pullup, both keyboards work, even with a long cable.


ATMEL supports (maybe) both pull up/down. This could be very useful in weak signal but pull up/down is a little bit slow compared to normal signaling. Thanks for useful info.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Sun, 13 February 2011, 03:02:09
kps,

I confirmed the problem on coiled cable, and pull-up resistor solved it.  With coiled cable the converter couldn't get signal from keyboard and  didn't recognize any key stroke. I couldn't see the key duplicate  problem.

AVR's internal pull-up seems to be too weak to communicate with ADB  keyboards, we may need external pull-up resistor instead in many case  though some cable including my  straight cable doesn't need it.

Thanks.

My pull-up resistor:
(http://i.imgur.com/6jcvBl.jpg)
Title: ADB to USB keyboard converter for Teensy
Post by: jeffreysung on Mon, 14 February 2011, 01:36:39
Quote from: hasu;294316
kps,


AVR's internal pull-up seems to be too weak to communicate with ADB  keyboards, we may need external pull-up resistor instead in many case  though some cable including my  straight cable doesn't need it.


It is the other around.

There is internal pull-up resistor inside and if you add resistor outside pin, total resistance goes down(1/Rt = 1/Rin + 1/Rout) and this could explain why coiled or long cable couldn't work with.
The ADB cable is like a attenuator and because of internal (big) pull up resistor, signal couldn't swing between +5V and 0V properly (means couldn't go down to ground level).

By adding a external resistor, total pull up resistance goes down, and signal could swing more properly.
Title: ADB to USB keyboard converter for Teensy
Post by: Soarer on Mon, 14 February 2011, 08:24:19
Partly, you are saying the same thing: a big resistor = a weak pull-up.

But the voltage range of the signal is not affected. The capacitance of the cable makes the signal slow to rise from 0V to +V, since that capacitance has to charge up via the pull-up resistor.
Title: ADB to USB keyboard converter for Teensy
Post by: jeffreysung on Tue, 15 February 2011, 22:24:30
I fount a strange thing.

Up to now, I tested this board with my macbookpro/iMac. It always shows multiple stroke from time to time. When I connected to Windows PC, there is no multiple strokes.

Is there anybody who tried with Mac ?
Title: ADB to USB keyboard converter for Teensy
Post by: Soarer on Wed, 16 February 2011, 09:07:40
I played around with external pull-up resistors on my PS2 adapter (the principle is the same).

This is with about 5m of cable in all, so pretty much a worst case scenario.

Internal pull-up:

[attachimg=1]

External 2k2 pull-up - better, but still a bit slow to rise and a fair bit of crosstalk between the clock and data signals:

[attachimg=2]

External 1k pull-up - seems to be the sweet spot, much cleaner signals in every respect:

[attachimg=3]

I think it affects the ADB adapter more because the timing is critical - if you have a slow rise on the signal it moves the switching point in time.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Wed, 16 February 2011, 22:55:18
jeffreysung,
hmm, it is a weird behaviour.  I can't come up with the cause now and I have no healthy mac to try:(

Soarer,
It is nice to see real wave forms!
I have ordered my first oscilloscope a few days ago. I can hardly wait for my Rigol :)
Title: ADB to USB keyboard converter for Teensy
Post by: Soarer on Thu, 17 February 2011, 06:40:34
Excellent! I don't know how I managed before I got my 'scope :-)

I have just ordered my first logic analyzer (although a cheap one!), an Open Workbench Logic Sniffer (http://www.seeedstudio.com/depot/open-workbench-logic-sniffer-p-612.html). So, similar suspense here :-)
Title: ADB to USB keyboard converter for Teensy
Post by: jeffreysung on Wed, 23 February 2011, 00:49:40
Multiple key stroke problem solved.

in adb/matrix.c

just add delay statement before if (codes == 0 ) {

like this.

    key0 = codes>>8;
    key1 = codes&0xFF;

   _delay_us(300);
    if (codes == 0) {                           // no keys
        return 0;
    } else if (key0 == 0xFF && key1 != 0xFF) {  // error
 


I found this problem in making USB controller for Apple Desktop Bus Keyboard(a.k.a. IIgs keyboard).

Why 300us ? This is experimental value. I tried from 250us to 500us and 300us is the most stable value.
(With 300us, there is little multiple stroke issue.)

and I don't know why this problem is occurred only with OSX. : (
Title: ADB to USB keyboard converter for Teensy
Post by: jeffreysung on Thu, 03 March 2011, 21:06:40
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
(http://cfile7.uf.tistory.com/image/1947915A4D651B381E3C0D)
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Fri, 04 March 2011, 09:01:14
jeffreysung (http://geekhack.org/member.php?u=7649),
Nice USB receptacle setting!


Your problem is not bouncing. right?
I have not experienced the multiple key stroke problem. I tried AEKII, m0116 and some Macways, but it was not a long time use.
Unfortunately I have no IIgs to try. (It is one of keyboards I want to own! :)

Do you have other ADB keyboard than IIgs?
I want to know whether the problem is specific to IIgs or not.

Do you have iMate or other converter?
I want to know whether the problem is caused by my converter or not.
Title: ADB to USB keyboard converter for Teensy
Post by: kps on Fri, 04 March 2011, 09:17:19
Quote from: hasu;304861
Do you have other ADB keyboard than IIgs?
I want to know whether the problem is specific to IIgs or not.


I do have most models of Apple ADB keyboard, including the IIgs. I will test several this weekend.

Quote
Do you have iMate or other converter?
I want to know whether the problem is caused by my converter or not.


I have an iMate, and have never seen duplicate keys with it.
Title: ADB to USB keyboard converter for Teensy
Post by: kps on Sun, 06 March 2011, 10:24:02
I have tried several different keyboards, and got duplicate key reports with all of them.

Quote
TThis is an  Apple  Desktop Bus keyboard, modell A9M0330.
This  is ann Apple Keyboardd,  model  M0116.
This is a squishy Apple Keyboard II,  mmodel  MM0487..
This  is  ann Apple   Extended  Keyboard,, model M0115.
TThis  is an  Appple Extennded Keyboard  II, mmodel M3501.
Thhis is an Applle Adjustable Keyboard, modell MM1242.
Title: ADB to USB keyboard converter for Teensy
Post by: woody on Sun, 06 March 2011, 11:36:39
kps, do you happen to have extra A9M0330 for sale?
Title: ADB to USB keyboard converter for Teensy
Post by: jeffreysung on Sun, 06 March 2011, 20:12:10
Quote from: hasu;304861
jeffreysung (http://geekhack.org/member.php?u=7649),
Nice USB receptacle setting!


Your problem is not bouncing. right?
I have not experienced the multiple key stroke problem. I tried AEKII, m0116 and some Macways, but it was not a long time use.
Unfortunately I have no IIgs to try. (It is one of keyboards I want to own! :)

Do you have other ADB keyboard than IIgs?
I want to know whether the problem is specific to IIgs or not.

Do you have iMate or other converter?
I want to know whether the problem is caused by my converter or not.

1.I have two "2 adb to usb" converters and there is no problems with these.
2.I have AEKII/IIgs/Design/Adjustable keyboards and all the same problem with converter.
3.I think there is a different in handling USB interrupt between OSX and Windows. Windows doesn't have problem.
4.If I set teensy( ++ 2.0) as low speed device, this multiple stroke problem is gone. There should be a timing mismatch between this firmware and OSX.
   a. As I wrote before, if I insert delay in keyscan function, the occurrence of this multiple stroke reduced.
   b. If I set as low speed device, USB interrupt/FIFO speed would go lower and this prevent our problem.
   c. With low speed device setting, USB debugging has some problem. It it too low to print debug information on screen.


To set Teensy++ 2.0 as low speed device, you should modify some functions and headers.

usb.c, usb_init
UDCON = 0; --> UDCON = 0x04;  (for Teensy++2.0, set LSM bit.)

usb_debyg.h
#define DEBUG_TX_SIZE 32 --> 8  (All endpoint size should be 8byte)

usb_keyboard.h
#define KDB2_SIZE 16 --> 8 (the same with above)
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Sun, 06 March 2011, 20:36:22
Quote from: kps;306178
I have tried several different keyboards, and got duplicate key reports with all of them.

Thanks.
It is on OS X? You see this problem on WIndows or Linux too?

I have no problem during 20-30min my daily usage. Hmm...
Disclosure: I am slow typer 40-50wpm.

I tried this attached firmware (http://geekhack.org/showpost.php?p=279388&postcount=10) on Teensy2.0 and latest firmware on Teensy2.0/Teensy++2.0. My pull-up resistor is 10K Ohm.

Cables: coiled cable and straight cable.
Keyboards: AEKII(M3501) and Apple keyboard(M0116)
OS: WIndows 7 64bit and Ubuntu 10.04


Quote
1.I have two "2 adb to usb" converters and there is no problems with these.
2.I have AEKII/IIgs/Design/Adjustable keyboards and all the same problem with converter.
3.I think there is a different in handling USB interrupt between OSX and Windows. Windows doesn't have problem.
Thanks, jeffreysung.
Finally, I understood that it is a problem specific to OS X.
Unfortunately I have no OSX to try :(

My USB stack(based on PJRC's code) seems to have some faults.
Title: ADB to USB keyboard converter for Teensy
Post by: kps on Mon, 07 March 2011, 09:12:12
Quote from: hasu;306544
It is on OS X? You see this problem on WIndows or Linux too?


It was OS X. I tried again on Windows (with an AEK) and saw two instances of doubled characters in a half page of text.

For my tests I was using yesterday's firmware (did a 'git pull' before testing), 10K pullups, and a 1m straight cable (half an S-video cable).

Quote
My USB stack(based on PJRC's code) seems to have some faults.


I am not sure that is so. I notice in my tests above that 12 of 14 doubles occur at the beginning or end of words. Obviously the software does not know about words, but my fingers do. I wonder whether the ADB keyboards might actually be sending a second event if the key is still down when it is polled again.
Title: ADB to USB keyboard converter for Teensy
Post by: jeffreysung on Mon, 07 March 2011, 11:26:04
Quote from: kps;306815

I am not sure that is so. I notice in my tests above that 12 of 14 doubles occur at the beginning or end of words. Obviously the software does not know about words, but my fingers do. I wonder whether the ADB keyboards might actually be sending a second event if the key is still down when it is polled again.


According to my test (USB controller directly attached to IIgs), this multiple stroke might be caused with interrupt handling. The source code looks good and USB interrupt handling functions are based on sample code of pjrc.com.

1. When I debugged adb adapter, key stroke scanning has no problem and USB report(data structure for sending keys to USB host) has no problem.
2. The problem is adb adapter has only one key data but it seems that USB host get the data multiple time.
3. This situation could be occurred if interrupt flag is handled wrong. Think about this. USB host requested to device for new data. Device had sent one data(right data). With some problem, device think there is more data in FIFO and send data at next request. (USB host search new data by polling devices)
4. I think that there could be a problems in key scan turn around time. The simplified actions of firmware is repeating this procedure "key scan - if there is modified key send it FIFO". In repeating this procedure, there should be some problems (especially interrupt handling).
5. In the case of USB controller(directly attached to IIgs), everything from keyscan to storing data to FIFO is perfect.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Tue, 08 March 2011, 00:20:18
After browse of some codes of Darwin, I found a clue of the problem.
OS X seems to request SET_IDLE(24ms) to keyboard, while Windows requests SET_IDLE(0ms). I think Linux also requests 0ms.

HID SET_IDLE request inhibits device to report keys during given interval if key state is not changed. 0ms means device must not report without change.
I assume this difference causes the problem appeared only in OS X.

Bug codes run only when idle interval runs out. On Windows and Linux the codes with bug never run, on the other hand the problem occasionally occurs on OS X.

This bug is very timing issue around interrupt handlers. I will fix this problem but it may take some time.



This is the codelet from Apple.
OS X requests 24ms on most keyboards, but 0ms on Apple's. why?
If I found right clue, changing VENDOR_ID to '0x05AC'(Apple) in config.h will disappear the problem.

http://www.opensource.apple.com/source/IOUSBFamily/IOUSBFamily-417.4.1/IOUSBHIDDriver/Classes/IOUSBHIDDriver.cpp

Code: [Select]
   // For Keyboards, set the idle millecs to 24 or to 0 if from Apple
    //
    if ( (_interface->GetInterfaceClass() == kUSBHIDClass) &&
         (_interface->GetInterfaceSubClass() == kUSBHIDBootInterfaceSubClass) &&
         (_interface->GetInterfaceProtocol() == kHIDKeyboardInterfaceProtocol) )
    {
        if (_device->GetVendorID() == kIOUSBVendorIDAppleComputer)
        {
            SetIdleMillisecs(0);
        }
        else
        {
            SetIdleMillisecs(24);
        }
    }
Title: ADB to USB keyboard converter for Teensy
Post by: jeffreysung on Tue, 08 March 2011, 00:39:15
Wow.. awesome!!! there is no multiple key stroke!!!!

Thanks. Hasu

I attach screenshot.

(http://cfile1.uf.tistory.com/image/2013864D4D75CE42251D4D)
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Wed, 09 March 2011, 20:27:21
Quote from: jeffreysung;307403
Wow.. awesome!!! there is no multiple key stroke!!!!


jeffreysung,
Thanks for your feedback.

I pushed fix for the problem to github now. I think this fix avoids multiple key stroke.
Title: ADB to USB keyboard converter for Teensy
Post by: b0bb3r5 on Sat, 12 March 2011, 11:56:29
i have a old m0110a how would i go about getting this to work with a teensy? i have a teensy, the keyboard, electronics...etc and id really love to get some help converting it
Title: ADB to USB keyboard converter for Teensy
Post by: kps on Sat, 12 March 2011, 13:33:25
Quote from: b0bb3r5;310514
i have a old m0110a how would i go about getting this to work with a teensy? i have a teensy, the keyboard, electronics...etc and id really love to get some help converting it


The M0110A is not an ADB keyboard, so you should probably start a separate thread for that.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Thu, 01 September 2011, 00:06:35
I finally added locking capslock key support and this is default now.
Someone sent me a patch for this feature. Thank you!

I think most ADB keyboards has a locking capslock in either case whether physical push-lock or software locking.
So this feature is good for people using their keyboard as is, while some who replace caps with non-locking switch
for remapping will want to disable this feature with commenting out following macro in config.h.
Code: [Select]

/* Locking Caps Lock support */
#define MATRIX_HAS_LOCKING_CAPS
Title: ADB to USB keyboard converter for Teensy
Post by: nodnerb on Sat, 29 October 2011, 00:36:38
Hi Hasu,

Your firmware is some great work... works out of the box for my Apple-branded keyboards!

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.

Just got things working a bit on Friday, we'll see how the board works next week.

My keyboard has a sticky "B" key - don't know what I can do about this just yet...

Thank you for providing the firmware for us!

I'm going to look into your source code to see how the layer switching works.

Cheers,
nodnerb
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Sat, 29 October 2011, 07:59:33
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 :)
Title: ADB to USB keyboard converter for Teensy
Post by: CyberDave on Wed, 21 December 2011, 03:41:54
Thanks so much for this! I'm modding an Apple Extended Keyboard II with an internal Teensy adapter as a Christmas gift for my brother.


It's working great, except for one thing...the power button isn't doing anything on my Mac. Yes, it is wired up correctly...the Teensy is seeing the key up/down, but seemingly not doing anything. Here's what hid_listen.mac shows for debugging output:


Code: [Select]
r/c 01234567
00: 00000000
01: 00000000
02: 00000000
03: 00000000
04: 00000000
05: 00000000
06: 00000000
07: 00000000
08: 00000000
09: 00000000
0A: 00000000
0B: 00000000
0C: 00000000
0D: 00000000
0E: 00000000
0F: 00000001
ignore keycode: B0
keys: 00 00 00 00 00 00  mods: 00
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
ignore keycode: B0
adb_host_kbd_recv: FFFF


I'm not sure what the "ignore keycode" is all about. Will take another look tomorrow when I'm not half asleep. Until then, any ideas?
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Wed, 21 December 2011, 11:25:05
Hi, CyberDave. Thanks for your feedback.

Quote from: CyberDave;475045
Thanks so much for this! I'm modding an Apple Extended Keyboard II with an internal Teensy adapter as a Christmas gift for my brother.

Wow, AEKII for gift?! Your brother is so lucky :)


Quote
It's working great, except for one thing...the power button isn't doing anything on my Mac. Yes, it is wired up correctly...the Teensy is seeing the key up/down, but seemingly not doing anything. Here's what hid_listen.mac shows for debugging output:


Oops, this is a bug. I fixed this bug and pushed the commit to github, try latest sources.

With default keymap you can send a power down event to OS with the power button, Mac's reaction to the event depends on your OS setting. I think Mac will display a sleep/shutdown dialog or sleep immediately without warn.
By pushing power button you will be able to wake your sleeping Mac as well.
Title: ADB to USB keyboard converter for Teensy
Post by: CyberDave on Wed, 21 December 2011, 18:42:47
Quote from: hasu;475239
Hi, CyberDave. Thanks for your feedback.

Wow, AEKII for gift?! Your brother is so lucky :)

Oops, this is a bug. I fixed this bug and pushed the commit to github, try latest sources.

With default keymap you can send a power down event to OS with the power button, Mac's reaction to the event depends on your OS setting. I think Mac will display a sleep/shutdown dialog or sleep immediately without warn.
By pushing power button you will be able to wake your sleeping Mac as well.

He's an editor at a small book publisher, and an aspiring writer. We've been Mac users since we were kids...I've Retr0brighted the keyboard and cleaned it up. I hope he gets a kick out of seeing it restored to its original platinum glory (and that I can get the thing finished before I head home for the holidays (currently I need to figure out how I'm going to install the USB port in this thing so it can look as much like a stock keyboard as possible).

Thanks for the quick fix...I will test it out tonight. Ideally, I'd like it to just pop up the Mac's regular shutdown dialog box. Wake from sleep would be a nice side benefit as well.
Title: ADB to USB keyboard converter for Teensy
Post by: CyberDave on Thu, 22 December 2011, 02:44:17
Update: the power button now brings up the Mac's standard sleep/restart/shutdown dialog, and also wakes my MacBook Pro from sleep. The keyboard is reassembled and looks great. Now I just have to get to work on another one or two of these for myself...

hasu, this is awesome. If you're ever in Seattle, the first beer or two is on me.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Thu, 22 December 2011, 21:02:39
Cool. Happy Christmas!
Title: ADB to USB keyboard converter for Teensy
Post by: blargg on Tue, 10 January 2012, 14:58:24
HUGE thanks for this! I've been using an old PowerMac with ADB Extended Keyboard for the last 15 years for coding, and hate all the cheap keyboards for my newer USB-based machines. I just got a Teensy++ 2.0 and figured I'd try this as the first project. Code built without a hitch, wiring just as shown on the page, and it works perfectly. I've saved up several Apple Extended Keyboard IIs and this will make my slow transition to newer machines so much more pleasant. Thank you!
Title: ADB to USB keyboard converter for Teensy
Post by: woody on Wed, 11 January 2012, 09:22:59
Ha, hello and welcome, blargg!
Title: ADB to USB keyboard converter for Teensy
Post by: HILO 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.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu 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.
Title: ADB to USB keyboard converter for Teensy
Post by: blargg 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.
Title: ADB to USB keyboard converter for Teensy
Post by: HILO 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.
Title: ADB to USB keyboard converter for Teensy
Post by: HILO 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.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu 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
Title: ADB to USB keyboard converter for Teensy
Post by: HILO 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.
Title: ADB to USB keyboard converter for Teensy
Post by: HILO 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.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu 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
Title: ADB to USB keyboard converter for Teensy
Post by: Koplimi 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)
Title: ADB to USB keyboard converter for Teensy
Post by: hasu 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.
Title: ADB to USB keyboard converter for Teensy
Post by: Koplimi 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?
Title: ADB to USB keyboard converter for Teensy
Post by: hasu 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.
Title: ADB to USB keyboard converter for Teensy
Post by: Koplimi 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?
Title: ADB to USB keyboard converter for Teensy
Post by: hasu 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.
Title: ADB to USB keyboard converter for Teensy
Post by: Koplimi 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?
Title: ADB to USB keyboard converter for Teensy
Post by: hasu 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
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Sun, 12 February 2012, 10:30:02
Added firmware binary built in my environment on the article page. Try it.
Title: ADB to USB keyboard converter for Teensy
Post by: Koplimi 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.
Title: ADB to USB keyboard converter for Teensy
Post by: HILO on Mon, 13 February 2012, 02:46:52
Thanks to Advice.
I succeeded, perfectly.
Thank you very much.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu on Mon, 13 February 2012, 05:04:08
welcome. nice to hear that.
Title: ADB to USB keyboard converter for Teensy
Post by: signet 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.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu 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.
Title: ADB to USB keyboard converter for Teensy
Post by: signet 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 (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.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu 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.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu 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|   |
     * `-----------------------------------------------------------' `-----------' `---------------'
     */
Title: ADB to USB keyboard converter for Teensy
Post by: signet 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.
Title: ADB to USB keyboard converter for Teensy
Post by: signet 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.
Title: ADB to USB keyboard converter for Teensy
Post by: signet 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.
Title: ADB to USB keyboard converter for Teensy
Post by: signet 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.
Title: ADB to USB keyboard converter for Teensy
Post by: hasu 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
Title: ADB to USB keyboard converter for Teensy
Post by: signet 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.
Title: ADB to USB keyboard converter for Teensy
Post by: alaricljs on Tue, 19 June 2012, 11:31:46
In the classified... Honeywell Hall effect keypads (http://geekhack.org/showthread.php?18048-Bud-Honeywell-Hall-Effect-Keypads-%28-30%29&highlight=honeywell).  In case you want a taste  ;)
Title: Re: ADB to USB keyboard converter for Teensy
Post by: retroboy12 on Sun, 29 July 2012, 04:32:29
Github link isn't working? error 404
Title: Re: ADB to USB keyboard converter for Teensy
Post by: retroboy12 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)
Title: Re: ADB to USB keyboard converter for Teensy
Post by: stratmaster458 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?
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu 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.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: stratmaster458 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 ?
Title: Re: ADB to USB keyboard converter for Teensy
Post by: drop1410 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
(http://cfile7.uf.tistory.com/image/1947915A4D651B381E3C0D)

Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu 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.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: blargg 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.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu 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.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu 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.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: tufty 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
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu 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.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: tufty 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.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu 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!
Title: Re: ADB to USB keyboard converter for Teensy
Post by: blargg 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. :(
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu 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 :(
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Tue, 11 December 2012, 19:03:59
Just merged blargg's patch into the repository.  Thanks.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: blargg on Wed, 12 December 2012, 19:49:11
OK, nevermind, MATRIX_HAS_LOCKING_CAPS works properly. For some reason the OS only now apparently started doing the caps lock LED properly when I didn't have my modified .xmodmap invoked.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: wogdog on Tue, 18 December 2012, 20:39:09
Quote
Connect ADB keyboard to Teensy by 3 lines(Vcc, GND, Data). By default Data line uses port F0. This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable. The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended

A few questions... This is my first project of this sort, so sorry if they are stupid questions...
The instruction listed above was taken from the GitHub page. In all of the pictures I see 4 lines going to the Teensy (I have Teensy 2.0). So what is the other line from/for?

Also, how do I add the pull up resistor? Does it go inline between the data line on the Teensy?
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Tue, 18 December 2012, 22:05:15
Quote
Connect ADB keyboard to Teensy by 3 lines(Vcc, GND, Data). By default Data line uses port F0. This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable. The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended

A few questions... This is my first project of this sort, so sorry if they are stupid questions...
The instruction listed above was taken from the GitHub page. In all of the pictures I see 4 lines going to the Teensy (I have Teensy 2.0). So what is the other line from/for?
You can omit Power Switch line connected to port F1. ADB has this line to power Mac system up, but current version of the converter doesn't use this line any more. Without connecting power switch line you can still use power switch on keyboard with this converter.
After all you need to connect only three lines: Vcc, Gnd and Data.


Quote
Also, how do I add the pull up resistor? Does it go inline between the data line on the Teensy?
You should connect a resistor(any of 1k-10kOhm) between Vcc(5V) and data, not inline on data line.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: wogdog on Tue, 18 December 2012, 22:42:23
Thanks hash for the help, and for figuring this out to begin with! I have a little over two weeks off starting Thursday and can't wait to get started on this! Thanks again!

P.s. once I get it done, I will post a status update here for you all.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: SmallFry on Tue, 18 December 2012, 23:07:16
His name is Hasu;)
Title: Re: ADB to USB keyboard converter for Teensy
Post by: wogdog on Tue, 18 December 2012, 23:41:42
Stupid iOS autocorrect.... TMSAISTI
Title: Re: ADB to USB keyboard converter for Teensy
Post by: wogdog on Fri, 21 December 2012, 14:57:26
If I understand correctly, I am supposed to run the make command from within the adb_usb directory. This directory contains config.h, keymap.c, led.c, Makefile, matrix.c, and README.md. When I do that though, I get the following:

The system cannot find the path specified.
The system cannot find the path specified.
ECHO is off.
-------- begin --------
Process_begin: CreateProcess(NULL, avr-gcc --version, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [gccversion] Error 2

I am smart enough to figure out there is an error... But not smart enough to figure out what the error is. Any ideas?
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Fri, 21 December 2012, 20:05:18
It looks like your system could not find path of your toolchain :)

What is you system? Windows, Mac or else?
Which toolchain are you using? WinAVR or Atmel Toolchan?
Did you add directory including binaries to environment variable PATH(Path)?
Title: Re: ADB to USB keyboard converter for Teensy
Post by: wogdog on Sat, 22 December 2012, 11:10:00
You sir are a scholar and a gentleman. Not wanting to do things the easy way, I went and tried to use just gcc make. It evidently didn't have everything I needed. I then got WinAVR And that worked perfectly. Thank you!

Now... I am able to get input from the keyboard, but it seems a little slow, meaning when I type words with a repeating letter, it only registers one of them. Any tips on getting that changed?

I do have some more work to soon my wiring. For now it has a USB connected through the hole that the ADB connected used to be located at, directly to the Teeensy USB port. I had planned on putting a USB-B port where the ADB port was, but need to redo my first wiring attempt.

Another question... Do I need to keep the original controller in its connector? That seems like a good place to hot-glue my Teensy, but it is too tall with that chip in there.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Sun, 23 December 2012, 07:11:07
Current polling rate seems to be too slow to catch ADB signal in case of high speed typing. I'll work on this problem later.

From first post.
Quote
WARNING
ADB-USB converter misses keystrokes
Currently my ADB converter has this unsolved issue: https://github.com/tmk/tmk_keyboard/issues/14
One of work around is using old repository commit:33d58c2b5647623d2b.

AppleIIGS keyboard and M0116 suffer severely from this issue, while Extended keyboards M0115 and M3501 doesn't seem like so bad. Though it may depend on your type speed. In my speed 50-60wpm with Extended keyboard I don't feel big problem.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: wogdog on Sun, 23 December 2012, 09:22:46
Once again, I am an idiot. I can't tell you how many times I read through this thead. Didn't make the connection. I will try the listed commit. Thanks again for the help and patiently answering the numerous stuid questions.

I did get the keys and board cleaned up. Looks nice :)
Just need to retr0bright the space bar, and it should be good. 
Title: Re: ADB to USB keyboard converter for Teensy
Post by: Snipeye on Tue, 25 December 2012, 23:40:05
I got an Apple Extended Keyboard (I) for christmas - I've been working all day to clean it - alcohol q-tips down under the keys, ran the keys themselves through the dishwasher (worked wonders) and I struggled valiantly with getting a good enough version of avr-gcc to compile the teensy hex - finally FINALLY got that just barely - and now I'm having a couple issues with the keymap.  I'm trying to map it so there's a right "command" key, but that doesn't show up in the keymap file, and when I try to add it in, the make command gets mad at me for trying to pass 105 arguments into the keymap macro instead of the requisite 104.  Help?\\


EDIT:  I messed around with the code a little more, and it's ALMOST working right - I still can't get it to register differing commands for left and right command (apple) and both left and right control are mapped to left control only, and my right alt/option isn't working at all.  Are there options I need to change around to get those working right?  I'll post my current keymap.h, and I also had to change a single line of code in my keycode.h to get right-command mapped to command rather than control.  here's the line I changed there:

Code: [Select]
#define IS_MOD(code)             (KC_LCTRL     <= (code) && (code) <= KC_RCTRL
I changed that "KC_RGUI" to the "RCTRL" you see at the end of the line now.  Wouldn't compile if I just deleted the line.

As for my keymap.h,:

Code: [Select]
/*
Copyright 2011 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/*
 * Keymap for ADB keyboard
 */
#include <stdint.h>
#include <stdbool.h>
#include <avr/pgmspace.h>
#include "usb_keyboard.h"
#include "keycode.h"
#include "print.h"
#include "debug.h"
#include "util.h"
#include "keymap.h"


#define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)]))

// Convert physical keyboard layout to matrix array.
// This is a macro to define keymap easily in keyboard layout form.
/* Apple Extended Keyboard */
#define KEYMAP( \
    K35,  K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71,              K7F, \
    K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74,  K47,K51,K4B,K43, \
    K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K2A, K75,K77,K79,  K59,K5B,K5C,K4E, \
    K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,    K24,               K56,K57,K58,K45, \
    K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,        K7B,     K3E,      K53,K54,K55,     \
    K36,K3A,K37,        K31,                K80,K7C,K7D,     K3B,K3D,K3C,  K52,    K41,K4C  \
) { \
    { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
    { KC_##K08, KC_##K09, KC_NO,    KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
    { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
    { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
    { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
    { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO,    KC_##K35, KC_##K36, KC_##K37 }, \
    { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO    }, \
    { KC_NO,    KC_##K41, KC_NO,    KC_##K43, KC_NO,    KC_##K45, KC_NO,    KC_##K47 }, \
    { KC_NO,    KC_NO,    KC_NO,    KC_##K4B, KC_##K4C, KC_NO,    KC_##K4E, KC_NO    }, \
    { KC_NO,    KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
    { KC_##K58, KC_##K59, KC_NO,    KC_##K5B, KC_##K5C, KC_NO,    KC_NO,    KC_NO    }, \
    { KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_NO,    KC_##K67 }, \
    { KC_NO,    KC_##K69, KC_NO,    KC_##K6B, KC_NO,    KC_##K6D, KC_NO,    KC_##K6F }, \
    { KC_NO,    KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \
    { KC_##K78, KC_##K79, KC_##K7A, KC_##K7B, KC_##K7C, KC_##K7D, KC_##K80, KC_##K7F }  \
}


// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed.
static const uint8_t PROGMEM fn_layer[] = {
    0,              // Fn0
    0,              // Fn1
    0,              // Fn2
    0,              // Fn3
    0,              // Fn4
    0,              // Fn5
    0,              // Fn6
    0               // Fn7
};

// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer.
// See layer.c for details.
static const uint8_t PROGMEM fn_keycode[] = {
    KC_NO,          // Fn0
    KC_NO,          // Fn1
    KC_NO,          // Fn2
    KC_NO,          // Fn3
    KC_NO,          // Fn4
    KC_NO,          // Fn5
    KC_NO,          // Fn6
    KC_NO           // Fn7
};

static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* Default Layer: plain keymap
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |Pwr|
     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
     * ,-----------------------------------------------------------. ,-----------. ,---------------.
     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
     * |-----------------------------------------------------------| |-----------| |---------------|
     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|    \| |Del|End|PgD| |  7|  8|  9|  -|
     * |-----------------------------------------------------------| `-----------' |---------------|
     * |CapsLo|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  |               |  4|  5|  6|  +|
     * |-----------------------------------------------------------|     ,---.     |---------------|
     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |     |Up |     |  1|  2|  3|   |
     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
     * |Ctrl |Gui |Alt |         Space           |     |    |      | |Lef|Dow|Rig| |      0|  .|   |
     * `-----------------------------------------------------------' `-----------' `---------------'
     */
    KEYMAP(
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,                   PWR,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
    LCTL,LALT,LGUI,          SPC,                          RALT,RGUI,RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
    ),
};


uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col)
{
    return KEYCODE(layer, row, col);
}

uint8_t keymap_fn_layer(uint8_t index)
{
    return pgm_read_byte(&fn_layer[index]);
}

uint8_t keymap_fn_keycode(uint8_t index)
{
    return pgm_read_byte(&fn_keycode[index]);
}

So I've not changed much around.  Am I clear on what I need help with and what's not working?  I feel like my post is a bit jumbled.  Thanks!
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Wed, 26 December 2012, 03:31:35
ADB has no distinct keycode for right command key, so you can't map different key to it.
Right command key always behave as same as left one.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: Snipeye on Wed, 26 December 2012, 12:16:54
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. :(


That post lead me to believe that ADB, if the handler ID was 3, could differentiate between left and right command/control/alt.  Of course, I don't know if that's the case with the hardware on the AEK, care to enlighten?
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Wed, 26 December 2012, 12:34:58
You can distinguish between right and left of shift/control/option(alt) with ID3 method. But not command(apple) key.
Both AEK1 and AEK2 doesn't have distinct code for right command key. I don't know why.
I'm not 100% sure, but I believe it doesn't exist a way to distinguish right command key on ADB keyboard.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: Snipeye on Wed, 26 December 2012, 12:50:03
Alright, well that clears things up - thank you very much!  Could you help me get the code set up for distinguishing between right and left control and alt, at least, and then command can both be left?  The keymap default included in the adb_usb folder doesn't appear to have any sort of command key on the right.... and I don't know if I need to change anything to set up the handler as ID 3 instead of default.  Thanks!
Title: Re: ADB to USB keyboard converter for Teensy
Post by: tufty on Wed, 26 December 2012, 13:25:17
Well, you'll need to send a "Listen Register 3" to the keyboard telling it to go to handler 3, at which point you get  separate left and right modifiers.  They are as follows:

Left Control : 0x36
Command : 0x37
Left Shift: 0x38
Left Option : 0x3A
Right Shift : 0x7B
Right Option : 0x7C
Right Control : 0x7D

The message you need to send is, if I've got this right:

0x2B 0x62 0x03

In theory you should do this as part of bus deambiguation, but as we're talking about a specific situation with only one device at its default address, we can explicitly code in the address (the 2s in the first two bytes)

You'll then need to modify keymap.c in order to graft in the keycodes above and what you want to map them to.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: concept10 on Wed, 26 December 2012, 14:43:25
Hello All,

I recently found a stash and bought 2 of the Apple Extended Keyboards (Model 2) and instead of purchasing the Griffin iMate and running into this thread, I decided to try and adapt this project to an Arduino UNO board (ATmega328p) that I haven't found a purpose for yet.

I have attempted to compile the project with no luck so far.  Anyone have any suggestions or advice on what I need to change?  My current thought is to loose the pjrc usb library and use the lufa or v-usb library instead.  At this point, I am not sure of the proper modifications I need to make.  Any help welcome.

Thanks.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: Snipeye on Wed, 26 December 2012, 15:46:56
Well, you'll need to send a "Listen Register 3" to the keyboard telling it to go to handler 3, at which point you get  separate left and right modifiers.  They are as follows:

Left Control : 0x36
Command : 0x37
Left Shift: 0x38
Left Option : 0x3A
Right Shift : 0x7B
Right Option : 0x7C
Right Control : 0x7D

The message you need to send is, if I've got this right:

0x2B 0x62 0x03

In theory you should do this as part of bus deambiguation, but as we're talking about a specific situation with only one device at its default address, we can explicitly code in the address (the 2s in the first two bytes)

You'll then need to modify keymap.c in order to graft in the keycodes above and what you want to map them to.

... K.  I'm not that advanced.  Haha, I appreciate the effort, mind dumbing it down for me a little bit?  What/where do I need to change?  And as for the separate keys - I've grafted them in, I believe correctly, but I don't know how to apply the message you said I needed to send in order to initiate with ID of 3....

In adb.c, I've found something like what you're talking about - I've found a command that's already there, "adb_host_listen(0x2B,0x02,0x03)" and the comments say that's telling the keyboard to listen on register 3.  Then later (in adb_host_kbd_recv(void)) a byte (0x2c) is sent, telling the keyboard to talk on register 0.  Changing that to 0x2f to tell it to talk on register 3 screwed things up, so I changed that back.

Basically, it looks like it's already being told to listen on register 3, and it's still not differentiating between left or right control, alt, or shift.  Hmm... am I doing something wrong?
Title: Re: ADB to USB keyboard converter for Teensy
Post by: Soarer on Wed, 26 December 2012, 16:11:14
I'm just guessing, but try changing:
Code: [Select]
adb_host_listen(0x2B,0x02,0x03)
to:
Code: [Select]
adb_host_listen(0x2B,0x62,0x03)
BTW, 'talk' and 'listen' are just Woz-speak for 'read' and 'write', so sending e.g. a 'listen on register 3' command means that the keyboard will write the next 2 bytes sent to it into register 3.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: Snipeye on Wed, 26 December 2012, 16:42:37
That doesn't seem to work - tried it, no difference.  But the fact that there's no difference when I send a binary "1100010" rather than a "10" - no error or ANYTHING - means that perhaps the command isn't doing anything at all.  I'm pretty sure the '10' is what it's looking for, as 11 is talk.  Reading some more on how it's initialized right now, but doubt it'll help much.  Any other suggestions?


OK, I read the ADB spec more and looked at the adb.c protocol some more, and found some dependencies - primarily in the "adb_host_listen" and "attention" commands.  The protocol is default set up to send "0x2B,0x02,0x03" through adb_host_listen on initiation.  However, the adb protocol states the first 4 bits of the upper byte are reserved - should be "0000" - then the next 4 bits are the device address - a keyboard defaults to "2", which is (correct me if I'm wrong) "0010".  The next two, 4-bit chunks should be the command (listen, "0010") and the register, ("0011").  So, the "0x2B" should in fact be 0x02, right?  I tried changing it, and it's had no effect thus far.

In the "adb_host_listen" function, it calls "attention()" - the adb spec for that says an attention signal is 776-824 us low, and after the attention signal should come a 70us sync signal, high.  The attention() function was delaying for 700us, then placing a 1-bit (35us low, 65 high) - effectively providing 735us low, which is not a valid length for the attention signal, then 65us high, which is probably long enough.  I changed the attention function to bring the data line low for 800us, then high for 70, and then whatever functions take place after that should work properly.  I have seen no change in effect on the keyboard functionality.

Regardless, I don't think the attention signal was getting through, as the adb_host_listen command that occurs in the adb_host_init doesn't appear to DO anything -- commenting it out has no effect on the functionality of the keyboard whatsoever.  However, I'm unable to make it work - my modified attention() function doesn't appear to work any better.  Does anybody have the right/left control/alt/shift differentiated on an AEKv1?

Please, keep throwing suggestions my way.  I'm learning and becoming a little more capable.  :P
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Wed, 26 December 2012, 20:19:51
Snipeye,
Handler ID 3 is enabled by default now with patch from blargg. https://github.com/tmk/tmk_keyboard/commit/cf1eb8fbc6789776d3b3457dd5cf4ed84815e8b3
And keymap.c already has distinct keycodes for right and left shift/control/gui(apple or windows key). With default keymap Alt is mapped to command key.
What is your problem then?

Concept10,
While dealing with V-USB to handle ADB signal is very difficult, at least I tried this and failed to make it work. V-USB consumes quite a bit of time to handle USB.
Instead, I think you can load LUFA stack into ATMega16u2 and handle ADB with ATMega328p, then let two controllers communicate with UART line.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Wed, 26 December 2012, 20:43:06
Which spec are you referring? ADB spec has some ancient source but each and all doesn't explain protocol enough :)
Yes, my code is not completely conforming with spec to keep code simple for reference purpose.

I mainly use these as spec.
ADB - The Untold Story: Space Aliens Ate My Mouse
    http://developer.apple.com/legacy/mac/library/#technotes/hw/hw_01.html
Apple IIgs Hardware Reference Second Edition [p80(Chapter6 p121)]
    ftp://ftp.apple.asimov.net/pub/apple_II/documentation/Apple%20IIgs%20Hardware%20Reference.pdf



OK, I read the ADB spec more and looked at the adb.c protocol some more, and found some dependencies - primarily in the "adb_host_listen" and "attention" commands.  The protocol is default set up to send "0x2B,0x02,0x03" through adb_host_listen on initiation.  However, the adb protocol states the first 4 bits of the upper byte are reserved - should be "0000" - then the next 4 bits are the device address - a keyboard defaults to "2", which is (correct me if I'm wrong) "0010".  The next two, 4-bit chunks should be the command (listen, "0010") and the register, ("0011").  So, the "0x2B" should in fact be 0x02, right?  I tried changing it, and it's had no effect thus far.

In the "adb_host_listen" function, it calls "attention()" - the adb spec for that says an attention signal is 776-824 us low, and after the attention signal should come a 70us sync signal, high.  The attention() function was delaying for 700us, then placing a 1-bit (35us low, 65 high) - effectively providing 735us low, which is not a valid length for the attention signal, then 65us high, which is probably long enough.  I changed the attention function to bring the data line low for 800us, then high for 70, and then whatever functions take place after that should work properly.  I have seen no change in effect on the keyboard functionality.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: Snipeye on Wed, 26 December 2012, 21:32:02
I was referring to this:

http://www.eetasia.com/ARTICLES/2000JUN/2000JUN02_CT_AN8.PDF

But upon closer inspection, it appears that my right and left control/alt/shift ARE, in fact, being differentiated.  I'm in OSX, was going to the "keyboard viewer" to determine what keys were being pressed, and it was showing both left and right control/alt/shift as only 1 - but that is not, in fact, the case.  Any suggestions for applications to determine what keys are being pressed with a little more accuracy?  It's working perfectly and is ready to go for my project (if I remember I'll post a link when I'm finished, but I'm installing a USB hub and giving it a nice paintjob.  Should be pretty cool.)  Thank you all for all the help - wouldn't have been possible without you guys.  Perhaps another dumb question - though all my keycaps are off right now (cleaning and painting) so I can't see the names of the switches, but the only LED I can get to turn on is for caps lock.  What key combos on the AEKv1 should activate the other LEDs?  Bear in mind I'm in OSX.  Thanks!
Title: Re: ADB to USB keyboard converter for Teensy
Post by: tufty on Fri, 28 December 2012, 01:25:05
IIRC, under OS9, scroll lock was F14, and numlock was shift-clear
Title: Re: ADB to USB keyboard converter for Teensy
Post by: wogdog on Mon, 07 January 2013, 09:58:32
Current polling rate seems to be too slow to catch ADB signal in case of high speed typing. I'll work on this problem later.

From first post.
Quote
WARNING
ADB-USB converter misses keystrokes
Currently my ADB converter has this unsolved issue: https://github.com/tmk/tmk_keyboard/issues/14
One of work around is using old repository commit:33d58c2b5647623d2b.

AppleIIGS keyboard and M0116 suffer severely from this issue, while Extended keyboards M0115 and M3501 doesn't seem like so bad. Though it may depend on your type speed. In my speed 50-60wpm with Extended keyboard I don't feel big problem.

How would I go about using that commit? I cant seem to find it up on Git.  I also scanned through the code and did not see a place to modify the polling rate
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Mon, 07 January 2013, 10:17:49
Here: https://github.com/tmk/tmk_keyboard/tree/33d58c2b5647623d2b07a210ef97a27920e5563e
No scan rate config option. Somewhere in codes takes too long :) you have to tune code.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: wogdog on Mon, 07 January 2013, 10:41:29
Works perfectly now!! Thanks!! Both for your patience and knowledge. This forum is great! I have learned a lot already from the short time I have been here, and look forward to learning more. I have found some additional mechanical keyboards around the building that I have been able to 'acquire'. Now I just need to get them to USB also, and I am good to go.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Tue, 09 April 2013, 01:08:36
Fixed missing key stoke problem finally. https://github.com/tmk/tmk_keyboard/issues/14
Title: Re: ADB to USB keyboard converter for Teensy
Post by: ryemac3 on Wed, 10 April 2013, 12:34:14
I have a few bare bones Arduino boards that I made with some Atmega328s.

(http://kevinrye.net/files/barebonesarduinov2_0064.jpg)

They would be perfect for this project. Does anyone know how to port this code over to Arduino?
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Wed, 10 April 2013, 17:25:28
You need V-USB to support USB  on ATmega328 but V-USB and my ADB code are incompatible unfortunately. My ADB code use busy wait polling method to implement the protocol and V-USB interrupts and screw up ADB code with up to 50us block, IIRC. My code needs hardware engine on USB AVR like ATmega32U4 or AT90USB1286 instead of software V-USB at the moment.

To port this converter into ATmega328 I think you have to rewrite ADB code with timer interrupt or other method at least, but I'm not sure.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: tufty on Thu, 11 April 2013, 00:35:43
Fixed missing key stoke problem finally. https://github.com/tmk/tmk_keyboard/issues/14

Hey hasu.

That's fantastic, finally makes my M0116 work properly without missing keys.  I just put a pull request up - feel free to merge my M0116 layout into your master.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Fri, 12 April 2013, 00:11:16
tufty,
merged your support for eject key and M0116 layout. Thanks.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: oryhara on Thu, 06 June 2013, 20:32:01
What would one need to do to make this work with teensy 3.0?
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Thu, 06 June 2013, 21:44:05
Physically, some components for 5-3.3 voltage shifter.
To handle ADB 5V signal Teensy 3.0 will need this because its I/O ports are not 5V tolerant, I think.

And knowledge of Cortex architecture and C language. That's all.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: oxalyn on Tue, 11 June 2013, 23:59:21
This is probably my inexperience, but:

Is anybody compiling this on OS X 10.7.5 using the CrossPack avr-gcc package? No matter which version of CrossPack I install, I get a number of compiler errors when compiling:

...

Assembling: ../../common/xprintf.S
avr-gcc -c -mmcu=atmega32u4        -x assembler-with-cpp -DF_CPU=16000000 -DBOOTLOADER_SIZE=4096 -DPROTOCOL_PJRC -DNO_PRINT -DNO_DEBUG -Wa,-adhlns=obj_adb_usb/common/xprintf.lst,-gstabs,--listing-cont-lines=100 -I. -I../.. -I../../protocol/pjrc -I../../protocol -I../../common -include config.h  ../../common/xprintf.S -o obj_adb_usb/common/xprintf.o
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h: Assembler messages:
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:121: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:122: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:123: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:124: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:125: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:126: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:128: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:129: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:142: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:147: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:159: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:164: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:169: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:174: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:179: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:184: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:192: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:199: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:213: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:218: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:223: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:228: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:233: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:238: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:246: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:253: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:273: Error: unknown opcode `typedef'
/opt/local/lib/gcc/avr/4.7.0/../../../../avr/include/stdint.h:278: Error: unknown opcode `typedef'
../../protocol/adb.h:56: Error: unknown opcode `void'
../../protocol/adb.h:57: Error: unknown opcode `_bool'
../../protocol/adb.h:58: Error: unknown opcode `uint16_t'
../../protocol/adb.h:59: Error: unknown opcode `void'
../../protocol/adb.h:60: Error: unknown opcode `void'
../../common/matrix.h:26: Error: unknown opcode `typedef'
../../common/matrix.h:39: Error: unknown opcode `uint8_t'
../../common/matrix.h:41: Error: unknown opcode `uint8_t'
../../common/matrix.h:43: Error: unknown opcode `void'
../../common/matrix.h:45: Error: unknown opcode `uint8_t'
../../common/matrix.h:47: Error: unknown opcode `_bool'
../../common/matrix.h:49: Error: unknown opcode `_bool'
../../common/matrix.h:51: Error: unknown opcode `matrix_row'
../../common/matrix.h:53: Error: unknown opcode `void'
make: *** [obj_adb_usb/common/xprintf.o] Error 1

I appreciate any help provided.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Wed, 12 June 2013, 01:39:59
try this patch.

Code: [Select]
/* key combination for command */
+#ifndef __ASSEMBLER__
 #include "adb.h"
 #include "matrix.h"
 #define IS_COMMAND() ( \
     matrix_is_on(MATRIX_ROW(ADB_POWER), MATRIX_COL(ADB_POWER)) \
 )
+#endif
Title: Re: ADB to USB keyboard converter for Teensy
Post by: oxalyn on Wed, 12 June 2013, 10:30:11
Thank you, that did the trick!
Title: Re: ADB to USB keyboard converter for Teensy
Post by: oxalyn on Thu, 13 June 2013, 23:23:18
OK, I got everything working and wired up. Of note, the default 'keymap.c' file has the Option and Command keys swapped. I fiddled with it until it worked:

Code: [Select]
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    KEYMAP_EXTENDED_US(
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,                   PWR,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,PEQL,PSLS,PAST,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
    LCTL,LALT,LGUI,          SPC,                               RALT,RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
    ),
};

On the last line, LALT and LGUI are swapped in the default file, and the RALT is a RGUI in the default file.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: oxalyn on Fri, 14 June 2013, 00:19:07
Also, no matter what I do, I can't get the Power key to work. I wonder if it's due to the patch you gave me above, which may not be defining IF_COMMAND()?
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Fri, 14 June 2013, 00:53:01
I think it is not due to that patch.

Power key is used as 'Magic key' to run Magic commands. IS_COMMAND() macro defines 'Magic key' and which cannot be used as normal key for typing.
To use Power key as normal key define IS_COMMAND() with other key or comment out COMMAND_ENABLE in Makfile.
https://github.com/tmk/tmk_keyboard#magic-comannds
Title: Re: ADB to USB keyboard converter for Teensy
Post by: oxalyn on Sat, 15 June 2013, 00:28:27
Hmm. I compiled with both COMMAND_ENABLE = yes and #COMMAND_ENABLE = yes, and got identical results: the system acts as though nothing had been pressed when I hit the power button. I even got the same results with a different keyboard.

Here is the relevant section of MAKEFILE:

Code: [Select]
# Build Options
#   comment out to disable the options.
#
#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
#MOUSEKEY_ENABLE = yes # Mouse keys(+5000)
#EXTRAKEY_ENABLE = yes # Audio control and System control(+600)
#CONSOLE_ENABLE = yes    # Console for debug
#COMMAND_ENABLE = yes    # Commands for debug and configuration
#SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
#NKRO_ENABLE = yes # USB Nkey Rollover(+500)

I did spend all day using this system, and other than the power key it performs flawlessly. I'm a speed typist, and it keeps up quite well.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: hasu on Sat, 15 June 2013, 05:42:09
Hmm. I compiled with both COMMAND_ENABLE = yes and #COMMAND_ENABLE = yes, and got identical results: the system acts as though nothing had been pressed when I hit the power button. I even got the same results with a different keyboard.

Hmm, 'make -f ... clean' may be needed before 'make -f ...' when you change config.h. Try 'make clean'.
If this makes no difference let me know again. I'll look into my code more.

EDIT: Or maybe your system doesn't recognize 'System Power' keycode(PWR). you can try another keycode.
For example use 'A' instead of 'PWR' in your keymap, you will see 'a' when pressing Power key.

Quote
I did spend all day using this system, and other than the power key it performs flawlessly. I'm a speed typist, and it keeps up quite well.

Great. It is exactly what I want to hear!
Post here if you come across any problem.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 18 June 2013, 19:24:37
My new DIY ADB converter! I did this instead of buying extra Teensy's from PJRC.

(http://i.imgur.com/Zl2pecLm.jpg)

http://deskthority.net/workshop-f7/teensy-2-0-alternatives-atmega32u4-t4253-30.html#p112185
Title: Re: ADB to USB keyboard converter
Post by: TheFlyingRaccoon on Tue, 18 June 2013, 20:59:07
My new DIY ADB converter! I did this instead of buying extra Teensy's from PJRC.

Show Image
(http://i.imgur.com/Zl2pecLm.jpg)


http://deskthority.net/workshop-f7/teensy-2-0-alternatives-atmega32u4-t4253-30.html#p112185

This looks awesome! What was the total cost of materials?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 19 June 2013, 02:22:05
Around $10. Not so cheap.

PCB $1.5
MCU $5
Connector $2
Xtal $0.5
R,C,etc $1.5
Title: Re: ADB to USB keyboard converter
Post by: Captain Hammer on Mon, 15 July 2013, 01:22:45
I was having the same problem as oxalyn (10.8 with CrossPack), but after trying Hasu's suggestion, I now get these errors:

In file included from <command-line>:0:0:
./config.h:62:1: error: expected identifier or '(' before '+' token
./config.h:62:1: error: stray '#' in program
In file included from /usr/local/CrossPack-AVR-20130212/lib/gcc/avr/4.6.2/include/stdint.h:3:0,
                 from ../../protocol/adb.h:41,
                 from ./config.h:63,
                 from <command-line>:0:
/usr/local/CrossPack-AVR-20130212/lib/gcc/avr/4.6.2/../../../../avr/include/stdint.h:159:1: error: unknown type name 'int8_t'
/usr/local/CrossPack-AVR-20130212/lib/gcc/avr/4.6.2/../../../../avr/include/stdint.h:213:1: error: unknown type name 'int8_t'
In file included from <command-line>:0:0:
./config.h:68:1: error: expected identifier or '(' before '+' token
./config.h:68:1: error: stray '#' in program
make: *** [obj_adb_usb/keymap.o] Error 1

These problems also appeared with attempting to compile on Ubuntu with gcc-avr and libc-avr.
Any help would be greatly appreciated.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 15 July 2013, 09:28:46
Hmm, this patch works for me.
http://geekhack.org/index.php?topic=14290.msg926590#msg926590

It seems your failed to patch. You copied the line from the patch including '+'? You don't need '+'.
Quote
./config.h:68:1: error: expected identifier or '(' before '+' token

Actually the source should look like this. Preceding '+' is not needed to copy.
Quote
/* key combination for command */
#ifndef __ASSEMBLER__
#include "adb.h"
#include "matrix.h"
#define IS_COMMAND() ( \
    matrix_is_on(MATRIX_ROW(ADB_POWER), MATRIX_COL(ADB_POWER)) \
)
#endif
Title: Re: ADB to USB keyboard converter
Post by: arfink on Sun, 29 September 2013, 16:16:18
I'm going to try this out on my IIgs keyboard. This looks very promising! I'll report back how it goes when I'm done.
Title: Re: ADB to USB keyboard converter
Post by: arfink on Thu, 03 October 2013, 18:20:31
Quick question: the first page of the discussion here mentioned Data should be connected to PF0, while the Github indicates the default is D0. Which is it?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 03 October 2013, 18:29:08
Use PD0 now.
Pin usage changed recently.
Title: Re: ADB to USB keyboard converter
Post by: arfink on Thu, 03 October 2013, 20:54:40
Well, I got everything compiled from the newest version on Git, and it seems that the IIgs keyboard is routinely dropping key strokes, especially double letters and sometimes even spaces.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Fri, 04 October 2013, 00:22:45
hmm, I also could confrm IIgs(Alps made in Japan) and M0116  drop key stroke sometime.

I found problems:
1) These keyboards are worse than normal 2KRO keyboard. They are *always* blocked when you press just two keys. This may be annoying if you are fast typer.

2) Pressing  same key sucessively tens to lose the stroke. Like I type 'jjj' and see 'jj' sometime.
But I'm not sure what causes this, switch defect, keyboard controller or my converter? Though I think my converter likely sitll has some bugs. I'll need to look into with scope or logic analyzer and reading the spec fully again. 

I'd like to see how iMate works with these boards, but I have none of that unfortunately. And I don't think I have time to debug this problem further soon.

Looks like these problems doesn't occur or seldom on Apple Extended keyboards M0115 and M3501.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Fri, 04 October 2013, 01:00:11
I'll be blunt - The key dropping is down to your converter, hasu. Connected through an iMate, my M0116 doesn't drop keys at all, and I'm a fast typist.

I believe the keyboards themselves only give 2 key rollover for normal alphabetic keys, and give full rollover for the control keys.  At least, that's what I'm seeing through the iMate, although it may well be that the iMate doesn't handle anything more than 2kro as well.  Not a problem for me, but I don't game...

Title: Re: ADB to USB keyboard converter
Post by: hasu on Fri, 04 October 2013, 01:19:58
tufty, interesting. Then my code sucks somewhere and misses signal.
I'll try to rewrite code from scratch when I got time for the curiousity.
Thanks.

This will not be fixed anytime soon,
For now I recommend iMate for daily usage.
Title: Re: ADB to USB keyboard converter
Post by: arfink on Fri, 04 October 2013, 11:30:43
That's fine, for daily usage I'm just using an old IBM XT keyboard. So the IIgs is just a curiosity. I do know that when I used the IIgs keyboard with the IIgs I can hammer away on it as fast as I want, and it never misses a beat. So yeah, I think it's the converter.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sun, 06 October 2013, 21:16:18
Hey, I've found myself doing more AVR programming lately and I realized that I now have the skills to write this ADB converter using interrupt-driven code that uses a hardware timer to measure durations. I've been using simavr which would be perfect for simulating ADB and testing the code in a sandbox. I now have an oscilloscope as well (with digital capture) so can debug any hardware issues. Just want to be sure that nobody else is working on this rewrite already.

I've since found a Belkin USB-ADB converter ($5 at a thrift shop) and it indeed works better than ours here, so it'd be nice to improve the one here. The Belkin one is apparently made by PI Engineering, the same people who make a Y-mouse PS2-USB keyboard/mouse adapter with similar esc-<letter> control codes.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 06 October 2013, 22:13:15
Great. I didn't start to fix yet.
If the community can get access to your reliable converter it is awsome.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Mon, 07 October 2013, 00:12:54
I'm studying the current code and it seems that the USB driver is bit-banged, and can't handle having interrupts disabled for more than a very short time (for obvious reasons). It's also almost a certainty that it keeps interrupts disabled when it's running. I assumed that this was meant to run on AVR devices with USB hardware, but maybe this project (tmk_keyboard) is meant to run on almost any AVR device.

Given the constraints of v-usb, it might still be possible to use some hardware assist for ADB. I'm thinking input capture to time ADB input, and perhaps PWM in a one-shot mode to time output bits. This is assuming that USB doesn't tie things up for more than 100us or so. I know almost nothing about USB so this may be overly optimistic. I know the ADB protocol has timeout handling, but if we timed out reading from the keyboard, it probably won't send the key press events again.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 07 October 2013, 02:36:09
Some projects like keyboard controllers(under keyboards/*) and PS/2, Sun, X68 converters can run with V-USB, I think. But I don't test/use them with V-USB recently and not so eager to support it anymore.

I'm not sure but my codes use only a few interrupts of hadware USB engine(LUFA) and timer(timer.h). I think USB interrupts are not so critical so that USB tasks are almost processed with hardware and timer is also trivial. You will be able to use your interrupts and place critical sections mostly freely with LUFA stack.

It is great if the converter works with V-USB, so that we can make it from cheap MCU.
This is very challenging technically, but it may be possible as you described. IIRC V-USB blocks around 50us, not long as 100us.

But I think Atmega32u4(LUFA) is the first target to tackle.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Mon, 07 October 2013, 12:01:37
I was thinking that for V-USB, the ADB polling could be done between USB events. But you say it's not currently used so I won't waste time on that.

I looked at the timing on a scope and first off, USB transmission lasts 3us normally, sometimes as much as 15us. So it doesn't seem like it would mess up the current timing.

I'm getting bogged down trying to understand the source. On the older version I have, hid_listen never hears the device (even though keyboard works), and I'm not getting uart debug output working either.

I tried the current code but make fails:

$ cd converter/adb_usb
$ make

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


mkdir -p obj_adb_usb/protocol/pjrc
Compiling C: ../../protocol/pjrc/usb.c
avr-gcc -c -mmcu=at90usb1286       -gdwarf-2 -DF_CPU=16000000UL -DBOOTLOADER_SIZE=4096 -DPROTOCOL_PJRC -DNO_PRINT -DNO_DEBUG -DVERSION=unknown -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_adb_usb/protocol/pjrc/usb.lst -I. -I../.. -I../../protocol/pjrc -I../../protocol -I../../common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_adb_usb_protocol_pjrc_usb.o.d  ../../protocol/pjrc/usb.c -o obj_adb_usb/protocol/pjrc/usb.o
../../protocol/pjrc/usb.c: In function ‘__vector_11’:
../../protocol/pjrc/usb.c:892:15: error: ‘keyboard_report’ undeclared (first use in this function)
../../protocol/pjrc/usb.c:892:15: note: each undeclared identifier is reported only once for each function it appears in
make: *** [obj_adb_usb/protocol/pjrc/usb.o] Error 1
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 07 October 2013, 19:26:30
It seems I broke something on PJRC stack with recent changes. Use Makefile.lufa to build.
I'd like to make LUFA default stack from now. But PJRC will be also supported for a while, I'll fix this problem later.

Build with LUFA and hit Power + h you'll get help on hid_listen.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Mon, 07 October 2013, 20:06:29
I split the core adb.c file out and made a new converter using the PJRC keyboard sources from the Teensy website. I'd like to reproduce any problems with this much simpler backend to figure whether the problem is the adb driver or all the translation going on. I noticed that neither PJRC sources on the site are as full-featured as the PJRC ones you use.

Using your full LUFA build, is there any reliable way to reproduce the problems?

EDIT: went through all my keyboards and all 5 extended ones are M3501. I have three smaller ones: two M0116 and an M0487 (IIgs keyboard). The M0487 shows issues like you mentioned with pressing the same key over and over quickly. It shows up my bare-bones tester that just runs the adb.c code and outputs over the hardware UART (so no interrupts to interfere). It doesn't occur when I poll the keyboard every 16 msec, but loses keys badly when I scan it continuously.

Polling every 1 msec causes it occasionally. Every 5 msec it's much more rare.
Title: Re: ADB to USB keyboard converter
Post by: sprit on Mon, 07 October 2013, 20:50:46
I love this post!  for a long time
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 07 October 2013, 21:35:30
EDIT: went through all my keyboards and all 5 extended ones are M3501. I have three smaller ones: two M0116 and an M0487 (IIgs keyboard). The M0487 shows issues like you mentioned with pressing the same key over and over quickly. It shows up my bare-bones tester that just runs the adb.c code and outputs over the hardware UART (so no interrupts to interfere). It doesn't occur when I poll the keyboard every 16 msec, but loses keys badly when I scan it continuously.

Polling every 1 msec causes it occasionally. Every 5 msec it's much more rare.

Wow, you are right :o
I confirmed that adding simple 5ms delay between scans make the problem gone!

Not sure about optimal value of scan rate now, but I believe you found the solution.
What's your recommendation? 16ms? I think it is fast enough even for fast typers.

It seems my code make the old controller high loaded unnecessarily...

Thanks blargg!
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 07 October 2013, 22:39:04
I used 16ms delay tentativly and pushed the fix to the repository now.
With this commit it seems the problem is gone or mitigated dramatically to me.
https://github.com/tmk/tmk_keyboard/commit/e8e8f93bcf0cdc8d72d35662db5a1da4716762b8

tufty and arfink, can you try the latest source and test this fix?
Title: Re: ADB to USB keyboard converter
Post by: blargg on Mon, 07 October 2013, 23:20:59
I'll have to try this finicky keyboard on some old Macs (PowerBook 540c and PowerMac 8500) and see if it works reliably, and what the ADB poll rates are on them.

I've also rewritten adb.c somewhat to hopefully be more robust, and I plan on offering it. The approach lends itself to easy conversion to use a timer rather than delay loops, and perhaps make it fully interrupt-driven. I'm going to add ADB simulation to simavr so I can run it through some virtual stress tests.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 08 October 2013, 00:20:38
Yeah, the interrupt driven is still more reliable approach, of course. Keep us updated.
Once your code works and makes available to us it would be great.

I'm looking forward to seeing your code! And it looks simavr is very useful tool, I must try it.

Title: Re: ADB to USB keyboard converter
Post by: blargg on Tue, 08 October 2013, 15:07:46
ADB polling periods
PowerBook 520c: 11.7 ms
PowerMac 8500 11.2 ms
Belkin ADB-USB adapter: 8.34 ms

Since this isn't for gaming, I'd say 11.5 ms is a good level. Clearly lower values are risky.

PowerBook 520c timings:
Attention: 800 us
bit cell time: 99 us

So the low-level timings you use are good in that regard.

I'm making progress using simavr for testing.

Another thing, I've changed my ADB code to never drive the data line high, and rely entirely on the pull-up resistor. This way there is never a risk of the AVR driving it high while the keyboard pulls it low. So init code becomes:

ADB_DDR &= ~(1<<bit);
ADB_PORT &= ~(1<<bit);

And then

static inline void data_lo( void ) { ADB_DDR |= data_mask; }
static inline void data_hi( void ) { ADB_DDR &= ~data_mask; }

This way the AVR pin behaves like a normal open-collector output: either floating or held low. We don't want to rely on the AVR's internal weak pull-up, since I think we've shown that it's too slow.

I looked at the rise time for no pull-up (hilarious), 10K (almost 10 us), and 1K (~150 ns), so a 1K pull-up is definitely desired, and seems to be roughly what the Mac uses.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Tue, 08 October 2013, 17:49:44
I wrote some code that tests the overhead of the PJRC basic USB keyboard driver's ISR, and found it to be only 5us. My Linux machine polls USB at 1kHz, so these missing 5us chunks occur every millisecond. I'm going to incorporate this into the simulator. My improved ADB code shouldn't be affected by this, though the current ADB code might be as it wasn't very tolerant of variations in timing in the simulator. With my improved code I don't think there's much need for an interrupt-based version, and the complexity could be a source of new bugs. Even if one were made, I'm not sure how to get PJRC's ISR to re-enable the timer interrupt so it can itself be interrupted by our ADB code. This doesn't rule out using a capture register when receiving from the keyboard, though.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Tue, 08 October 2013, 23:40:08
I did a preliminary input capture version for receiving from the keyboard and it does time it more accurately in the face of interrupts, but didn't perform any better than the basic rewrite I've done. And its send timing is still affected by interrupts, so it seems the only reasonable alternate version is a full interrupt-based one. But, I've been researching the LUFA USB driver and it seems that delaying interrupts isn't a problem with the hardware-based USB (https://groups.google.com/forum/#!searchin/lufa-support/interrupts/lufa-support/A4P8vgkKVLY/BEIboiUFt3AJ). Also, it apparently doesn't really support re-enabling interrupts in its interrupt handler, so an interrupt-based ADB would still get delayed. It sounds like disabling interrupts for the duration of ADB transfers would be fine for the hardware-based USB implementations. And assuming that LUFA is similar to the PJRC basic USB keyboard driver, the interrupt overhead doesn't mess up ADB timing enough to matter.

Here's the updated adb.c and the simple ADB-USB converter I wrote (with a makefile):

blargg-adb-usb-1.zip (http://blargg.8bitalley.com/avr/blargg-adb-usb-1.zip)

The above can be used as a standalone ADB-USB converter (I'm using it right now to type this).

The new ADB code doesn't disable interrupts at all. You could do that around the calls to the adb code. I think if you're going to disable them, you could do it for the entire call, not just when the keyboard is talking.


Changes
-----
* Documented header and source a little more and added some symbolic names for error values.
* Rearranged functions in source to not need prototypes.
* Merged lots of functions where there was no loss in clarity.
* Added adb_host_kbd_modifiers() to get keyboard modifiers, just because it was only 3 lines of code and it could be useful to someone in the future for a keyboard driver.
* Added config.h support for setting ADB_PORT etc.
* Eliminated constant reconfiguring of ports every time they're used. We can set them up once in init and depend on them not being messed with. If someone else is screwing with our configuration, then that needs to be fixed, rather than us constantly reconfiguring them.
* Changed to using open-collector output and relying on external 1K pull-up resistor. This is how ADB devices do it and avoids possibility of us driving bus high while keyboard pulls it low.
* Moved bit-reading code into adb_host_talk so that we can report any bit timing errors rather than ignore them.
* Optimized code to be smaller and thus have less timing overhead.


Timing fix
----------
The biggest issue was wait_data_lo() and wait_data_hi(). Their loop delayed delayed 1 us in *addition* to the loop overhead, which was 1.5 us on its own due to gcc not inlining and the data_in() reconfiguring the port every time. This could have been throwing timing off so that it was just on the edge of working, failing when timing was just slightly off.

Now the code compensates so that loop is exactly 1 us (16 cycles). This allows return value to be used to calculate how long pulse was in the bit reading code. In addition, it logs every timing value so that we can look at them later and see how well within margins it's timing things, and be sure that the times it's measuring match the times of the actual pulses coming in. It just puts them into an array for examination by the calling code.

The new bit reading code times the low and high portions, then determines whether it's a 0 or 1 based on which was longer than the other, rather than looking at absolute times. In the simulator it's show itsely very robust to wide variations in timing.

The timing is still affected slightly by the overhead between calls to wait_*, but it's only a few us.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 09 October 2013, 00:54:56
excellent work! ill look into later.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Wed, 09 October 2013, 22:05:29
Small tweak to adb.c line 48:

// gcc is very unreliable for inlining, so use macros
#define data_lo() (ADB_DDR |= data_mask)
#define data_hi() (ADB_DDR &= ~data_mask)
#define data_in() (ADB_PIN & data_mask)

Making these macros ensures that they are inlined, something hard to get GCC to do consistently. This is important for timing.

Argh, I also see that I based my adb.c on the one from December 10, 2012, rather than the current one. So you'll have to add the adb_host_listen(0x2B,0x02,0x03) call to init (though I think it should be done by the caller).
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 10 October 2013, 20:30:27
I added files from blargg's excellent wokrk into my repository, but it is not integrated and not default yet at this time. I need time to understand his work and code and after that I'll work on merging. You can use blargg's ADB protocol stack with 'make -f Makefile.blargg'.

Or his work itself is a complete ADB converter, you can just download zip archive from his post to use his ADB converter. His code is concise and skillful you may want to look through it.

Thanks.

Yeah, you are right. That command should be moved from adb.c. I'll fix it later.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Thu, 10 October 2013, 20:50:07
I'll see if I can learn how to use github to submit a patch myself. It's silly for me to make you try to grasp it all when I could do it in a few minutes.
Title: Re: ADB to USB keyboard converter
Post by: sprit on Fri, 11 October 2013, 08:00:58
For my Apple II gs ?

[attach=1]
Title: Re: ADB to USB keyboard converter
Post by: hasu on Fri, 11 October 2013, 23:09:11
I'll see if I can learn how to use github to submit a patch myself. It's silly for me to make you try to grasp it all when I could do it in a few minutes.

Thanks, but I know what I have to do: just replacement of my adb.c with yours.
The only problem is my ego, hehe; I'm hesitating to remove my own code from repository and trying to keep it somehow :D

I also saw your post in simavr ML, which said you dont want to be bothered by Git :) I can understand you! You've already done great job, I don't want to kill your time anymore.

sprit, I believe this converter also works on your IIgs, try it!
Title: Re: ADB to USB keyboard converter
Post by: blargg on Fri, 11 October 2013, 23:41:00
Except the locking caps lock of course. I'll get around to that in a few days.

Quote
The only problem is my ego, hehe; I'm hesitating to remove my own code from repository and trying to keep it somehow

Never fear, I was facing the same thing with me wanting my coding style there, and how I rewrote adb.c almost completely even though it wasn't actually necessary. So today I got the simulated timing tester all working, so it tests the code to be within ADB timing tolerances, and verifies that it can receive from the keyboard at timing limits. Now I'm going to *minimally* modify your original adb.c code to pass the test, so that your style etc. is preserved. It's a good exercise for me to not try to redo everything unnecessarily.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sun, 13 October 2013, 00:02:40
OK, here's my update of the current adb.c that you can just drop in. It's the fewest changes I could make and pass my tx/rx timing tests. I've kept it in your style. It was a good exercise to not do everything my way.

http://pastebin.com/RSK622dg

* data_* macros to ensure inlining
* data_* open-collector
* wait_data_* timing fix to exactly 1 usec per iter
* wait_data_* uint16_t on both for longer timeouts
* read_bit time both levels and compare, much more robust
* read_bit error reporting wouldn't work with just bool return value, so had to move into adb_host_kbd_recv()
* stop bit handled separately since its high portion doesn't end like other bits, and can have SRQ extension
Title: Re: ADB to USB keyboard converter
Post by: tufty on Sun, 13 October 2013, 00:46:06
blargg, hasu.

Awesome work.  Not had time to mess with this, but I'll see if I can make some time this week.

Simon
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sun, 13 October 2013, 15:21:09
I'm going to see whether I can get the ADB converter working on a USBasp 2.0 programmer, which is basically an atmega88 with zener diodes for voltage conversion to USB, a 12 MHz crystal, and connector to several pins. So I could put V-USB on it and the ADB code to have a really cheap converter (only a few dollars on eBay). I already got one of the programmers and it works great as a programmer, so the build quality is good. With a second one I can reprogram the first with the ADB and V-USB driver just by connecting the ISP cable between them.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 14 October 2013, 10:26:50
Thanks a lot. I merged your fix into repository.

OK, here's my update of the current adb.c that you can just drop in. It's the fewest changes I could make and pass my tx/rx timing tests. I've kept it in your style. It was a good exercise to not do everything my way.

http://pastebin.com/RSK622dg

* data_* macros to ensure inlining
* data_* open-collector
* wait_data_* timing fix to exactly 1 usec per iter
* wait_data_* uint16_t on both for longer timeouts
* read_bit time both levels and compare, much more robust
* read_bit error reporting wouldn't work with just bool return value, so had to move into adb_host_kbd_recv()
* stop bit handled separately since its high portion doesn't end like other bits, and can have SRQ extension


Title: Re: ADB to USB keyboard converter
Post by: hydrospell on Tue, 29 October 2013, 11:46:32
Hi hasu, blargg and JeffreySung

First off thanks so much for making and contributing to this project - a real lifesaver when it comes to resurrecting old keyboards.

I'd like to ask what the difference is between keyboard/IIgs and converter/adb_usb? I am able to successfully make using blargg's Makefile in adb_usb, but I can't make at all with the keyboard/IIgs files. Here's my dump below.

So I'd like to know

Thanks in advance for your patience.

Code: [Select]
mkdir -p obj_IIgs_Standard
Compiling C: matrix.c
avr-gcc -c -mmcu=atmega32u4        -gdwarf-2 -DF_CPU=16000000UL -DPROTOCOL_PJRC -DMOUSEKEY_ENABLE -DEXTRAKEY_ENABLE -DNO_PRINT -DNO_DEBUG -DMOUSE_ENABLE -DVERSION=b9fe36f-dirty -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_IIgs_Standard/matrix.lst -I. -I../.. -I../../protocol/pjrc -I../../common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_IIgs_Standard_matrix.o.d  matrix.c -o obj_IIgs_Standard/matrix.o
matrix.c: In function 'matrix_scan':
matrix.c:126:10: warning: implicit declaration of function 'host_keyboard_leds' [-Wimplicit-function-declaration]
matrix.c: In function 'read_col':
matrix.c:271:11: error: 'PINA' undeclared (first use in this function)
matrix.c:271:11: note: each undeclared identifier is reported only once for each function it appears in
matrix.c: In function 'unselect_rows':
matrix.c:295:5: error: 'DDRA' undeclared (first use in this function)
matrix.c:296:5: error: 'PORTA' undeclared (first use in this function)
matrix.c: In function 'select_row':
matrix.c:354:7: error: 'DDRA' undeclared (first use in this function)
matrix.c:355:7: error: 'PORTA' undeclared (first use in this function)
matrix.c: At top level:
matrix.c:176:13: warning: 'matrix_has_ghost_in_row' is static but used in inline function 'matrix_has_ghost' which is not static [enabled by default]
make: *** [obj_IIgs_Standard/matrix.o] Error 1
Title: Re: ADB to USB keyboard converter
Post by: hydrospell on Tue, 29 October 2013, 11:51:24
Oh frick just read the IIgs readme files :(


I've got a Teensy 2.0. Am I able to use adb_usb code to drive a IIgs keyboard then or do I have to get a Teensy++ 2.0 and build for that? (My keyboard will arrive only in the following couple of days)

Thanks.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 29 October 2013, 12:47:33
'keyboard/IIgs' is for replacing controller on inside of  keyboard with Teensy2.0++ and you need to mod your keyboard, while 'converter/adb_usb' is a converter for ADB keyboards including IIgs and you can keep keyboard intact.

You can convert your IIgs into USB keyboard with adb_usb and Teensy2.0. The converter doesn't require Teensy2.0++.
Title: Re: ADB to USB keyboard converter
Post by: hydrospell on Tue, 29 October 2013, 12:54:40
Thanks very much hasu. That's clearer to me now. So I just need to live with adb -> teensy -> usb (an additional attachment)

As long as I can start using the IIgs keyboard when I receive it I'm happy :)

May I ask what are the advantages of modding it with the Teensy 2.0++? Is the only benefit the more compact setup without having to have the adapter outside of the keyboard?

Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 30 October 2013, 00:43:21
I think you are right.
Not so different. The biggest difference is thier looking. jeffreysung's mod makes vintage IIgs into a complete modern USB keyboard. http://geekhack.org/index.php?topic=14290.msg304680#msg304680
As for their function what you can do with is almost same in practical usage or I can't come up with.
Title: Re: ADB to USB keyboard converter
Post by: hydrospell on Wed, 30 October 2013, 00:49:27
Thanks for the clear explanation hasu.
Title: Re: ADB to USB keyboard converter
Post by: hydrospell on Sat, 02 November 2013, 16:12:22
sorry to bother you - I tried making the file but when I load it onto the teensy and usef hid_listen, all I get is

Code: [Select]
adb_host_kbd_recv: ERROR(FFFE)
adb_host_kbd_recv: ERROR(FFFE)
adb_host_kbd_recv: ERROR(FFFE)
adb_host_kbd_recv: ERROR(FFFE)
adb_host_kbd_recv: ERROR(FFFE)
adb_host_kbd_recv: ERROR(FFFE)
adb_host_kbd_recv: ERROR(FFFE)
adb_host_kbd_recv: ERROR(FFFE)
adb_host_kbd_recv: ERROR(FFFE)

This is even before I connect my keyboard.
Any ideas? Thanks.
Title: ADB to USB keyboard converter
Post by: hasu on Sat, 02 November 2013, 22:55:48
it looks like conection has something wrong, it has pull up resister?
edit: ah, keyboard isnt conected yet? see how it goes when conected.
Title: Re: ADB to USB keyboard converter
Post by: hydrospell on Sun, 03 November 2013, 01:03:35
I have connected my keyboard to the teensy like such

adb         teensy
1 (data)      D4
2 (PSW)      D5
3 (+5v)      VCC
4 (GND)      GND

I have this in my config.h

Code: [Select]
#define ADB_PORT        PORTD
#define ADB_PIN         PIND
#define ADB_DDR         DDRD
#define ADB_DATA_BIT    4
#define ADB_PSW_BIT     5       // optional

I have not soldered a resistor yet. Should I try soldering a resistor?

Do I connect resistor from D4 (my DATA port) to VCC?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 03 November 2013, 01:12:21
right, place resister like 1k ohm between vcc and data line.

psw line isnt used by default, you dont need in fact. but it wont harm anything.
Title: Re: ADB to USB keyboard converter
Post by: hydrospell on Sun, 03 November 2013, 10:47:14
hasu, I'm very happy to report that your firmware is working 100% despite my very bad soldering!  :) The resistor made it work perfectly. I was also able to map the keys correctly with your keymap.c. Very very happy with how this turned out and I can't thank you enough.

Thank you so much hasu.
Title: Re: ADB to USB keyboard converter
Post by: hydrospell on Sun, 03 November 2013, 10:51:45
I would like to add that keystrokes are not dropped so far, and quick keystrokes are registered perfectly. I map ww to :w in my vim so I have to type w twice very quickly to trigger :w - no issues at all with this firmware and keyboard.

If there are any tests or observations you'd like me to do please feel free to get me to do so, I'll be more than happy to contribute back in any little way I can.

For the record I'm using

Stripped s-video cable head soldered to Teensy 2.0
adb_usb firmware by tmk/hasu
10k1k resistor from VCC to DATA line note: typo, I bought a 1k ohm resistor
Apple Desktop Bus keyboard (aka Apple IIgs keyboard)

Thanks!
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sun, 03 November 2013, 12:57:13
Great to hear that the revised ADB driver is working better for a demanding typist! It was most likely merely reducing the polling frequency.

And yeah, with my revisions to the ADB driver the pull-up resistor is required. This way rather than maybe working without it with one wondering why, it flat out requires it. Also, my tests on an oscilloscope show that a 1K is the better value rather than 10K, though 10K should be fine.

Hmmm, I wonder whether we could allow the absence of a pull-up resistor by tying several input pins together, all with weak internal pull-ups. This would allow people to build this without needing resistors. Datasheet lists internal pull-up from 20k to 50k, so 5 pins connected together would yield 4k to 10k pullup.

Yes, this works. 5 pins tied together with weak pull-ups gives a ~7k pullup on my Teensy, and ADB works. Given how many unused pins there are this might save someone having to locate a resistor, and make this require nothing more than the Teensy and an s-video cable cut in half. The main drawback of this is that you have to be sure the code doesn't configure the pull-up pins as outputs.
Title: Re: ADB to USB keyboard converter
Post by: hydrospell on Sun, 03 November 2013, 12:59:03
I'm definitely not a demanding typist :)

Your work is much appreciated sir. Again, I reiterate my offer to do testing with my setup if required, with what I have listed as above.

Thanks!
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 04 November 2013, 08:46:01
hydrospell, thanks for your reporting and offer for further testing.
happy to hear your IIgs goes well now. Let me know if you run against any problem with your keyboard.

blargg, putting together multiple I/O  is very interesting idea! It will be useful for those who don't have pull-up resistor in hand :)
Title: Re: ADB to USB keyboard converter
Post by: thegagne on Mon, 04 November 2013, 09:30:04
So I have a few ADB Apple KB, and I want to make use of one, what's the best method at this point? Is this project mature? Should I just pull the controller and put a teensy in, or convert it? Find an old iMate?
Title: Re: ADB to USB keyboard converter
Post by: tufty on Mon, 04 November 2013, 10:05:21
Hasu's converter is certainly mature enough to use, but may* still drop keys on certain models (sorry hasu, been too busy to repatch my m0116 mappings into your code, I'll try and get round to testing again soon, I promise). 

If you don't have an iMate lying about, drop the cash on a teensy and give it a go.  Worst case, you can rip out all the ADB circuitry, get handy with the soldering iron, and use either hasu's or soarer's "raw matrix" drivers for the teensy.

Simon

* it did last time I tried, but I haven't tested recently, and there's been a major rehash of the ADB code since then.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Mon, 04 November 2013, 12:12:13
Okay, took the time to do it.

I'm still getting dropped keys, particularly with "double" letters. Ironically enough, it just dropped one of the "t"s in "letters" and I had to edit. It's a *lot* better than before, but it's still an issue, at least for my M0116.

To give you an idea of the difference, I just had a shot at ztype (http://phoboslab.org/ztype/) using it.  I usually hit 45-50 wpm and 98%+ accuracy using the same keyboard hooked to an iMate, with the teensy I couldn't do any better than 27wpm and 91% accuracy.

Back to the iMate for me at the moment.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Mon, 04 November 2013, 12:37:42
I wonder whether the iMate is polling faster and thus able to handle a higher typing speed. That is, there is a sweet spot of polling rate where it's not too low for fast typists, and not too high that the keyboard drops keys. hasu, you have meta-commands, correct? You could add one to adjust the polling rate in half-msec or so increments (and print it to hid). That would solve the polling rate issue if that's the cause.

(typed on an M0116 without problem, so apparently I'm not a very fast typist)
Title: Re: ADB to USB keyboard converter
Post by: tufty on Mon, 04 November 2013, 13:04:34
I wonder whether the iMate is polling faster and thus able to handle a higher typing speed. That is, there is a sweet spot of polling rate where it's not too low for fast typists, and not too high that the keyboard drops keys. hasu, you have meta-commands, correct? You could add one to adjust the polling rate in half-msec or so increments (and print it to hid). That would solve the polling rate issue if that's the cause.

(typed on an M0116 without problem, so apparently I'm not a very fast typist)
I think it's more likely to be driving the adb protocol handler via interrupts.  IIRC the processor used on the iMate is significantly less capable than the teensy.

The teensy *is* capable of handling full-whack ADB without dropping events (check out https://code.google.com/p/waxbee/ which handles adb tablets, these drive the ADB connection harder than it should be capable of going), but it absolutely has to be doing the ADB low level protocol via interrupts to do it.  If you miss an edge, you lose a packet, simple as that. 
Title: Re: ADB to USB keyboard converter
Post by: thegagne on Mon, 04 November 2013, 17:35:00
Hasu's converter is certainly mature enough to use, but may* still drop keys on certain models (sorry hasu, been too busy to repatch my m0116 mappings into your code, I'll try and get round to testing again soon, I promise). 

If you don't have an iMate lying about, drop the cash on a teensy and give it a go.  Worst case, you can rip out all the ADB circuitry, get handy with the soldering iron, and use either hasu's or soarer's "raw matrix" drivers for the teensy.

So... how's the performance on teensy with "raw matrix" drivers? I don't think I can handle drops...
Title: Re: ADB to USB keyboard converter
Post by: blargg on Mon, 04 November 2013, 21:59:11
It's a *lot* better than before, but it's still an issue, at least for my M0116.
Can you come up with an easy-to-do test that shows the dropped keys that a non-touch-typist could reproduce? I want to make this happen on my M0116, so I can solve this problem. If I have to rewrite the ADB code to be interrupt-based and use input capture, so be it.

If you're willing, my plan is to have you try a version I've done of the ADB keyboard driver that uses PJRC's USB driver and my own glue code to adb.c, then if that doesn't work, a version with adjustable polling rate, then if that doesn't work, a rewrite using interrupts and input capture.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Tue, 05 November 2013, 00:56:19
It's a *lot* better than before, but it's still an issue, at least for my M0116.
Can you come up with an easy-to-do test that shows the dropped keys that a non-touch-typist could reproduce? I want to make this happen on my M0116, so I can solve this problem. If I have to rewrite the ADB code to be interrupt-based and use input capture, so be it.
Not really.

I would conservatively estimate my sustained rate outside "sprint typing" games at around 35wpm - better than a "hunt and peck" typist but not full touch-typing speed as a secretary would use it.  This is mainly because my technique is awful...

I see most drops on repeated letters, a case where there is significantly less finger movement between keystrokes.  Hammer action if you will, maybe 50 wpm+  My guess is that the code that processes a "finalised" keystroke is delaying things enough to make the difference.

So I suppose a qualitative test would be to go for "double keypresses", as fast as you can.

Quote
If you're willing, my plan is to have you try a version I've done of the ADB keyboard driver that uses PJRC's USB driver and my own glue code to adb.c, then if that doesn't work, a version with adjustable polling rate, then if that doesn't work, a rewrite using interrupts and input capture.
Sure thing.  My teensy is set up as follows under hasu's code:
Code: [Select]
/* ADB port setting */
#define ADB_PORT        PORTC
#define ADB_PIN         PINC
#define ADB_DDR         DDRC
#define ADB_DATA_BIT    7

So... how's the performance on teensy with "raw matrix" drivers? I don't think I can handle drops...
Not heard any complaints with either hasu's or soarer's code.  hasu's code has been used on the ergodox, which should be capable of some really fast action.

Title: Re: ADB to USB keyboard converter
Post by: CarVac on Tue, 05 November 2013, 06:49:47
So... how's the performance on teensy with "raw matrix" drivers? I don't think I can handle drops...

I type ~100-105 wpm and the teensy 2.0++ is not a problem on my reborn Thinkpad keyboard.

The only time I drop letters is when a wire pulls out of the breadboard, but that'll be cured once I finalize the analog electronics and lay it out all on a PCB.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Tue, 05 November 2013, 14:07:09
I had an idea for testing high-speed typing: wire another microcontroller up to the keyboard and have it generate automated keypresses of adjustable frequency, and adjustable synchronization to ADB polling (in case that affects dropping, so it can trigger worst-case behavior). Then find what a Mac can handle, what the Belkin adapter can handle, and what our code can handle (I don't have an iMate unfortunately and don't know how well the Belkin compares).

tufty, what OS are you using (in case that affects USB polling rate or something)? If it's Windows, I think all I've got is some version of XP on a laptop.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Tue, 05 November 2013, 14:08:48
Yeah, thrashing adb down the line at it would work, I'd guess.  Of course, you'd have to have a reliable adb protocol *generator* for that ...

I'm on OSX, BTW.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Tue, 05 November 2013, 14:32:33
Oh, I meant having the tester directly connected to the keyswitches on the M0116 keyboard itself, simulating human presses as closely as possible to the real thing. Though yours is an interesting idea as well. I kind of have done this with the simulator, feeding the ADB driver data of varying timing and verifying that it handles everything within spec. But this doesn't have the USB stuff running which is might be the culprit.

OS X, good, I have a PPC iMac running 10.5.x I could fire up for this.
Title: Re: ADB to USB keyboard converter
Post by: Soarer on Tue, 05 November 2013, 15:09:02
A little project to press keys etc. would have other uses as well, like generally analyzing a keyboard's scan rate, debounce time and method, etc.

Being able to 'press' four keys ought to be enough, using something like a 74HC4066 (http://www.nxp.com/documents/data_sheet/74HC_HCT4066.pdf) quad analogue switch. Could always use more than one of them. A teensy could drive it with a variety of patterns at different speeds. I'm thinking you'd send a command to the Teensy to start each sequence, so it could also be used to measure total lag (like namenlos did).
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 07 November 2013, 15:52:10
tufty, thanks for testing.
I don't have any missing keystroke on my ADB boards since blargg's fix was merged. And I tried your github repositry and had no drop key during short run.

I doubt it misses signal so often, ADB is totally host driven polling protocol and device doesn't send data asynchronously. Host sends talk command and waits for response from keyboard, we can know when keyboard send data and use busy-wait. I think it doesn't necessarily need interrupt based code. It is the case in particular unless busy-wait is disturbed by other interrupts.


MINOR CODE CHANGE:
I added cli() in adb.c to prevent interrupts from breaking timing of busy-wait. This would be stupidly long block like several milli seconds, but the converter has no other critical task fortunately.
https://github.com/tmk/tmk_keyboard/commit/94823030f00e9293ffc7ae4bec9611c8224d3532

Without this cli() block I don't have any minssing keys but during typing I occasionally see errors at:
https://github.com/tmk/tmk_keyboard/blob/c18c52f551545b46a28902c69730eefbdb75577d/protocol/adb.c#L142
This error seems to be no harm, though, use of cli() can suppress it.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Fri, 08 November 2013, 00:24:20
The extra USBASP arrived and I've got V-USB and the ADB code running it somewhat decently (typing this using it). I was able to use the jumper posts to get the signals for ADB. +5V from the voltage selection, and an I/O pin and GND from the clock select jumper posts, so no physical modifications to the USBASP board (other than installing the jumper posts for J2 and J3, as they don't come installed). The breadboard just has the 1K pull-up resistor. It was easier to just bring the jumper posts over there rather than try to connect my ADB socket's wires to the board directly.

(http://i.imgur.com/evwOfLB.jpg)

(http://i.imgur.com/vjZxSwr.jpg)

EDIT: nice, I got the ADB polling synchronized with the V-USB interrupts so that I can disable interrupts for the entire ADB code (send command to keyboard, receive response) and not disrupt USB. So this is allows a $3 ADB-USB converter ($6 if you need to buy a second USBASP to reprogram the first).

EDIT2: I made the key tester, though it's on the Teensy so I can't test the Teensy versions until some new atmega chips arrive to move the tester program over to. Testing the Belkin USB-ADB adapter, the maximum key press rate without dropped keys on an M0116 is 14.3 per second. With my V-USB version on a reprogrammed USBASP (atmega8 at 12 MHz), the maximum key press rate is 13.9 Hz (just a hair lower than the Belkin). Each test closes the contacts of the switch on the M0116 keyboard to cause 80 presses of the same key at the maximum rate and I check for any dropped or wrong.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sat, 09 November 2013, 12:52:36
More maximum key press rates (e.g. on M3501 with USBASP-based converter, you can press the same key 31 times per second without any being lost):
Code: [Select]
31.3Hz M3501 USBASP with reduced ADB time
29.4Hz M3501 Belkin

15.2Hz M0116 USBASP with reduced ADB time
13.9Hz M0116 USBASP
14.3Hz M0116 Belkin

10.4Hz M0487 USBASP with reduced ADB time
10.2Hz M0487 Belkin

I reduced the ADB command sending time by 25% (still within spec by 5%), which upped its maximum rate slightly.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 09 November 2013, 14:16:48
Great job again! blargg,

How did you sync with V-USB? IIRC V-USB consumes about 50us with its interrupt rouine of USB and that breaks ADB communication.
Can we get to access your code some later? Ingriguing.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Sat, 09 November 2013, 14:27:14
That's sounding extremely positive.  If you have test code, I'd be happy to give it a go.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sat, 09 November 2013, 18:09:24
Moved my key tester to another AVR and tested TMK LUFA version on the Teensy. Timings came out slightly differently for others, so I retested everything. Unfortunately I'm not finding any problem with the TMK version as compared to the Belkin and VUSB ones, so this hasn't isolated the dropped key issue.

Code: [Select]
Maximum key press rate for various keyboards and USB-ADB adapters:
29.4Hz M3501 Belkin
27.8Hz M3501 USBASP
26.3Hz M3501 TMK LUFA

15.2Hz M0116 TMK LUFA
15.2Hz M0116 USBASP
14.7Hz M0116 Belkin

14.3Hz M0487 TMK LUFA
13.5Hz M0487 Belkin
10.9Hz M0487 USBASP

Now to ready this USBASP version for posting here.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sun, 10 November 2013, 01:44:31
OK, here's the source code and some documentation for this USBASP version of the ADB code:

adb-usb-usbasp-1.zip (http://blargg.8bitalley.com/avr/adb-usb-usbasp-1.zip)

The simplest wiring just involves cutting the extra ISP ribbon cable you'll have from the USBASP and splicing the ADB cable to it (here I'm using a header that plugs into the breadboard, since I'm not going to build a permanent cable):

(http://i.imgur.com/5L9ZYqv.jpg)

The other approach is to connect to the jumper pins on the USBASP board. This allows keeping the ADB keyboard connected to the USBASP, the USBASP plugged into USB and into the ISP cable to the reprogrammer, and the reprogrammer also plugged into USB, all at the same time. This way you can reprogram the USBASP as you debug this code, and not have to unplug anything each edit-debug cycle:

(http://i.imgur.com/GYaQ13L.jpg)

EDIT: hmmm, I just realized that the 1K series resistor on the TX pin of the USBASP board could be used as the pull-up for ADB; just tie TX and RX together and have the code keep TX high. So no extra components needed, just wires to wires when using the ISP cable cut in half.

EDIT2: It wasn't surviving a host suspend+resume. Fix: insert an adb_keyboard_poll() call in input.c line 211:

Code: [Select]
        if ( diff > (byte) min_tclocks )
        {
            prev_time = time;
            break;
        }
       
        usb_keyboard_poll(); // inserted
    }

Now that I know what happens during suspend, I should make the power key on the ADB keyboard wake the host.

EDIT3: I got host wakeup working using the ADB power key. Haven't updated code archive yet.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sun, 10 November 2013, 16:54:25
Oh wow, I just figured out a way to make it miss a key easily: press the key down for only a split-second. This generates the key down and key up events together in the same 16-bit word returned, and at least my handler nullifies it (adds to keys held, then removes, before sending off to USB). So we need to check for this condition, and if it holds, defer the key up until after sending off the key held status to USB.

BTW, I was causing this to occur on the M3501, by far the fastest-responding of all the keyboards above. So since it occurs there, it'll be easier to make occur on others.

Seeing if I can reproduce this on the TMK LUFA version, and then come up with a fairly clean fix to that and mine.

EDIT: With this fix to the USBASP version, it can handle up to 41.7Hz key press rate without loss on an M3501. It should be able to handle 60Hz, so there's some room for improvement :)

EDIT2: Argh, this doesn't help the M0116 at all. I guess it is unable to deliver the press and release events in the same exchange.
Title: Re: ADB to USB keyboard converter
Post by: hydrospell on Sun, 10 November 2013, 22:28:48
blargg

you're operating at such a high (low in terms of programming?) level that I honestly have no idea what you're doing, except you're doing important work for us who want to use teensy with these obsolete keyboards!

FWIW I've seen no key dropping problem yet on my IIgs board. I'm a 90wpm typist on typeracer if that means anything -- are you optimizing for much higher typing speeds than this? 41.7Hz key press rate is pretty intense. (insert fingering joke)

cheers
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sun, 10 November 2013, 23:22:01
My main goal is to have as clear an idea of what all is happening and why. This naturally leads to a cleaner design that gets better performance out of ADB.

I've done more research into the fundamental limitations of USB on the AVR MCUs and the ADB keyboards:

* V-USB has an opportunity to update the keyboard every 8ms; you either use that opportunity or wait until the next one 8ms later. No variation. Interrupt also occurs at that rate. This was consistent across Linux and an iBook running Mac OS 9.2.2 and Mac OS 10.4.11.

* Teensy USB (PJRC) can update every 2ms (only tested on Linux). Interrupt activity is minimal. Fine to disable interrupts during ADB.

* ADB keyboard internal polling rates, worst-case (keys constantly being pressed and released, ADB transaction between every poll): M3501 122Hz, M0116 57Hz. Note these are calculated based on looking at the polling signals with a scope. I hope to actually produce these key rates (half that of course) at some point to confirm these calculations.

* Internal polling rates are slightly higher when no keys are being pressed because ADB activity pauses internal polling until the transfer is done. This is why polling too quickly, especially on keyboards with lower internal polling rates, can cause them to become slow to respond, as this lowers the polling rate. In the extreme, you could cause the internal polling rate to go down to 1 Hz.

* Key pressed and released between ADB reads: M3501 generates key down and key up events for same key on next ADB read. M0116 doesn't generate anything apparently.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Mon, 11 November 2013, 20:37:28
Update to the USBASP code:

adb-usb-usbasp-2.zip (http://blargg.8bitalley.com/avr/adb-usb-usbasp-2.zip)

* Keyboard works after resume from sleep.
* Power key wakes host.
* Changed polling to 12ms (83Hz). Works better with M0116. Can still be adjusted back to 8ms (125Hz) in main.c
* Fixed dropped key when it's pressed and released in same ADB event.
* Reorganized code and made USB synchronization more robust.

I also found that the M0116 can generate simultaneous key down and key up events in one ADB transaction, so maybe this was the problem occurring there too.

I achieved 41.1Hz single key press rate on the M3501 when I set the polling period to 8ms in the USBASP code.

Now on to the Teensy code, which can send USB updates every 2ms.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 14 November 2013, 15:59:28
blargg, Thanks for your testing and further research. Incredibly great skills and jobs!

Ah, this is very likely the cuase of key drop problem. I'll fix this fault of my firmware with how your 'extra_key' does later.

I also found that the M0116 can generate simultaneous key down and key up events in one ADB transaction, so maybe this was the problem occurring there too.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Thu, 14 November 2013, 18:03:08
I've spent the last few days full-time working on this code. New versions of my USBASP and Teensy ADB converter code (renamed projects for clarity):

blargg-adb-usbasp-3.zip (http://blargg.8bitalley.com/avr/blargg-adb-usbasp-3.zip)

* Now merges extra ADB events with next where possible, making better use of limited USB update opportunities.
* Eliminated adjustable ADB polling rate, as higher rates only hurt, and improved USB synchronization made adjustable polling impossible.
* Consolidated sources.
* Using 16-bit timer1 for everything.

blargg-adb-teensy-2.zip (http://blargg.8bitalley.com/avr/blargg-adb-teensy-2.zip)

* Changed polling to 12ms (83Hz). Works better with M0116. Can still be adjusted back to 8ms (125Hz) in main.c
* Fixed dropped key when it's pressed and released in same ADB event.
* Reorganized code to be in sync with v-usb version.
* Disable interrupts for all ADB transactions.
* Send each ADB event byte as a separate USB report. This ensures things are in order and cleanly handles cases when the same key is pressed then released in a single ADB event.

More research

* The M0116 can generate key down and key up in same event word.

* Just as keyboard can report key down then key up in same event (key down in upper byte), it can report key up then key down in same event (in this case, the key up is in the upper byte).

* The keyboards buffer up key presses done faster than ADB polling. In a test on the M0116, I polled ADB only once every four seconds. Pressing a, waiting until it appeared, then pressing 123456 quickly resulted in 1234 being received over the next 16 seconds. So buffer is 4 keys. And on the M3501, it buffers 16 key presses. It even buffers the relative order of presses and releases of multiple keys, replaying everything as it occurred. So it's likely that the buffers are actually 8 and 32 events, respectively, holding key press and release events until they're read by host. I never realized how involved the driver in a keyboard could be.

* Power key presses are buffered just as others.

* Power key press generates 7F7F, and release FFFF. These special encodings are necessary to differentiate between the FF merely meaning no event (the 7F7F isn't necessary; press could be encoded like any other key).

* A 12ms ADB polling rate is ideal, even for the M3501; 8ms only improves maximum key press rate by a hair, and 4ms just makes it far worse.

Handling key press and release in same event

With the Teensy USB, the host can poll it as quickly as every 2ms, so handling key press and release in same event is trivial: just handle each as a separate USB report. In my Teensy code I always handle the two ADB bytes separately, since this preserves the order of key presses as well.

An easy way to check whether your handling of this is working is to lower your ADB polling rate to say once a second, ensuring that any key presses result in a key down and key up in the same event.

In my V-USB code, where USB polling is only 8ms, I intelligently defer and merge ADB events across polls, to keep the report rate as high as posssible. As the code shows, this is very involved and I wouldn't recommend it on the Teensy at all.

Timings

With my improved Teensy and V-USB code, I get what might be the best possible timings on the M3501 (the M0116 timings are the same as before):

Code: [Select]
41.7Hz M3501 blargg-adb-usbasp-3
38.5Hz M3501 blargg-adb-teensy-2

The M3501 polls around 122Hz, which would suggest a 61Hz maximum key press rate. But, for debouncing purposes, it might require two polls of the key released before it will register another key press. If this is true, then the maximum key press rate would be 40.7Hz.

Disabling interrupts during ADB

For the Teensy code, interrupts should be disabled for all of ADB code, including when sending. The USB hardware means that you don't need interrupts enabled constantly. I mention this hasu because I think your current ADB code only disables interrupts when receiving from the keyboard.

Continuing the search for the dropped keys problem

The latest Teensy code I posted is worthy of continued testing for the dropped keys problem. tufty, if you could give this a try on your M0116, that'd be great. I can then continue my earlier list of things to try if even this doesn't work.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Fri, 15 November 2013, 01:49:48
Hi Shay

Any chance you could put the teensy code up on github?  Doesn't compile out of the box for me (gcc 4.6.2), I'll clone on my account and see if I can patch up the errors.  Otherwise, the errors are issues with non-const stuff with __attribute__(progmem).

Code: [Select]
error: variable ‘…’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’items in error so far are device_descriptor, keyboard_hid_report_desc, config1_descriptor, string0, string1, string2 and descriptor_list.

There's also a warning on __builtin_avr_delay_cycles being implicitly defined.

Cheers

Simon
Title: Re: ADB to USB keyboard converter
Post by: blargg on Fri, 15 November 2013, 13:16:31
OK, after some bumps I've got a repo up for it (thanks for the push to figure git out):

https://github.com/gblargg/adb-usb

It was probably the -Wall and -Wextra options in the Makefile causing the problems, which I've removed from the Makefile. I'm using avr-gcc 4.5.3 which probably doesn't have as strict warnings.

I also built a .hex file for you using your settings posted earlier (PORTC, bit 7), if you want to just flash this without building the source:

blargg-adb-usb-3.hex.zip (http://blargg.8bitalley.com/temp/blargg-adb-usb-3.hex.zip)
Title: Re: ADB to USB keyboard converter
Post by: tufty on Mon, 18 November 2013, 04:06:00
Had a heavy weekend, haven't had time to play.  I'll try and get a test or two done in the next day or so.

Simon
Title: Re: ADB to USB keyboard converter
Post by: tufty on Wed, 20 November 2013, 07:45:14
Helluva week going on, but just had a try.

a - binary doesn't work.  My guess is that it's built for teensy2.0++ rather than teensy 2.0
b - code won't compile.  It mentions DDRA, which apparently the teensy 2.0 doesn't have, and tries to use _builtin_avr_delay_cycles, which I don't appear to have either.

Haven't had a chance to dig much more, maybe tonight.

Simon
Title: Re: ADB to USB keyboard converter
Post by: blargg on Wed, 20 November 2013, 12:50:58
OK, rebuild for your teensy 2.0 and pushed fixes for PORTA and __builtin_avr_delay_cycles issues (thanks for trying the code):

blargg-adb-usb-3-teensy-2.0.hex.zip (http://blargg.8bitalley.com/temp/blargg-adb-usb-3-teensy-2.0.hex.zip)

Hopefully the hex or source now works for you.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Tue, 26 November 2013, 01:42:06
So, the week's been hellish, but I just got a chance to play.

Firstly, your hex works fine on my teensy.
Secondly, as my typing without swearage will attest, there's no dropped keys so far.  This is most excellent news.  I just typed out a 400 word article at full clip, and the only issue I've seen was my slightly "sticky" space bar, and that's a mechanical issue.

You are a star.

Just noticed that the teensy's LED is glowing orange, though. Not sure if it's getting a high-freq 50% duty cycle signal across it, or if it's something to do with pin resets.  It's on PD6, IIRC

I'll probably end up hacking my "standard" M0116 layout into a fork of your code (the extended layout you have used swaps option and command on the M0116, and loses my second layer mappings), but it occurs to me that it should be possible to detect the type of keyboard at ADB startup, by looking at the original handler id the keyboard has, and swap layouts dynamically.  Useful for people building external converter boxes that need to handle both "standard" and "extended" keyboards.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Tue, 26 November 2013, 13:50:12
Great to hear! This gives us code that works, and tmk which drops keys, and among the differences a few that are the cause.

Quote
Just noticed that the teensy's LED is glowing orange, though. Not sure if it's getting a high-freq 50% duty cycle signal across it, or if it's something to do with pin resets.  It's on PD6, IIRC
Oh yeah, I have my code by default put all pins as inputs with weak pull-ups. This is the safest approach since nothing floats and anything else unexpectedly connected won't play tug-of-war with pins set as outputs. I didn't bother making PD6 an output held low. Will update the repo with that fix.

Quote
I'll probably end up hacking my "standard" M0116 layout into a fork of your code (the extended layout you have used swaps option and command on the M0116, and loses my second layer mappings),
Since you'll be doing more reflashing, I'd like to try implementing the key pressed/released in same event fix in tmk's code for you to try before you port the layouts to mine, so we can hopefully have tmk's working just as well as mine.

tmk github: "Remove tentative files from blargg"  Yay, I hated seeing my stuff clutter up the adb converter there. Simple is good :)

Quote
it should be possible to detect the type of keyboard at ADB startup, by looking at the original handler id the keyboard has, and swap layouts dynamically.  Useful for people building external converter boxes that need to handle both "standard" and "extended" keyboards.
Good idea. I'll have to see whether keyboards have some kind of model ID readable, or some low-level difference in how they respond.

Regarding reconfiguration, I've recently discovered bootloaders and the great USBaspLoader (and done a big rewrite of it which I'm releasing soon). These would be great for this kind of thing on the USBASP stick, and I remember seeing hooks for them in tmk's code even. Updating of the layouts without needing a separate progammer.

I also ordered some attiny85's and am going to put the ADB converter on to it. I think I can get it down to the attiny85, three generic small-signal diodes, a small capacitor, and a few resistors (two 1K, two 68 ohm). This will support USB self-reprogramming via avrdude, so layout customizations and bug fixes could be applied without any separate programmer.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Tue, 26 November 2013, 15:35:28
I forked tmk_keyboard and added the same-key-down-then-up-in-adb-event fix to it:

https://github.com/gblargg/tmk_keyboard

Also tested it by changing ADB polling rate to 1Hz (and tested that old code indeed lost the keys).

I see that hasu has modified the ADB code to wrap all bus operations in cli()/sei(), so it should be solid now, unless the problem is elsewhere in tmk's matrix handling, keyboard HID driver, or LUFA.

And no thanks to gcc for giving me a nice compiler bug that I spent an hour trying to realize was a compiler bug and not my bug. Confidence shaken in GCC, as it kept occuring until I convoluted my code and added volatile to get around it, though have no idea what conditions cause the compiler bug.

EDIT: I ran a test to see what differences the keyboard have via registers, for differentiating which is connected and automatically selecting the keymap:
Code: [Select]
        Talk   1    2    3
M0487 (IIgs): 0000 xFFF 6x08
M0116 (Kybd): 0000 FF00 6x01
M3501 (Ext2): 0000 FFFF 6x02

I just send a talk command (same as one for checking keys, just a different register number) and print the 16-bit result. The x nibbles were random. Register 3 is most promising. Bit 14 is service request enable, which defaults to 1, and bit 13 is exceptional event, set to 1 if not supported. So seeing a 6 there matches what the docs suggest. Bits 8-11 are the device address, which it apparently chooses at random? I was seeing values all over the place. I wonder whether my test code was somehow triggering a collision and the keyboard were choosing a random address.

The low byte is the one that is perfect for us. Docs show it's the handler ID. So that's it. IIgs crappy keyboard is 0x08, Apple Keyboard is 0x01, and Extended Keyboard II is 0x02.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Wed, 27 November 2013, 01:55:21
The device address *shouldn't* be random, it should be 2 for a keyboard.  It's wierd that you're seeing odd values.  Are you doing a full bus reset prior to checking addresses (shouldn't need to do address resolution, we only have one device)?

I'd recommend reading (and saving a copy of) Space Aliens Ate My Mouse (http://web.archive.org/web/20041012035642/http://developer.apple.com/technotes/hw/hw_01.html) if you haven't already.

Keyboard type resolution should definitely start with register 3's default handler id, and there may be some register 2 information allowing us to get more specific.

There's things that can be done with register 1 for specific keyboards, apparently - the iBook keyboard can be told to do different things through there (http://www.snark.de/mac/tpad/adbkbd.html), for example.  Chapter and verse is probably best got from the Apple's source, http://opensource.apple.com/source/AppleADBKeyboard/AppleADBKeyboard-232.0.1/AppleADBKeyboard.cpp for example.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 28 November 2013, 01:39:50
blargg,
I merged your fix of extra key. Thank you.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Thu, 28 November 2013, 01:47:39
Are you doing a full bus reset prior to checking addresses (shouldn't need to do address resolution, we only have one device)?
Currently the ADB code doesn't do any kind of reset. It'd be nice if it did an explicit reset in the beginning. It must be triggering a collision and causing this. I should get this resolved even though it's posed no problem.

Quote
I'd recommend reading (and saving a copy of) Space Aliens Ate My Mouse (http://web.archive.org/web/20041012035642/http://developer.apple.com/technotes/hw/hw_01.html) if you haven't already.

Keyboard type resolution should definitely start with register 3's default handler id, and there may be some register 2 information allowing us to get more specific.
Yeah, I scanned that and the other ADB docs (the IM chapter, IIgs ADB guide, and Microchip's app note) but I couldn't find any list of keyboard handler IDs like I found empirically.

Quote
Chapter and verse is probably best got from the Apple's source, http://opensource.apple.com/source/AppleADBKeyboard/AppleADBKeyboard-232.0.1/AppleADBKeyboard.cpp for example.
Interesting that it still has ADB vestiges that are preserved in the Darwin driver code.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Thu, 28 November 2013, 09:10:27
This might help - it's "classic" side, but there has to be a way of discovering - http://www.fenestrated.net/~macman/mirrors/Apple%20Technotes%20(As%20of%202002)/tb/tb_12.html

The adb stuff in Darwin is because, at least up to 10.4, supported machines still used it.  Keyboards and trackpads on (I think) the G4 iBook were ADB, for example.  I know my powerbook G4 is.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Fri, 13 December 2013, 22:33:45
I got some attiny85 chips and while the ADB converter works (including without an external crystal), it's not going to be any cheaper/easier than reprogramming a USBASP or some USB-equipped AVR board. USBASP is the way to go. Already-assembled with a USB connector, status LEDs, a place for a jumper, good bootloader support for self-updating, and an ISP connector and included ribbon cable to cut in half and connect the ADB cable to. This is ideal.

When I have some motivation I'll add keyboard type detection and support for different layouts for each type.
Title: Re: ADB to USB keyboard converter
Post by: multiholle on Sat, 14 December 2013, 10:25:41
I tried your Code with my Apple Extended Keyboard II and a Teensy 2.0. It worked a couple of times, but not always. Right now it's not working at all. When I enable the debug output I get the following:

Code: [Select]
Waiting for device:....
Listening:
debug enabled.
Keyboard start.

After that all three green LEDs of the keyboard are on and nothing happens if I press a key. Any ideas?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 14 December 2013, 18:27:45
blargg, nice. Can I have usbasploader and your converter with attiny85? 8KB is enough to do that?

multiholle, do you have pull-up resistor? Pic of your converter may help.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sun, 15 December 2013, 18:59:36
hasu, oh, do you mean can USBaspLoader fit on an attiny85 with the USB-ADB converter? They should combine fine, as the ADB-USB code is only about 3000 bytes, and the bootloader under 2000. The attiny85 is so limited that the bootloaders have to jump through extra hoops. The USBasp reprogrammed is preferable. It has more I/O pins even just on the end connector than the attiny, and a crystal. I'm curious as to what advantages an attiny85 has over it.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 15 December 2013, 19:35:59
Thanks, 3KB code size is great.
Yes. I was thinking about tiny85 with USBaspLoader+ADB converter because I prefered dedicated small DIY conveter than tentative setup with cheap USBasp hardware. But I found I don't have it in my parts box and I can get mega328p at almost same cost of tiny85 at local store :) I'll go with mega328p if I make my own DIY converter. But still 8pin DIP is attractive size for DIY converter.

I see, getting USBasp hardware from ebay is the best in terms of cost effective. I'll also get some.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sun, 15 December 2013, 20:33:48
Be sure you get the one that claims 5V/3.3V, otherwise you might get a cheaper one that doesn't expose the TX/RX pins. They might show a picture of the LC Soft one but still send the cheaper one, which is why to look for 3.3V with jumper selection claim, then it's the LC soft board. I should be receiving one from another seller and I'll report back which two so far sent me the right one.

Like you said, more capable atmega chips are about the same price as an attiny. Also the attiny series has fewer features, e.g. frozen while reflashing itself, which makes USB harder to handle without errors, no USART, only 8-bit counters. On the other hand, the tiny has a 16MHz internal RC, 20MHz maximum frequency, pin change interrupt, that only newer atmega chips seem to have.
Title: Re: ADB to USB keyboard converter
Post by: jacobolus on Sun, 22 December 2013, 05:51:48
Thank you guys so much for all the hard work. I just used the code from the master branch of tmk/tmk_keyboard, with a teensy 2.0 installed inside an M0116, and it works perfectly! (Though the default layout seems to have command and option keys switched; but that’s easy enough to reverse myself.)

Now I just need to figure out how to turn the caps lock key [I replaced the switch w/ a non-toggle version] into an Fn key, so I can use the regular number row for F keys, etc. That’s the project for tomorrow or the next day, now that the hardware part works.

Anyway, again thanks.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Sun, 22 December 2013, 10:50:23
Thank you guys so much for all the hard work. I just used the code from the master branch of tmk/tmk_keyboard, with a teensy 2.0 installed inside an M0116, and it works perfectly! (Though the default layout seems to have command and option keys switched; but that’s easy enough to reverse myself.)

Now I just need to figure out how to turn the caps lock key [I replaced the switch w/ a non-toggle version] into an Fn key, so I can use the regular number row for F keys, etc. That’s the project for tomorrow or the next day, now that the hardware part works.

Anyway, again thanks.
My fork of the tmk repository (https://github.com/tufty/tmk_keyboard) has a capslock-triggered function layer.  It's a bit behind hasu's repository, though. You should be able to do some mergery to get something that works.
Title: Re: ADB to USB keyboard converter
Post by: arfink on Wed, 15 January 2014, 20:18:19
Funny running into you again here Shay. It's been a long time. :)
Title: Re: ADB to USB keyboard converter
Post by: 128keaton on Mon, 24 March 2014, 10:41:29
Hello folks. I might be reviving a dead project, but I've been having trouble getting my Apple Keyboard II (m0487) to work. I am using an Arduino Micro, it should work. I've put the 1K resistor on the DATA Line. I am using the coiled cable, but it shouldn't matter as I have the 1k resistor. Currently, I've tried it on two Macs, but it doesn't want to work. USB Prober detects it. Everything appears to be in place, I just cannot get the keyboard to type! Any suggestions?

EDIT: I tested the keyboard on my macintosh classic, it works fine there. (ADB) so the keyboard is working.
Here is the setup:
(http://i.imgur.com/vcNED4x.jpg)

EDIT 2: Found the error:
Code: [Select]
adb_host_kbd_recv: ERROR(-17)
adb_host_kbd_recv: ERROR(-17)
adb_host_kbd_recv: ERROR(-17)
adb_host_kbd_recv: ERROR(-17)



I just have no idea what it means :P.
Title: Re: ADB to USB keyboard converter
Post by: robertarrington on Mon, 24 March 2014, 15:26:57
Hi.

I just purchased an AEKII on eBay and am interested in using this tool to convert its ADB signal to USB.

However, I accidentally purchased a Teensy 3.1 (MK20DX256). Is there any way to use this firmware with a 3.1?

Thanks
Title: Re: ADB to USB keyboard converter
Post by: jacobolus on Mon, 24 March 2014, 18:03:57
However, I accidentally purchased a Teensy 3.1 (MK20DX256). Is there any way to use this firmware with a 3.1?
No. If you’re willing to write a whole bunch of code, then some of Hasu’s code could probably be re-used. But that’s probably a multi-week effort for a competent programmer.

Just go buy a Teensy 2.0, or some similar little microcontroller (there are some tiny Arduino clones on ebay for $5/each).
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 24 March 2014, 18:49:27
128keaton,
Pull up resistor should be connected in parallel between Data line and 5V. Your resistor is located in series. I assume green line is Data line, the line should be connected to a port PD0  directly and the resister between 5V and PD0.


For later reference,

PULL UP RESISTOR:
Code: [Select]
Keyboard       Conveter
               ,------.
5V------+------|VCC   |
        |      |      |
        R      |      |
        |      |      |
Data----+------|PD0   |
               |      |
GND------------|GND   |
               `------'
R: 1K Ohm resistor

WRONG:
Code: [Select]
Keyboard       Conveter
               ,------.
5V-------------|VCC   |                                                                                                             
               |      |
               |      |
               |      |
Data----R------|PD0   |
               |      |
GND------------|GND   |
               `------'
Title: Re: ADB to USB keyboard converter
Post by: jacobolus on Mon, 24 March 2014, 19:09:37
128keaton, yeah, as Hasu says, you want to plug the resistor into your breadboard to directly connect the 'data' and +5V pins. (You don’t need to attach it to the wires coming from your ADB plug.)
Title: Re: ADB to USB keyboard converter
Post by: 128keaton on Mon, 24 March 2014, 19:52:13
128keaton, yeah, as Hasu says, you want to plug the resistor into your breadboard to directly connect the 'data' and +5V pins. (You don’t need to attach it to the wires coming from your ADB plug.)

128keaton,
Pull up resistor should be connected in parallel between Data line and 5V. Your resistor is located in series. I assume green line is Data line, the line should be connected to a port PD0  directly and the resister between 5V and PD0.


For later reference,

PULL UP RESISTOR:
Code: [Select]
Keyboard       Conveter
               ,------.
5V------+------|VCC   |
        |      |      |
        R      |      |
        |      |      |
Data----+------|PD0   |
               |      |
GND------------|GND   |
               `------'
R: 1K Ohm resistor

WRONG:
Code: [Select]
Keyboard       Conveter
               ,------.
5V-------------|VCC   |                                                                                                             
               |      |
               |      |
               |      |
Data----R------|PD0   |
               |      |
GND------------|GND   |
               `------'


128keaton, yeah, as Hasu says, you want to plug the resistor into your breadboard to directly connect the 'data' and +5V pins. (You don’t need to attach it to the wires coming from your ADB plug.)



Alright. I did that, thanks. Still no success. Hm.
(http://i.imgur.com/JkbXjfm.jpg)
Any more ideas?

Key:
Yellow = 5V
Yellow/Orange = GND
Green/Yellow = DATA before 1k
White = DATA after 1k which leads to RX/0


(http://arduino.cc/en/uploads/Main/ArduinoMicro_Pinout2.png)
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 24 March 2014, 20:12:33
Error -17 means converter can't communicate with keyboard at all, check your wires again. Are you sure about connector pinouts?
Posting pics of your connector may help.
Title: Re: ADB to USB keyboard converter
Post by: 128keaton on Mon, 24 March 2014, 20:22:03
Error -17 means converter can't communicate with keyboard at all, check your wires again. Are you sure about connector pinouts?
Posting pics of your connector may help.
(http://i.imgur.com/RnQB277.jpg)This good enough?
Or do you need more detail. Are all of the ports mirrored?
Title: Re: ADB to USB keyboard converter
Post by: jacobolus on Mon, 24 March 2014, 20:47:35
Perhaps you can figure it out with a continuity tester, probing some points on the keyboard itself and your breadboard?
Title: Re: ADB to USB keyboard converter
Post by: 128keaton on Mon, 24 March 2014, 20:51:03
Perhaps you can figure it out with a continuity tester, probing some points on the keyboard itself and your breadboard?
Okay, ill do that really quick.
EDIT: It all connects fine! Everything seems to be how it should be! I tested to make sure my pens weren't reversed, and they weren't.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 24 March 2014, 21:11:36
Hmm, I think you connect them wrongly. Ask Google about ADB connector  pinouts and take time to look into your wires.
Title: Re: ADB to USB keyboard converter
Post by: 128keaton on Mon, 24 March 2014, 21:18:10
Hmm, I think you connect them wrongly. Ask Google about ADB connector  pinouts and take time to look into your wires.
(http://www.kbdbabel.org/conn/kbd_connector_adb.png)
Thats what I am using.  I tested the connection from the keyboard connector, from the Arduino to the board inside the KB. Wrote down the results. I plugged the keyboard into the Macintosh Classic and tested the voltage from the pins, and they matched what they should be. Basically, I got 4.8 V from the classic instead of -4.8 V like if my pins were reversed. I did get the data pin wrong, so I switched that. But its not working still :X. Honestly, I think it has something to do with how I am compiling it, or how I am uploading it, or my Digital pin, or the code itself. Everything is wired how it should.
Title: Re: ADB to USB keyboard converter
Post by: jacobolus on Mon, 24 March 2014, 21:40:38
When I get home I’ll try to take a picture showing how I connect this up on a breadboard using a Teensy 2.0.
Title: Re: ADB to USB keyboard converter
Post by: 128keaton on Mon, 24 March 2014, 21:42:42
When I get home I’ll try to take a picture showing how I connect this up on a breadboard using a Teensy 2.0.
Okay, thank you very much! May I ask for an ETA? It is late here in the CST.
EDIT: It works now. I changed my pin and it works!
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 25 March 2014, 09:54:19
See this. D0 in Arduino Micro is not PD0.  PD0 is D3 in marking of Arduino Macro PCB. Very confusing, huh.
http://arduino.cc/en/uploads/Main/arduino-micro-schematic.pdf
Title: Re: ADB to USB keyboard converter
Post by: 128keaton on Tue, 25 March 2014, 10:19:11
See this. D0 in Arduino Micro is not PD0.  PD0 is D3 in marking of Arduino Macro PCB. Very confusing, huh.
http://arduino.cc/en/uploads/Main/arduino-micro-schematic.pdf
Wow! Seriously!?! Well, note that on GitHub and the main page.
Title: Re: ADB to USB keyboard converter
Post by: 128keaton on Tue, 25 March 2014, 13:55:58
Hmm. Could someone help me change the key codes? I don't quite understand how to do it. My keyboard has the option and cmd key codes switched and I want to change the ` key to esc, any suggestions?
Title: Re: ADB to USB keyboard converter
Post by: jacobolus on Tue, 25 March 2014, 14:06:45
Which type of keyboard do you have? I updated some of the ADB converter code to use the newer features of Hasu’s firmware a few months ago, and should probably make some pull requests. Basically though you need to edit keymap.c, and maybe config.h.
Title: Re: ADB to USB keyboard converter
Post by: 128keaton on Tue, 25 March 2014, 14:45:55
Which type of keyboard do you have? I updated some of the ADB converter code to use the newer features of Hasu’s firmware a few months ago, and should probably make some pull requests. Basically though you need to edit keymap.c, and maybe config.h.
Its the M0487 Apple Keyboard II
Title: Re: ADB to USB keyboard converter
Post by: jacobolus on Tue, 25 March 2014, 14:52:57
So yeah, okay, take a look at keymap.c
https://github.com/tmk/tmk_keyboard/blob/master/converter/adb_usb/keymap.c

As you can see it’s currently set up with a layout that looks like an Apple Extended Keyboard. You can leave that part if you like, or you can try to make it look more like your M0487 layout.

Here’s the part which sets which characters get sent:
https://github.com/tmk/tmk_keyboard/blob/master/converter/adb_usb/keymap.c#L196

You can replace:
LGUI -> LALT
RGUI -> RALT (though your keyboard doesn’t have one of these)
LALT -> LGUI

to swap command and option back to normal.

Then you can do GRV -> ESC and ESC -> GRV to swap those two.
Title: Re: ADB to USB keyboard converter
Post by: 128keaton on Tue, 25 March 2014, 15:27:19
So yeah, okay, take a look at keymap.c
https://github.com/tmk/tmk_keyboard/blob/master/converter/adb_usb/keymap.c

As you can see it’s currently set up with a layout that looks like an Apple Extended Keyboard. You can leave that part if you like, or you can try to make it look more like your M0487 layout.

Here’s the part which sets which characters get sent:
https://github.com/tmk/tmk_keyboard/blob/master/converter/adb_usb/keymap.c#L196

You can replace:
LGUI -> LALT
RGUI -> RALT (though your keyboard doesn’t have one of these)
LALT -> LGUI

to swap command and option back to normal.

Then you can do GRV -> ESC and ESC -> GRV to swap those two.

Okay, the GUI and ALT worked! But switching the GRV and ESC doesn't work. Hmm.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Wed, 09 April 2014, 20:31:06
it occurs to me that it should be possible to detect the type of keyboard at ADB startup, by looking at the original handler id the keyboard has, and swap layouts dynamically.  Useful for people building external converter boxes that need to handle both "standard" and "extended" keyboards.
I added detection of extended and compact keyboard (https://github.com/gblargg/adb-v-usb/commits/master) and have it use a different keymap for each to the version on github.

I'm still fuzzy on what layers give in the absence of support for media keys (I'd like to add those at some point, but I don't have the motivation so far to figure out how to do so).
Title: Re: ADB to USB keyboard converter
Post by: MAR82 on Fri, 25 April 2014, 07:24:50
Hi guys I’ve been a bit of a lurker for some time gaining information on cool keyboards.

But here is my issue, I’ve got myself an Apple Extended II (but it’s an AZERTY) and I’d like to convert it over to USB. The only problem is that I tried looking at the files that are provided at the beginning of this post, and I have no idea what to do with them. I've never done much more than simple single file sketches on an Arduino   :-[

I don’t know how to build the HEX file or how to modify the keymap to be AZERTY. If anyone can point me to a guide that will take me through the steps of doing it, or explain it to me themselves (or even better send me the HEX file  ;D )

I don’t think it really make a difference, but I’ll be flashing this to a 32u4 with the Sparkfun bootloader.

Any help is appreciated, thanks

Edit: I also have an Arduino Micro and two USBASP v2.0 if that can help
Title: Re: ADB to USB keyboard converter
Post by: MAR82 on Tue, 29 April 2014, 14:31:49
OK guys I was able to figure it out.(I'm typing this with it) :thumb:
It turns out I was downloading just the files for the ADB converter, and not the whole project. (stupid me :rolleyes:)
So now I got it working, the only thing I'm having a problem with is that I have two keys that are inverted. The "²" key is giving me "<", and vice versa. I guess I'll have to understand how to modify the keymap.
The only other issue is my page up key isn't working but that's because the switch isn't working  :mad:. Does anyone knows where I can find one switch (or clone)?
Title: Re: ADB to USB keyboard converter
Post by: jacobolus on Tue, 29 April 2014, 22:40:28
The only other issue is my page up key isn't working but that's because the switch isn't working  :mad:. Does anyone knows where I can find one switch (or clone)?
I’m out of the country for another 2 weeks, or I’d send you one. If you get your post count up, you could try the 'classifieds' section. ("[WTB] One dampened tactile Alps switch" or whatever)
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 30 April 2014, 21:50:30
MAR82, great. The key swap problem is an unfixed old bug. Yes, you just swap two keycodes.

This is that issue on github and my thoughs.
https://github.com/tmk/tmk_keyboard/issues/35
Title: Re: ADB to USB keyboard converter
Post by: MAR82 on Mon, 05 May 2014, 12:57:52
Sorry I've been so busy with work and stuff around the house, to be able to get back to this.
But thanks to you and to everyone one that has contributed to the project, I can now use this lovely ADB Apple Extended II.
I looked at the link that you gave me and yes I can also confirm that the keys work properly on a Mac. So what I think I'll do is just use AutoHotkey for when ever I want to use it on a Windows machine.

Here is what it looks like for now (http://imgur.com/a/JM52n) I think I'll get some Sugru to wrap it in; I don't think the converter will ever get to hot so it should be safe.

I know the power key does what the names says (it powers down a Windows PC, but does nothing on a Mac). But it would be nice if in the future it could be used for selecting different layout layers, or something cool like that.

But once again thanks for the code  :thumb:
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 12 May 2014, 19:52:28
I think so, it is no problem about Sugru wrapping, AVR chip does not get hot much.

Hmm, I didn't know Mac doens't accept power key(PWR). There are two kind of power key, KC_PWR and KC_POWER. KC_PWR is used often in Windows keyboard  and works with Windows and Linux, while KC_POWER works with Linux and OSX but doesn't with Windows.

In short, just replace PWR with POWER in you keymap.c POWER key will work with your Mac.
Title: Re: ADB to USB keyboard converter
Post by: 125ml on Sat, 21 June 2014, 16:21:28
Has anyone had success with the Adafruit ATmega32u4 chip for an ADB-USB converter. I seem to be having some problems.

So far I have the GND and VCC connected to GND and VCC (as you would expect) and the Data line connected to F0 and 10k pull-up resistor between the data and VCC lines.
Since i connected up the data line my Mac now recognises the chip as an ADB keyboard converter, but doesn't register any key presses. So I'm thinking that the data port is wrong.
I've followed (as best I can, I'm quite new to coding in C) the instructions from the Git pages but only get an error when I try to change the ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT #define statements in the config.h file.
Most likely I am missing something.

Any chance of a pointer?

Thanks.

Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 21 June 2014, 17:44:37
By default this converter uses D0 pin for data line now. Check README.md and first post of this thread.
If you want to use F0 instead you can edit config.h.
Title: Re: ADB to USB keyboard converter
Post by: 125ml on Sun, 22 June 2014, 01:56:54
thanks Hasu,
I still couldn't get config.h to compile when I tried to change the port.
So, I've moved the data line over to D0 and it is working.
Thanks for the guidance.

I now have another fantastic keyboard in my collection and the tools to get more and annoy my wife.
Cheers to everyone who has contributed to the code on this. Great work.
Title: Re: ADB to USB keyboard converter
Post by: gustavQ on Sun, 06 July 2014, 17:57:39
Hi guys,

i'm having here a weird situation. I managed to put working the converter with a pro micro with a breadboard just to try out. Then I did these connections in the pro micro:
(http://s15.postimg.org/nx5n6gjqf/WP_20140706_001.jpg) (http://postimg.org/image/nx5n6gjqf/)

I added a button between the gnd and the rst to be able to enter into the boot loader when I want. It is working, because I already upload the hex file twice using this mechanism. The resistance is an 1k and is the same I used in the prototype circuit. Also in both cases I use a ADB cable leaving the brown (Power ON) cable to connect.
Now, with all the connections, the converter is not working. I can't figure out why. Can be the button? It shouldn't be.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 06 July 2014, 19:12:43
Tact switch and resistor look to me ok.
Not sure how you connected ADB cable. No photo of another side?
Title: Re: ADB to USB keyboard converter
Post by: urbanredfox on Wed, 16 July 2014, 23:45:22
Wow this is quite impressive. I skimmed the 10 pages a few months ago and decided to get a teensy and try it out instead of my iMate deal since some of the keys don't work. I just finished reading all 10 pages today and I must say awesome work! I plugged in my Apple Adjustable keyboard and now have a power button that pulls up the shutdown menu.

I did notice one thing that was interesting however I have not investigated yet. On the Adjustable keyboard if I press any of the media keys, volume up, volume down, mute, microphone (what ever this button did) the I no longer can type from this keyboard. Computer seems to respond from other keyboard. I'll pull up the debugger later this week and see what the output looks like as well as look deeper into the code. All I've done so far is verified that the ExtraKey_Enable is set to yes in the Make file.

I'll report back what I find and maybe post some photos when I make a more permanent solution. After all who doesn't like photos.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 20 July 2014, 10:04:20
I confirmed the issue you mentioned on Adjustable Keyboard, the keyboard stops working and only replys with error code 'FFEF' instead of keycode after those media keys are pressed.

Hmm, those media keys  don't yield a keycode unlike other keys, it may need some special initialization or procedure to get keycode of the keys. we'll need to look for the information among old apple documentations.


https://github.com/tmk/tmk_keyboard/issues/130
Title: Re: ADB to USB keyboard converter
Post by: urbanredfox on Sun, 20 July 2014, 22:46:46
Glad to hear it's not just me. I started reading up on the basics of ADB in the hackipedia tech notes, I haven't run across anything related to special/media keys yet but I'll keep digging.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 21 July 2014, 08:10:10
With oscilloscope I found Adjustable keyboard uses 'Service Request' after a media key is pressed. 'Service Request' is used for 'multiple devices' support in ADB. Tmk ADB converter doesn't support 'Service Request' because it is limited to handle *only one keyboard* at same time. This casues the issue that the keyboard stops working after using media keys.

I pushed this commit to fix the problem but note that this does not add support for the mediakeys, they are just ignored. Try the latest version of master branch. https://github.com/tmk/tmk_keyboard/commit/79840c678

Adjustable keyboard behaves as if two devices exists for some reason, one is normal alpha-numeric keyboard and other is media buttons device. To use the media button part we need to add 'multiple devices' support and this will be somewhat hard work. I don't have a plan for this currently.
Title: Re: ADB to USB keyboard converter
Post by: Tomin8or on Mon, 21 July 2014, 14:38:40
Ok, so I have an Apple Extended Keyboard 2 and a teensy 2.0.  I followed this guide almost exactly, with the only deviation being that I ran the cable out the left side of the casing and cut off the ADB connector there.  the wires are soldered onto the exact same pins on both the ADB pcb and connected in the same place on the teensy as pictured on that guide.  Wehn the keyboard is pullged in onboth Windows 7 and OSX 10.9.2, the numlock and other 2 led's flash once and then nothing happens.  Is this something that could be fixed with the pullup resistor? What does the resistor do (ELI5 style please)?  I got the board from my parents, and it worked on the old Mac (SEII I think) they had it on.

Any help would be greatly appreciated, as I am really not sure where to go from here.

Edit: I have also tried multiple USB cables, to no avail.

Edit 2: The guide: http://ifixit.org/blog/4468/hack-it-better-apple-extended-keyboard-ii/
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 21 July 2014, 16:35:42
No photo?
which guide are you following? what is ELI5?

EDIT: Ah OK, urban dic helped me.
http://www.urbandictionary.com/define.php?term=ELI5
Title: Re: ADB to USB keyboard converter
Post by: Tomin8or on Mon, 21 July 2014, 20:42:48
Added the link to the guide, guess I just forgot to paste it in last time.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 21 July 2014, 21:10:35
You are always strongly recommended to add pull-up resistor, but in many cases it will work without this unless you are so unlucky. So I'm guess you are connected to data line wrongly. Power lines 5V and GND seems to be OK because it has LED flash when powering on.

Ah, the port was changed from PF0 to PD0 after that guide is written. You need to resolder data line to PD0, not PF0.
You should read README.md first...

Title: Re: ADB to USB keyboard converter
Post by: Tomin8or on Mon, 21 July 2014, 21:35:24
Tried this, still no dice. Just the lights and then nothing.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 21 July 2014, 22:02:20
hmm, you seems to be unlucky. Post photos of your connection if you need further help.
Title: Re: ADB to USB keyboard converter
Post by: Tomin8or on Mon, 21 July 2014, 22:18:56
Pic of relevant connections.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 21 July 2014, 23:18:30
Looks like wiring is OK but again, make sure red and black line should not touch each other.
Still no luck? It is time to add pullup resistor finally.

Title: Re: ADB to USB keyboard converter
Post by: blargg on Tue, 22 July 2014, 20:30:48
You've got your ADB socket miswired. I have one like that and the one in the linked Hack It Better article both are wired with ground in the upper-left (white in the article), and data in the lower-right (blue in the article). You've got them swapped. I also highly recommend you use a pull-up resistor, otherwise you're just asking for rare problems that are hard to reproduce or diagnose. If you don't have a resistor (1K-10K is fine), you can run a few of the other port pins as pull-ups and connect them together with the data pin.
Title: Re: ADB to USB keyboard converter
Post by: Tomin8or on Fri, 25 July 2014, 18:50:38
Got mine working today, as I finally got proper resistors.  The nearest place I could buy them has weird hours and is overrun with vacationers this time of year, so I had to order them from Amazon, but hey it works.  Thanks a bunch for the help and for doing all the hard work for us in writing the code to make it work.  Stuff like this is why I am starting in on a Computer Engineering major next year.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Fri, 25 July 2014, 20:02:55
Was it miswired in your pictures or was I incorrect?
Title: Re: ADB to USB keyboard converter
Post by: Tomin8or on Fri, 25 July 2014, 23:01:31
It was properly wired.

Small gallery: http://imgur.com/a/GEYEB

Edit: For those doing this in the future, if you solder onto the adb connector's pcb, make sure you realize they are not the same on opposite sides.  The pins have different locations (I used the right side connector to solder to so I could run the cable out the left).
Title: Re: ADB to USB keyboard converter
Post by: urbanredfox on Tue, 05 August 2014, 23:11:32
Hi Hasu,

I tried the latest version of the master branch and it works great no more freezing of the keyboard. Thanks for all the help.

Just out of curiosity is the lack of Service Request due to hardware limitations or outside of the scope of this project?

With oscilloscope I found Adjustable keyboard uses 'Service Request' after a media key is pressed. 'Service Request' is used for 'multiple devices' support in ADB. Tmk ADB converter doesn't support 'Service Request' because it is limited to handle *only one keyboard* at same time. This casues the issue that the keyboard stops working after using media keys.

I pushed this commit to fix the problem but note that this does not add support for the mediakeys, they are just ignored. Try the latest version of master branch. https://github.com/tmk/tmk_keyboard/commit/79840c678

Adjustable keyboard behaves as if two devices exists for some reason, one is normal alpha-numeric keyboard and other is media buttons device. To use the media button part we need to add 'multiple devices' support and this will be somewhat hard work. I don't have a plan for this currently.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 05 August 2014, 23:30:10
Great!

It is just a limitation of current firmware, I think 'multi devices' or Service Request support is certainly possible but I hesitate to implement it due to my laziness.
Title: Re: ADB to USB keyboard converter
Post by: DamnDan on Thu, 02 October 2014, 06:27:47
Hello Geekhackers,

As I totally lack knowledge in terms of making key matrix and making hex files (i know...big newbie), and before I go long way to learn how to do this, I need to ask you a question:

Does anyone have a ready made HEX file for m0118 board? :(

This would help my Apple board to finally get some use :)

Thanks,
Damndan
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 02 October 2014, 13:41:27
M0118 will work with this converter, I have M0116 and it work. You'll have to use ISO keymap, see here.
https://github.com/tmk/tmk_keyboard/issues/35#issuecomment-43660429
Title: Re: ADB to USB keyboard converter
Post by: DamnDan on Sun, 05 October 2014, 03:47:26
M0118 will work with this converter, I have M0116 and it work. You'll have to use ISO keymap, see here.
https://github.com/tmk/tmk_keyboard/issues/35#issuecomment-43660429

Hey Hasu :)


Thank you for the tip :) Now I have a fully functioning M0118 :)

Have a great day! :)

Edit:
Found one small thing that I do not know how to change

Is there any way i could change the right command key into right alt?
(http://i.imgur.com/9bJ8sIB.jpg)

If there is....where do i change that O,o

I read somewhere that it is not possible with this converter, but it is always better to ask before you give up ;P
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 08 October 2014, 07:05:04
Apple Desktop keyboard(Apple IIGS) and Apple Standard keyboard including M0116 and M0118 can not discriminate between left and right modifier. Or those keyboard has same scan code for both left and right modifier key.
So both of those command keys in your pic are same key in reality. If you assign right Alt to the left Command key right Commad key also emits right Alt.

While Extended keyboard(AEK and AEKII) has discriminate between left and right modifier keys except Command keys.

This is ADB protocol limitation, not TMK converter one.
Title: Re: ADB to USB keyboard converter
Post by: DamnDan on Thu, 09 October 2014, 06:57:41
Apple Desktop keyboard(Apple IIGS) and Apple Standard keyboard including M0116 and M0118 can not discriminate between left and right modifier. Or those keyboard has same scan code for both left and right modifier key.
So both of those command keys in your pic are same key in reality. If you assign right Alt to the left Command key right Commad key also emits right Alt.

While Extended keyboard(AEK and AEKII) has discriminate between left and right modifier keys except Command keys.

This is ADB protocol limitation, not TMK converter one.

Thank you  :) I was going crazy with this trying to figure out how to make it work ;) I've decided to just sacrifice OS key and use it as right alt instead :)

Thank you for all your help :)
Title: Re: ADB to USB keyboard converter
Post by: blargg on Sun, 19 October 2014, 20:13:25
Assuming yours differentiates between left and right shift keys, you could swap right shift and right command traces on the PCB pretty easily. They should both share a common scan line, which you'd leave. You'd cut the trace just before the other line to each switch, and run jumpers to another point on the board where those lines connect to something. Then update the keymap in tmk and it will work flawlessly (though be comical if someone tried to use it in an old Mac). If you're interested I can provide further guidance.
Title: Re: ADB to USB keyboard converter
Post by: DamnDan on Tue, 21 October 2014, 04:46:44
Assuming yours differentiates between left and right shift keys, you could swap right shift and right command traces on the PCB pretty easily. They should both share a common scan line, which you'd leave. You'd cut the trace just before the other line to each switch, and run jumpers to another point on the board where those lines connect to something. Then update the keymap in tmk and it will work flawlessly (though be comical if someone tried to use it in an old Mac). If you're interested I can provide further guidance.

Thank you for your response :) Actually i would love to keep the board original in terms of innards, so that when I decide to sell it or i will die and someone else try to sell it, the board will be a great deal for both keyboard and Apple enthusiasts :) That is why i sacrificed the OS key in tmk :) I've learned that I don't use the OS key at all when I work or game so it was the only reasonable choice :)

Also i use both shifts while I work - Photoshop, coding, writing etc :)

Second key that i've sacrificed was the "<>" key near the left shift, and now it is used as an FN key to trigger the function row :)

At the moment, after all the modding of additional layers, I've stopped using any other boards :P So the sacrifices were for the good :) M0118 is a really nice small board for my gaming and work needs :)

Just a question, should there be any springs in space and enter key stabilisers? Mine came with none and these keys were acting all sticky (after pressing they remained in pushed position). After some verification it seems that this was happening due to these keys being held down by stabilisers. I modded my board wih cut pencil springs, but the question remains...am I missing any original stabiliser springs?

Once again thank you all for all your help with this :) This is as close as I can get to 60-75% boards without going through ALOT of expenses :P

After I will find some more time to construct a shell for the converter I will post some pictures :)

Thanks! :)
Title: Re: ADB to USB keyboard converter
Post by: Merc_Ragnar on Sun, 09 November 2014, 15:43:05
?Help?

Hey guys, I'm not a troll, but instead just an idiot who can not apply what I've read here to my keyboard (M0116) project.  I am truly appreciative of your time if you're willing to help. 

Disclaimer:  This is the first time I've attempted a project like this.

My first question:  Regarding the source code at  github/...converter/adb_usb (https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb), I have read multiple references to edit keymap.c.  Currently, I can not locate a file called keymap.c.   Given that I need a hex for an M0116 (an iso layout to my knowledge), should I edit the keymap_iso.c file instead? 

ANY help (even just the necessary hex) would be incredibly appreciated. 

You guys do some incredible projects and I consider myself fortunate in being able to be along for the ride.  Thank you for your time.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Mon, 10 November 2014, 00:56:05
What you probably want to do is copy keymap_iso.c to keymap_ragnar.c (or, indeed, populate it with the contents of the M0116 map from keymap_common.c), modify to taste, and then do a

make KEYMAP=ragnar
Title: Re: ADB to USB keyboard converter
Post by: Merc_Ragnar on Mon, 10 November 2014, 09:13:15
What you probably want to do is copy keymap_iso.c to keymap_ragnar.c (or, indeed, populate it with the contents of the M0116 map from keymap_common.c), modify to taste, and then do a

make KEYMAP=ragnar

Thanks for the heads-up, I'll get back to work and give that a go.
Title: Re: ADB to USB keyboard converter
Post by: arfink on Mon, 10 November 2014, 16:20:44
Having a little problem compiling the latest. I'm running Mint with gcc-avr and avr-libc installed, so ought to have all necessary dependencies. Issuing "make" spews lots of proper output before this:

mkdir -p obj_adb_usb_lufa/common
Compiling C: ../../common/debug.c
avr-gcc -c -mmcu=atmega32u4 -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=4096 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8  -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DMOUSEKEY_ENABLE -DMOUSE_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DVERSION=8cec0bc -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_adb_usb_lufa/common/debug.lst -I. -I../.. -I../../protocol/lufa -I../../protocol/lufa/LUFA-120730 -I../../protocol -I../../common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_adb_usb_lufa_common_debug.o.d  ../../common/debug.c -o obj_adb_usb_lufa/common/debug.o
../../common/debug.c:7:5: error: unknown field ‘enable’ specified in initializer
../../common/debug.c:8:5: error: unknown field ‘matrix’ specified in initializer
../../common/debug.c:8:5: warning: excess elements in union initializer
../../common/debug.c:8:5: warning: (near initialization for ‘debug_config’)
../../common/debug.c:9:5: error: unknown field ‘keyboard’ specified in initializer
../../common/debug.c:9:5: warning: excess elements in union initializer
../../common/debug.c:9:5: warning: (near initialization for ‘debug_config’)
../../common/debug.c:10:5: error: unknown field ‘mouse’ specified in initializer
../../common/debug.c:10:5: warning: excess elements in union initializer
../../common/debug.c:10:5: warning: (near initialization for ‘debug_config’)
make: *** [obj_adb_usb_lufa/common/debug.o] Error 1

Not sure what's going on here, the last version I pulled from Git a couple months ago compiled without hiccups...
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 10 November 2014, 19:03:53
On my ubuntu 14.04 with AVR gcc 4.8.2 and avr-libc 1.8.0 I got no error while compile. But I have seen this error some time ago sowewhere. I don't remember how I did with the error.

What are your toolchain versions? And you are using HEAD of master branch, right?

Those 'unknown fields' of debug_config_t is defined in common/debug_config.h, I dont know why those are unknown.
My code may not conform with some C specifications. Am I doing something wrong?
Title: Re: ADB to USB keyboard converter
Post by: Merc_Ragnar on Mon, 10 November 2014, 21:10:47
Having a little problem compiling the latest. I'm running Mint with gcc-avr and avr-libc installed, so ought to have all necessary dependencies. Issuing "make" spews lots of proper output before this:

mkdir -p obj_adb_usb_lufa/common
Compiling C: ../../common/debug.c
avr-gcc -c -mmcu=atmega32u4 -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=4096 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8  -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DMOUSEKEY_ENABLE -DMOUSE_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DVERSION=8cec0bc -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_adb_usb_lufa/common/debug.lst -I. -I../.. -I../../protocol/lufa -I../../protocol/lufa/LUFA-120730 -I../../protocol -I../../common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_adb_usb_lufa_common_debug.o.d  ../../common/debug.c -o obj_adb_usb_lufa/common/debug.o
../../common/debug.c:7:5: error: unknown field ‘enable’ specified in initializer
../../common/debug.c:8:5: error: unknown field ‘matrix’ specified in initializer
../../common/debug.c:8:5: warning: excess elements in union initializer
../../common/debug.c:8:5: warning: (near initialization for ‘debug_config’)
../../common/debug.c:9:5: error: unknown field ‘keyboard’ specified in initializer
../../common/debug.c:9:5: warning: excess elements in union initializer
../../common/debug.c:9:5: warning: (near initialization for ‘debug_config’)
../../common/debug.c:10:5: error: unknown field ‘mouse’ specified in initializer
../../common/debug.c:10:5: warning: excess elements in union initializer
../../common/debug.c:10:5: warning: (near initialization for ‘debug_config’)
make: *** [obj_adb_usb_lufa/common/debug.o] Error 1

Not sure what's going on here, the last version I pulled from Git a couple months ago compiled without hiccups...

I can't figure out how to make this stupid thing, but I had to deal with the same obstacle just two days ago. 
Note:  I'm running Mint on my primary laptop.

CODE THAT FOLLOWS FOR LINUX MINT ONLY
Try
Code: [Select]
sudo apt-get install gcc-avr binutils-avr avr-libc

That resolved my errors.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Tue, 11 November 2014, 05:13:03
Okay, it's not tested, as I don't have a teensy spare at the moment, but I've just incorporated my M0116 keymap with hasu's latest code.

I've attached a binary.  Merc_ragnar, if you could test it, I'll submit a pull request to hasu.
Title: Re: ADB to USB keyboard converter
Post by: arfink on Tue, 11 November 2014, 12:28:43
Having a little problem compiling the latest. I'm running Mint with gcc-avr and avr-libc installed, so ought to have all necessary dependencies. Issuing "make" spews lots of proper output before this:

mkdir -p obj_adb_usb_lufa/common
Compiling C: ../../common/debug.c
avr-gcc -c -mmcu=atmega32u4 -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=4096 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8  -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DMOUSEKEY_ENABLE -DMOUSE_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DVERSION=8cec0bc -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_adb_usb_lufa/common/debug.lst -I. -I../.. -I../../protocol/lufa -I../../protocol/lufa/LUFA-120730 -I../../protocol -I../../common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_adb_usb_lufa_common_debug.o.d  ../../common/debug.c -o obj_adb_usb_lufa/common/debug.o
../../common/debug.c:7:5: error: unknown field ‘enable’ specified in initializer
../../common/debug.c:8:5: error: unknown field ‘matrix’ specified in initializer
../../common/debug.c:8:5: warning: excess elements in union initializer
../../common/debug.c:8:5: warning: (near initialization for ‘debug_config’)
../../common/debug.c:9:5: error: unknown field ‘keyboard’ specified in initializer
../../common/debug.c:9:5: warning: excess elements in union initializer
../../common/debug.c:9:5: warning: (near initialization for ‘debug_config’)
../../common/debug.c:10:5: error: unknown field ‘mouse’ specified in initializer
../../common/debug.c:10:5: warning: excess elements in union initializer
../../common/debug.c:10:5: warning: (near initialization for ‘debug_config’)
make: *** [obj_adb_usb_lufa/common/debug.o] Error 1

Not sure what's going on here, the last version I pulled from Git a couple months ago compiled without hiccups...

I can't figure out how to make this stupid thing, but I had to deal with the same obstacle just two days ago. 
Note:  I'm running Mint on my primary laptop.

CODE THAT FOLLOWS FOR LINUX MINT ONLY
Try
Code: [Select]
sudo apt-get install gcc-avr binutils-avr avr-libc

That resolved my errors.

I had already thought to install those too, and found that despite having them installed, it still borked on me. Is this just a Linux Mint problem? I am running v13 LTS, so it's a little behind.
Title: Re: ADB to USB keyboard converter
Post by: arfink on Tue, 11 November 2014, 13:12:46
For GCC-AVR I have 1:4.5.3-3
For avr-libc I have 1:1.7.1-2

I suppose for my next thing to try, I'll be seeing about updating those. I believe those are the newest in the Mint 13 repo though, so this might be a little beyond where I can/will go with this today. I might resort to compiling in my Windows VM to save having to upgrade a bunch of dependencies beyond the repos.
Title: Re: ADB to USB keyboard converter
Post by: Merc_Ragnar on Tue, 11 November 2014, 16:18:59
For GCC-AVR I have 1:4.5.3-3
For avr-libc I have 1:1.7.1-2

I suppose for my next thing to try, I'll be seeing about updating those. I believe those are the newest in the Mint 13 repo though, so this might be a little beyond where I can/will go with this today. I might resort to compiling in my Windows VM to save having to upgrade a bunch of dependencies beyond the repos.

I should probably simply shut my mouth as I have NO experience in hardware.  I did resolve the same error you had for Mint 17 by running an update and then the code I posted above.  I have no idea why I had the initial error as I already had GCC-AVR installed, but after the update and running the code above the error did resolve.


Okay, it's not tested, as I don't have a teensy spare at the moment, but I've just incorporated my M0116 keymap with hasu's latest code.

I've attached a binary.  Merc_ragnar, if you could test it, I'll submit a pull request to hasu.

Thank you so much I had all but given up and just resolved to grab an adapter.  I'll give her a go tonight.



EDIT:  Tuffy, I have no idea what to do with the .elf or how to test that on the Teensy.  I don't know how to convert/make a hex out of the elf and I am unable to load it onto my Teensy.  Anyway I can score the .hex from you?
Title: Re: ADB to USB keyboard converter
Post by: tufty on Tue, 11 November 2014, 23:48:05
Oh god I'm an idiot.  Attached.

Should work like this:

Code: [Select]
  /* Default layer : plain keymap
   *                     +-------+
   *                     | power |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
   * +---------------------------------------------------------+ +---+---+---+---+
   * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
   * +-----------------------------------------------------+   | +---+---+---+---+
   * | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
   * +---------------------------------------------------------+ +---+---+---+---+
   * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
   * +---------------------------------------------------------+ +-------+---|ent|
   * |Fn1|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
   * +---------------------------------------------------------+ +-------+---+---+
   */
  /* Layer 1 :
   *                     +-------+
   *                     | Eject |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|     | |   |   |   |Mut|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |     |   |   |   |   |   |   |   |   |   |   |   |   |   | |   |   |   |VoU|
   * +-----------------------------------------------------+   | +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |   |      | |   |   |   |VoD|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |Capslock|   |   |   |   |   |   |   |   |   |   |Capslock| |   |   |   |   |
   * +---------------------------------------------------------+ +-------+---|   |
   * |Fn1|   |     |   |                   |   |Hom|End|PgD|PgU| |       |   |   |
   * +---------------------------------------------------------+ +-------+---+---+
   */
note that capslock is now the "layer" key (and works best with the locking mechanism removed), and actual capslock is on layer 1.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 13 November 2014, 17:36:56
Having a little problem compiling the latest. I'm running Mint with gcc-avr and avr-libc installed, so ought to have all necessary dependencies. Issuing "make" spews lots of proper output before this:

mkdir -p obj_adb_usb_lufa/common
Compiling C: ../../common/debug.c
avr-gcc -c -mmcu=atmega32u4 -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=4096 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8  -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DMOUSEKEY_ENABLE -DMOUSE_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DVERSION=8cec0bc -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_adb_usb_lufa/common/debug.lst -I. -I../.. -I../../protocol/lufa -I../../protocol/lufa/LUFA-120730 -I../../protocol -I../../common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_adb_usb_lufa_common_debug.o.d  ../../common/debug.c -o obj_adb_usb_lufa/common/debug.o
../../common/debug.c:7:5: error: unknown field ‘enable’ specified in initializer
../../common/debug.c:8:5: error: unknown field ‘matrix’ specified in initializer
../../common/debug.c:8:5: warning: excess elements in union initializer
../../common/debug.c:8:5: warning: (near initialization for ‘debug_config’)
../../common/debug.c:9:5: error: unknown field ‘keyboard’ specified in initializer
../../common/debug.c:9:5: warning: excess elements in union initializer
../../common/debug.c:9:5: warning: (near initialization for ‘debug_config’)
../../common/debug.c:10:5: error: unknown field ‘mouse’ specified in initializer
../../common/debug.c:10:5: warning: excess elements in union initializer
../../common/debug.c:10:5: warning: (near initialization for ‘debug_config’)
make: *** [obj_adb_usb_lufa/common/debug.o] Error 1

Not sure what's going on here, the last version I pulled from Git a couple months ago compiled without hiccups...

I can't figure out how to make this stupid thing, but I had to deal with the same obstacle just two days ago. 
Note:  I'm running Mint on my primary laptop.

CODE THAT FOLLOWS FOR LINUX MINT ONLY
Try
Code: [Select]
sudo apt-get install gcc-avr binutils-avr avr-libc

That resolved my errors.

I had already thought to install those too, and found that despite having them installed, it still borked on me. Is this just a Linux Mint problem? I am running v13 LTS, so it's a little behind.

For GCC-AVR I have 1:4.5.3-3
For avr-libc I have 1:1.7.1-2

I suppose for my next thing to try, I'll be seeing about updating those. I believe those are the newest in the Mint 13 repo though, so this might be a little beyond where I can/will go with this today. I might resort to compiling in my Windows VM to save having to upgrade a bunch of dependencies beyond the repos.


I confirmed this error occurs on WinAVR(avr-gcc 4.3.3) too. Seems like this GCC bug is involved with the error and **GCC 4.6 or later** will be able to compile without the error if I'm correct.
GCC Bug 10676 - Using unnamed fields in initializers: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676

Now we have two possible workarounds. Let me know whether these work for you.
WORKAROUND1: Update GCC to 4.6 or later
or
WORKAROUND2: Replace code
Code: [Select]
debug_config_t debug_config = {
    .enable = false,
    .matrix = false,
    .keyboard = false,
    .mouse = false,
};
with
Code: [Select]
debug_config_t debug_config = {};
Title: Re: ADB to USB keyboard converter
Post by: tufty on Fri, 14 November 2014, 01:15:49
I've just thrown you a pull request, which should fix the gcc < 4.6 issues and keep your code readable.

The commit before adds files with a trailing ~ in their names to .gitignore, which is useful, and the one before that adds my m0116 keymap (currently untested, as I noted before)
Title: Re: ADB to USB keyboard converter
Post by: hasu on Fri, 14 November 2014, 03:16:04
Thank you for suggestion, tuffy.

I fixed the issue of debug.c compile at this commit.
https://github.com/tmk/tmk_keyboard/commit/818070913275349c3906e2c4cdc3d69da5b7e132
Code: [Select]
diff --git a/common/debug.c b/common/debug.c
index c4fa3a0..2ed1006 100644
--- a/common/debug.c
+++ b/common/debug.c
@@ -1,12 +1,15 @@
 #include <stdbool.h>
 #include "debug.h"
 
+#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
 
-//debug_config_t debug_config = { .enable = false, .matrix = false };
 debug_config_t debug_config = {
+#if GCC_VERSION >= 40600
+    /* GCC Bug 10676 - Using unnamed fields in initializers
+     * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676 */
     .enable = false,
     .matrix = false,
     .keyboard = false,
     .mouse = false,
+#endif
 };
-
Title: Re: ADB to USB keyboard converter
Post by: tufty on Sun, 16 November 2014, 09:50:06
OK, I done a stupid.

As my ADB testing teensy (now hardwired into a wacom tablet) had ADB wired to C7, I had hacked my local branch to listen for ADB on that pin, rather than hasu's default D0.  And I didn't rectify that before building the binary I posted before.  Woops.

Here's one built with the aforementioned M0116 keymap and, crucially, listening on what should be the correct pin.

<hangs head in shame>
Title: Re: ADB to USB keyboard converter
Post by: tufty on Sun, 16 November 2014, 09:51:36
<and more shame>

It's been a long day.
Title: Re: ADB to USB keyboard converter
Post by: Merc_Ragnar on Mon, 17 November 2014, 20:27:15
<and more shame>

It's been a long day.

Thanks for all the help on this. 

Good news:  I got the Teeny reading as a keyboard on my windows laptop.
Bad news:  I could never use the keyboard and ended up smelling a burning plastic smell and discovered the large black chip on the keyboard was incredibly hot.

I'm now checking out my solders again, specifically the contact my resistor is making.

 
Title: Re: ADB to USB keyboard converter
Post by: blargg on Tue, 18 November 2014, 02:47:01
With the Teensy off, use a meter to be sure that GND actually connects to GND on the keyboard PCB when they're plugged together. Sounds like the polarity was backwards, and you've got Vcc from the Teensy going to GND on the keyboard.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Sat, 22 November 2014, 01:59:05
Good news:  I got the Teeny reading as a keyboard on my windows laptop.
Bad news:  I could never use the keyboard and ended up smelling a burning plastic smell and discovered the large black chip on the keyboard was incredibly hot.
Aaargh!

That's not good, but you probably guessed that anyway.  I concur with blargg, sounds an awful lot like you've got something messed up soldering-wise.  Any chance of a photo?  Also double-check you've got the ADB connection wired up correctly.  The plug is symmetrical, so it's easy to mix up which wire goes where based on a pinout, and there's seemingly no standard as to what colour the wires are.
Title: Re: ADB to USB keyboard converter
Post by: zacbir on Mon, 01 December 2014, 10:00:30
Is there a preferred place to tie into the ADB circuitry when doing an internal Teensy mod? I've attached photos of three possibilities that occur to me.

1) tack solder to the back of the ADB connector PCB. This seems to be what Scotty did here: http://ifixit.org/blog/4468/hack-it-better-apple-extended-keyboard-ii/ [attach=1]

2) shim into the connector between the ADB connector PCB and the keyboard PCB [attach=2]

3) desolder the ADB connector PCB and tie in directly to the keyboard PCB. [attach=3]

I don't plan on using the keyboard with a standard ADB-capable Mac, so I don't mind losing the ADB connectivity.

Incidentally, anyone know what the 5 pin(s) are there for?
Title: Re: ADB to USB keyboard converter
Post by: tufty on Mon, 01 December 2014, 10:15:32
There's only 4 pins - +5v, GND, data, PSW (power switch).  The 5th "pin" you're seeing on the AEK is "shield", which is usually synonymous with GND.
Title: Re: ADB to USB keyboard converter
Post by: zacbir on Mon, 01 December 2014, 10:19:19
Right. That's why I was asking. But thanks, that clears it up anyway.
Title: Re: ADB to USB keyboard converter
Post by: zacbir on Fri, 05 December 2014, 08:32:35
Back to the original question, though: Anyone want to chime in on how they wired up their AEKII? At this point, I'm planning on route #3 (desoldering the ADB connector entirely, and running the wires from the keyboard directly to the Teensy 2.0.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Fri, 05 December 2014, 08:41:59
That's what I'd do, replacing the ADB connector with a B or mini-B USB connector on a flying lead.
Title: Re: ADB to USB keyboard converter
Post by: blargg on Fri, 05 December 2014, 18:36:52
I keep my keyboards unmodified (other than making caps lock a momentary key), so that I can easily plug the adapter into another ADB keyboard, debug problems by testing on another keyboard, sell the keyboard later, etc. I like flexibility. A common S-video cable can be used to connect to the keyboard.
Title: Re: ADB to USB keyboard converter
Post by: zacbir on Thu, 11 December 2014, 11:46:41
For the AEKII, is it sufficient to remove the physical locking mechanism on the Caps Lock switch, and use the tmk code to grant it momentary behavior (versus combined keydown/keyup) in order to be able to treat Caps Lock as Control? Anyone with a step-by-step on this procedure?
Title: Re: ADB to USB keyboard converter
Post by: ocodo on Thu, 11 December 2014, 12:33:41
Is there a preferred place to tie into the ADB circuitry when doing an internal Teensy mod? I've attached photos of three possibilities that occur to me.

1) tack solder to the back of the ADB connector PCB. This seems to be what Scotty did here: http://ifixit.org/blog/4468/hack-it-better-apple-extended-keyboard-ii/ (Attachment Link)

2) shim into the connector between the ADB connector PCB and the keyboard PCB (Attachment Link)

3) desolder the ADB connector PCB and tie in directly to the keyboard PCB. (Attachment Link)

I don't plan on using the keyboard with a standard ADB-capable Mac, so I don't mind losing the ADB connectivity.

Incidentally, anyone know what the 5 pin(s) are there for?

Does anyone have the pinouts of that ribbon cable? Looks like the perfect place to patch from.  3D print a mount for the teensy and we have a nice mini USB connector to replace one ADB and a remaining ADB on the other side, for backwards compatibility. 


Edit:  This looks more than adequate. https://geekhack.org/index.php?topic=14290.msg1409902#msg1409902

[attach=1]

ADB Pin outs left - to - right

Code: [Select]
5 : 4 (Gnd) : 5 : 3 (VCC) : 5 : 2 (Pwr) : 5 : 1 (Data) : 5
Title: Re: ADB to USB keyboard converter
Post by: zacbir on Mon, 15 December 2014, 10:39:53
SUCCESS

Turned out to be a 1 hour project, once I had all the components in place. Ultimately, I went with an external connector for three reasons:

  1) Fear of working in cramped conditions

  2) Can more easily fall back on one of the other spare keyboards if something goes wrong

  3) DAT original ADB cable!

Process writeup:

So, I bought the keyboards together on eBay from a single seller (he discounted the lot of 4 for $112 - $28 a pop!). He sent me serial numbers, confirming that all had the Alps switches. They had no cables, though, so I was originally planning on an internal mod with a pretty stock USB cable. I looked at the Zeal PC custom cables, and considered getting a grey coiled cable, but man, it'd be more than the keyboard! I planned for a bit of redundancy, so I ordered two of the Teensy 2.0 boards, and started collecting some other bits and bobs. Got some various soldering bits off Amazon and Adafruit, and got a batch of 10 S-Video connectors off eBay for $5. Also came across two coiled ADB cables on eBay, one NOS, each for ~$5. So, I was set. Easy peasy lemon squeezy.

Now to come up with some sort of housing for it.

Thanks for the inspiration, GeekHack, and thanks for the code, Hasu!

Happy clackety clack
Title: Re: ADB to USB keyboard converter
Post by: MontyElephant on Mon, 15 December 2014, 19:44:31
Ok so I'm really new to all of this. I decided to go with an Arduino micro since I could get it locally. I am stuck at how to load the hex file on to the chip. When I select Connection > USB > Open in FLIP it says "Could not open USB device." The arduino shows up in the device manager under Ports > Arduino Micro (COM 3). What am I doing wrong?

Thanks
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 15 December 2014, 20:20:29
zacbir, nice write up!

MontyElephant, FLIP cannot work with Arduino bootloader, you will need to use avrdude instead.

EDIT: command like this will work for you, device name varies depending on your system.
Code: [Select]
avrdude -patmega32u4 -cavr109 -b57600 -Uflash:w:adb_usb.hex -P/dev/ttyACM0
Title: Re: ADB to USB keyboard converter
Post by: MontyElephant on Mon, 15 December 2014, 20:34:56

MontyElephant, FLIP cannot work with Arduino bootloader, you will need to use avrdude instead.

EDIT: command like this will work for you, device name varies depending on your system.
Code: [Select]
avrdude -patmega32u4 -cavr109 -b57600 -Uflash:w:adb_usb.hex -P/dev/ttyACM0

Ok so I was able to upload the hex (i think) using Arduino Builder. I then plugged it into the breadboard with all the wires and then plugged it all into the computer aannnd nothing... I took it back out of the breadboard and now when I plug it in the blue LED turns on but neither of the LEDs on top blink as before. If I press reset, the top LEDs will blink briefly and the device will show up temporarily in the same spot under COM4 and then disappear. Did I do something wrong?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 15 December 2014, 20:42:35
you will see keyboard device of vid:feed and pid:0adb if your board is programmed with tmk firmware. My converter doesn't control any LED on Arduino.
Title: Re: ADB to USB keyboard converter
Post by: MontyElephant on Mon, 15 December 2014, 20:56:37
you will see keyboard device of vid:feed and pid:0adb if your board is programmed with tmk firmware. My converter doesn't control any LED on Arduino.

Ok so when I plug the device in (without being plugged into the breadboard), it shows up as you specified. However, as soon as I put it in the breadboard, when I connect it, it connects momentarily (I can hear the windows "device connected" sound) but then immediately disconnects (again indicated by the sound). Would this imply an issue with my wiring?

EDIT: Ok so it stays on until I plug in the keyboard (M0116). And if I unplug the keyboard it turns on again...

EDIT 2: I'm retarded. I was reading the wiring diagram as if I was looking down at the male end of the cable and not the female end... IT WORKS NOW.. TYPING WITH AN M0116 from my dad's old SE/30
Title: Re: ADB to USB keyboard converter
Post by: Blaise170 on Tue, 16 December 2014, 01:04:21
Nevermind.
Title: Re: ADB to USB keyboard converter
Post by: zacbir on Fri, 19 December 2014, 13:33:04
Hey, fellow hackers.

I wrote up my experience this morning converting the Caps Lock to a momentary key. The highlight was that I accidentally pried the actual switch off the base! Luckily, it just broke the solder. I cleaned it up with my solder wick and re-situated it and soldered it back, good as new, but I got the lock pin out successfully.

http://zacbir.net/blog/2014/12/19/getting-control-over-caps-lock/ (http://zacbir.net/blog/2014/12/19/getting-control-over-caps-lock/)

Maybe it'll help anyone else stumped on this little procedure.
Title: Re: ADB to USB keyboard converter
Post by: loudaslife on Wed, 24 December 2014, 01:11:58
You can use PJRC Teensy or other dev board with ATMega32U4.

Does that mean it will work with the Leonardo Pro Micro? I'm worried the Arduino bootloader might mess something up. For the ultra-thrifty, a Pro Micro can be found for about half the cost of a teensy.

Edit: I am an idiot and somehow missed that part of the thread while I was skimming through. Disregard that.
Title: Re: ADB to USB keyboard converter
Post by: hwood34 on Mon, 05 January 2015, 21:21:53
Does anyone have a picture of a finished mod on an M0116? I'm seeing lots of pictures, but the cables on all them seem to have 3 wires, while mine has 4, differently colored wires
Title: Re: ADB to USB keyboard converter
Post by: tufty on Tue, 06 January 2015, 00:27:46
Expect 4 wires internally.  +5v, GND, ADB and PWR.  There will be 5 connections to the connector (it's shielded).  You want +5, GND and ADB.  PWR is the hard-wired power switch connection, ignore it.
Title: Re: ADB to USB keyboard converter
Post by: hwood34 on Tue, 06 January 2015, 13:50:35
Expect 4 wires internally.  +5v, GND, ADB and PWR.  There will be 5 connections to the connector (it's shielded).  You want +5, GND and ADB.  PWR is the hard-wired power switch connection, ignore it.
Ah, now looking back over this I get it. Ugh, still such a noob with this kind of stuff :))
Title: Re: ADB to USB keyboard converter
Post by: zacbir on Wed, 07 January 2015, 14:30:54
I suspect this is doable, but am a bit lost amid the fragments of documentation in hasu's github code.

If you were to remap the Print Screen key to be a Fn key, would OS X interpret <Print Screen>-<F8> as Play/Pause automatically? If so, which key code would you use to represent the Fn key on an Apple USB/Bluetooth keyboard? There are KC_FN0 - KC_FN31, but nothing that seems to be a sole Fn key.

EDIT: To clarify, I know that I could simply wire up Scroll Lock to VOLD and Pause to VOLU, but I'm wondering about setting up a key as a modifier key to basically get media keys (and other OS X specific keys) using the AEKII.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 07 January 2015, 19:58:00
Not sure exactly what you want, but I guess you want to make Print Screen a momemtary'Layer switching' and have Play/Pause keycode on F8 key in another layer.
https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#31-momentary-switching
Title: Re: ADB to USB keyboard converter
Post by: zacbir on Thu, 08 January 2015, 08:46:42
Not sure exactly what you want, but I guess you want to make Print Screen a momemtary'Layer switching' and have Play/Pause keycode on F8 key in another layer.
https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#31-momentary-switching


That's exactly what I was looking for! Thanks, hasu!
Title: Re: ADB to USB keyboard converter
Post by: zacbir on Fri, 09 January 2015, 09:14:29
Thanks, hasu!

Successfully reintroduced the media keys to my AEKII, and wrote it up: http://zacbir.net/blog/2015/01/08/in-media-res/
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Sat, 10 January 2015, 13:15:04
You wrote that any controller, based on ATMega32U4, can be used.

Do you happen to know if Arduino Leonardo http://arduino.cc/en/Main/arduinoBoardLeonardo suitable for this purpose?

It's just I can get it a lot cheaper than teensy in my country.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 10 January 2015, 13:25:10
You can use Leonardo without problem.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Sat, 10 January 2015, 13:43:17
You can use Leonardo without problem.

Thank you, hasu. It's just it's pins are marked somewhat different... you don't happen to know what pin I need to use for data? Analog a0? I won't have any problem with +5v and GND, but data...
(http://arduino.cc/en/uploads/Main/ArduinoLeonardoFront_2_450px.jpg)
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 10 January 2015, 13:56:40
I don't remember. Just check its schematic yourself.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Sat, 10 January 2015, 15:30:22
I don't remember. Just check its schematic yourself.

OK. When I'll check it, I'll write if it's true :) I just hope I won't need to edit config... even if it's seems pretty easy.

P.S. Thank you for a great work.
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Mon, 12 January 2015, 16:44:16
So I've got my teensy all soldered up, I ran the test program that makes the LED blink rapidly, and I'm ready to download the code. One problem: How do I do that? I can't seem to find a definitive "download here" button on the github page. I'm completely new to this, so if someone could make/find a video of someone downloading the code and uploading it to their teensy, I would be forever in their debt.
Oh, and I'm converting an M0116, if that's important.
Title: Re: ADB to USB keyboard converter
Post by: Blaise170 on Mon, 12 January 2015, 19:20:34
So I've got my teensy all soldered up, I ran the test program that makes the LED blink rapidly, and I'm ready to download the code. One problem: How do I do that? I can't seem to find a definitive "download here" button on the github page. I'm completely new to this, so if someone could make/find a video of someone downloading the code and uploading it to their teensy, I would be forever in their debt.
Oh, and I'm converting an M0116, if that's important.

You'll need to compile the code on your own to get a .hex file. If you need a .hex file to load onto your Teensy I can try to look for mine but no guarantees.
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Mon, 12 January 2015, 20:05:40
So I've got my teensy all soldered up, I ran the test program that makes the LED blink rapidly, and I'm ready to download the code. One problem: How do I do that? I can't seem to find a definitive "download here" button on the github page. I'm completely new to this, so if someone could make/find a video of someone downloading the code and uploading it to their teensy, I would be forever in their debt.
Oh, and I'm converting an M0116, if that's important.

You'll need to compile the code on your own to get a .hex file. If you need a .hex file to load onto your Teensy I can try to look for mine but no guarantees.

I'd like to try doing that myself, but I don't know where to start or how :/
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Tue, 13 January 2015, 02:07:39
So I've got my teensy all soldered up, I ran the test program that makes the LED blink rapidly, and I'm ready to download the code. One problem: How do I do that? I can't seem to find a definitive "download here" button on the github page. I'm completely new to this, so if someone could make/find a video of someone downloading the code and uploading it to their teensy, I would be forever in their debt.
Oh, and I'm converting an M0116, if that's important.

You'll need to compile the code on your own to get a .hex file. If you need a .hex file to load onto your Teensy I can try to look for mine but no guarantees.

I'd like to try doing that myself, but I don't know where to start or how :/

I think this link is a beginning:

https://www.pjrc.com/teensy/gcc.html
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Tue, 13 January 2015, 03:03:38
Also, if anyone wants to use Arduino Leonardo, I found this pinout...

Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Tue, 13 January 2015, 03:07:57
So I've got my teensy all soldered up, I ran the test program that makes the LED blink rapidly, and I'm ready to download the code. One problem: How do I do that? I can't seem to find a definitive "download here" button on the github page. I'm completely new to this, so if someone could make/find a video of someone downloading the code and uploading it to their teensy, I would be forever in their debt.
Oh, and I'm converting an M0116, if that's important.

You'll need to compile the code on your own to get a .hex file. If you need a .hex file to load onto your Teensy I can try to look for mine but no guarantees.

I'd like to try doing that myself, but I don't know where to start or how :/

I think this link is a beginning:

https://www.pjrc.com/teensy/gcc.html
On second thought, if someone could find me the required code, that would be nice :P
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Tue, 13 January 2015, 10:02:23
OK, I flashed my Arduino Leonardo, and got ADB Keyboard converter in my devices (and keyboard with correct vid and pid), so I assume flash was OK... Tried to connect my AEKII with wires and pins to controller, and got nothing. Well... I suppose I'll try to do some soldering inside. And I guess Leonardo doesn't have any internal pull-out, so I'll get this 1 kohm resistor...
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 13 January 2015, 13:53:02
So I've got my teensy all soldered up, I ran the test program that makes the LED blink rapidly, and I'm ready to download the code. One problem: How do I do that? I can't seem to find a definitive "download here" button on the github page. I'm completely new to this, so if someone could make/find a video of someone downloading the code and uploading it to their teensy, I would be forever in their debt.
Oh, and I'm converting an M0116, if that's important.

Click to see video.
(http://i.imgur.com/Al956JGm.gif) (http://i.imgur.com/Al956JG.gif)
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Tue, 13 January 2015, 21:00:32
So I've got my teensy all soldered up, I ran the test program that makes the LED blink rapidly, and I'm ready to download the code. One problem: How do I do that? I can't seem to find a definitive "download here" button on the github page. I'm completely new to this, so if someone could make/find a video of someone downloading the code and uploading it to their teensy, I would be forever in their debt.
Oh, and I'm converting an M0116, if that's important.

Click to see video.
(http://i.imgur.com/Al956JGm.gif) (http://i.imgur.com/Al956JG.gif)
Is this being done in git shell?
Also, I'm confused what happens after the git clone has been made, when I type in $ cd and press enter after that step nothing happens
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 14 January 2015, 02:15:32
It is just bash.

Ah, maybe confusing. It is bash completion, I was pressing 'Ctrl-i' to get directory listing, not 'Enter'.
Video is not always useful, reading text is more clear in some situation.

https://github.com/tmk/tmk_keyboard/blob/master/README.md
https://github.com/tmk/tmk_keyboard/blob/master/doc/build.md
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Wed, 14 January 2015, 03:52:55
So I've got my teensy all soldered up, I ran the test program that makes the LED blink rapidly, and I'm ready to download the code. One problem: How do I do that? I can't seem to find a definitive "download here" button on the github page. I'm completely new to this, so if someone could make/find a video of someone downloading the code and uploading it to their teensy, I would be forever in their debt.
Oh, and I'm converting an M0116, if that's important.

Click to see video.
(http://i.imgur.com/Al956JGm.gif) (http://i.imgur.com/Al956JG.gif)
Is this being done in git shell?
Also, I'm confused what happens after the git clone has been made, when I type in $ cd and press enter after that step nothing happens

You can go there https://github.com/tmk/tmk_keyboard

And download zip-file with all project.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Thu, 15 January 2015, 11:21:20
Yes! It's alive! Thank you, Hasu.

Now I'm just need to solder my makeshift mock-up contraption together :)
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Sat, 17 January 2015, 12:34:46
I have a question. I have AEKII with AZERTY layout, and on this keyboard I have two buttons producing "\" symbol, first left of "1" button and producing scancode 226, and second right of " button, with scancode 220. Can I use one of them as fn button? And If I can, could anyone explaine, how?

UPDATE. I SHOULD have read all readme files first :) Got the second layer setted up with no problems (almost).

Again, thank you, hasu.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Sun, 18 January 2015, 12:16:13
Oh, when I tried to upload new hex file to my Arduino Leonardo, there were some troubles - i discovered that hasu's firmware, despite being great, caused arduino's serial port to conplete vanish from the system, so I had no way to upload newly conpiled hex-file (so I thought), but I found solution eventually. Here it is:

I reset the board so that the arduino bootloader appeared as a com port in my Device manager

I set the arduino IDE to use the port that appeared for the bootloader (by editing settings file)

I uploaded a simple sketch (led blinking) and pressed reset during the "upload phase" so that the port appeared during the upload

The upload completed successfully and the arduino was back in the com port list - after that I uploaded hex file successfully with Arduino Builder
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 18 January 2015, 17:16:29
Glad to hear it works for you!

Leonardo and its variants like pro micro uses software serial(USB CDC) unlike other normal Arduino's. If you use firmware makde by other than Arduino IDE you'll lose the serial connection during firmware is running. The software serial depends on fact that you are using Arduino library.

Meanwhile its bootloader can offer software serial line for flashing firmware. You can start bootloader by pressing reset button on the board whenever you like. Note that after 8 seconds the bootloader disappears and firmware starts automatically.

With Arduino firmware you can start bootloader from Arduino IDE without pressing reset button, Arduino IDE sends sepecial signal upon the serial line. With tmk firmware it is not useful to use Arduino IDE to flash firmware, use avrdude instead, or other tools.

Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Sun, 18 January 2015, 17:29:13
I'm still stuck :/
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 18 January 2015, 17:56:30
Go for it!

Or buy Griffin iMate to save your time. It is really a good option seriously.
Title: Re: ADB to USB keyboard converter
Post by: ShawnMeg on Mon, 19 January 2015, 00:39:28
https://drive.google.com/file/d/0By-yXJDisUbyTTFKUW1Scl9TUVE/view?usp=sharing (https://drive.google.com/file/d/0By-yXJDisUbyTTFKUW1Scl9TUVE/view?usp=sharing)

For what it's worth, here's my attempt at compiling and the resultant .hex file.  I hope this will help someone out.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Mon, 19 January 2015, 01:45:52
Glad to hear it works for you!

Leonardo and its variants like pro micro uses software serial(USB CDC) unlike other normal Arduino's. If you use firmware makde by other than Arduino IDE you'll lose the serial connection during firmware is running. The software serial depends on fact that you are using Arduino library.

Meanwhile its bootloader can offer software serial line for flashing firmware. You can start bootloader by pressing reset button on the board whenever you like. Note that after 8 seconds the bootloader disappears and firmware starts automatically.

With Arduino firmware you can start bootloader from Arduino IDE without pressing reset button, Arduino IDE sends sepecial signal upon the serial line. With tmk firmware it is not useful to use Arduino IDE to flash firmware, use avrdude instead, or other tools.

Thank you, hasu, now I understand. Yes, it's exactly so - after flashing firmware there were no Leonardo serial ports in system, so I had to flash it after pressing reset buttons. I just thought it not obvious, so I wrote about it here.

I use Arduino Builder for flashing - it's pretty easy to use.
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Mon, 19 January 2015, 10:09:59
GOT IT!!!!!
I have a fully working Apple M0116 now!!!!!
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Mon, 19 January 2015, 13:38:44
GOT IT!!!!!
I have a fully working Apple M0116 now!!!!!

Enjoy :) But why you couldn't compile the source? It's pretty easy, both on Linux and Windows.
Title: Re: ADB to USB keyboard converter
Post by: ShawnMeg on Mon, 19 January 2015, 14:40:11
GOT IT!!!!!
I have a fully working Apple M0116 now!!!!!

Enjoy :) But why you couldn't compile the source? It's pretty easy, both on Linux and Windows.

It's easy if you know what you are doing, but for novices it's not as straightforward.  I just happen to have some Linux and terminal/command line experience.  The initial post was a little confusing in that the github link didn't have a download link.  I had to click "tmk_keyboard" to get to a page where there was a link to download the zip. 
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Mon, 19 January 2015, 14:45:50
GOT IT!!!!!
I have a fully working Apple M0116 now!!!!!

Enjoy :) But why you couldn't compile the source? It's pretty easy, both on Linux and Windows.

It's easy if you know what you are doing, but for novices it's not as straightforward.  I just happen to have a some Linux and terminal/command line experience.  The initial post was little confusing in that the github link didn't have a download link.  I had to click "tmk_keyboard" to get to a page where there was a link to download the zip.
+1
If you've never done this before, it is extremely confusing.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Tue, 20 January 2015, 01:51:38
GOT IT!!!!!
I have a fully working Apple M0116 now!!!!!

Enjoy :) But why you couldn't compile the source? It's pretty easy, both on Linux and Windows.

It's easy if you know what you are doing, but for novices it's not as straightforward.  I just happen to have some Linux and terminal/command line experience.  The initial post was a little confusing in that the github link didn't have a download link.  I had to click "tmk_keyboard" to get to a page where there was a link to download the zip.

Well, that is true. Also, for compining it on windows you need some tools. I got them here:

https://www.pjrc.com/teensy/gcc.html

It's a good link for adding to the first post ;)

Oh, and if you using Windows 8 or 8.1 and keep getting errors instead of conpiling, you'll probably need to replace this file in compiler directory somewhere:
Title: Re: ADB to USB keyboard converter
Post by: ShawnMeg on Tue, 20 January 2015, 09:01:47
GOT IT!!!!!
I have a fully working Apple M0116 now!!!!!

Enjoy :) But why you couldn't compile the source? It's pretty easy, both on Linux and Windows.

It's easy if you know what you are doing, but for novices it's not as straightforward.  I just happen to have some Linux and terminal/command line experience.  The initial post was a little confusing in that the github link didn't have a download link.  I had to click "tmk_keyboard" to get to a page where there was a link to download the zip.

Well, that is true. Also, for compining it on windows you need some tools. I got them here:

https://www.pjrc.com/teensy/gcc.html

It's a good link for adding to the first post ;)

Oh, and if you using Windows 8 or 8.1 and keep getting errors instead of conpiling, you'll probably need to replace this file in compiler directory somewhere:

Thanks.  That's a great link, and should be added to the original post about compiling.  Or someone should make a sticky about how to compile, for beginners.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Fri, 23 January 2015, 12:03:34
Hmm... Anyone knows if I can to power on my PC with the power key on AEKII keyboard, or this is just not possible?
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Fri, 23 January 2015, 12:33:56
Hmm... Anyone knows if I can to power on my PC with the power key on AEKII keyboard, or this is just not possible?
I don't think so, I was wondering the same thing about my m0116.
On another note, does anyone know of a way to fix the fact that the m0116 only has 2 key rollover?
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Fri, 23 January 2015, 14:11:00
Hmm... Anyone knows if I can to power on my PC with the power key on AEKII keyboard, or this is just not possible?
I don't think so, I was wondering the same thing about my m0116.
On another note, does anyone know of a way to fix the fact that the m0116 only has 2 key rollover?

Nope. It's not IBM Model F... 2KRO is all you get.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Sun, 25 January 2015, 13:16:31
Hmm... Anyone knows if I can to power on my PC with the power key on AEKII keyboard, or this is just not possible?
Nope.  Power on functionality was done using the power key as a hard wired "on" switch for the PSU. That's what that extra wire in the ADB cable is all about.

On another note, does anyone know of a way to fix the fact that the m0116 only has 2 key rollover?
Not without manually rewiring the matrix to incorporate diodes, completely removing the ADB controller, and wiring the new matrix direct to the teensy, then using either hasu or soarer's firmware.  Totally do-able, the PCB is single sided so all you'd need to do is cut some traces and solder some diodes in, but you'd remove any way of ever making it "authentic" again if you care about that.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Mon, 26 January 2015, 09:28:34
Hmm... Anyone knows if I can to power on my PC with the power key on AEKII keyboard, or this is just not possible?
Nope.  Power on functionality was done using the power key as a hard wired "on" switch for the PSU. That's what that extra wire in the ADB cable is all about.

I know about original functionality, but in all other ways it works like regular key and I use it for powering my PC off (as I included this function in my layout).
It's just I had one USB keyboard with power key I could power my PC with... But I guess with USB you stick to option your motherboard gives you :)
Title: Re: ADB to USB keyboard converter
Post by: Hak Foo on Tue, 27 January 2015, 23:24:09
You can also use that kind of key to power the PC on... but the BIOS has to support it.  You might want to check for a "wake on USB" option .
Title: Re: ADB to USB keyboard converter
Post by: neex on Wed, 18 February 2015, 21:00:16
I'm trying to get this to work with a couple of Apple Extended Keyboards (M0115).

When I connect the keyboard to my computer through the Teensy 2.0, all three LEDs on the keyboard light up for a brief moment.  Then they go dim (about half brightness) and remain at that level indefinitely.  The keyboard is totally unresponsive.

Thanks.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 19 February 2015, 00:10:49
It is worth checking your wiring again.
Title: Re: ADB to USB keyboard converter
Post by: neex on Thu, 19 February 2015, 09:48:12
Ok, I did.  I re-soldered it to the Teensy and, this time, pushed the stripped ends of the wires directly into the appropriate holes of the ADB socket (which I can confirm works with my Griffin iMate).  Still behaving the same: all three LED lights steady dim and keyboard unresponsive (and, by the way, this is happening with both of my M0115s).

Needless to say I'm confident the wiring is good (but I'm willing to play with it some more if there are no other options).

A question about compiling:

I installed Crosspack (and restarted computer/Terminal), but when I tried to execute the "make" command in Terminal the output told me I needed to install Xcode.  I then installed Xcode and compiled (seemingly successfully).  So what's the point of Crosspack if Xcode is what is needed (or, are they both needed)?  Could it have compiled incorrectly?

Thanks.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Thu, 19 February 2015, 11:48:16
Ok, I did.  I re-soldered it to the Teensy and, this time, pushed the stripped ends of the wires directly into the appropriate holes of the ADB socket (which I can confirm works with my Griffin iMate).  Still behaving the same: all three LED lights steady dim and keyboard unresponsive (and, by the way, this is happening with both of my M0115s).

Needless to say I'm confident the wiring is good (but I'm willing to play with it some more if there are no other options).

A question about compiling:

I installed Crosspack (and restarted computer/Terminal), but when I tried to execute the "make" command in Terminal the output told me I needed to install Xcode.  I then installed Xcode and compiled (seemingly successfully).  So what's the point of Crosspack if Xcode is what is needed (or, are they both needed)?  Could it have compiled incorrectly?

Thanks.

Hmm, are you sure you put wires into appropriate holes? Maybe you had +5v and Data reversed?

And do you have pull-up resistor?
Title: Re: ADB to USB keyboard converter
Post by: MontyElephant on Thu, 19 February 2015, 21:35:56
Is it possible to add macros built into the converter. Such as for the F keys so I don't need to transfer hotkey scripts to each computer?

Title: Re: ADB to USB keyboard converter
Post by: hasu on Fri, 20 February 2015, 16:08:49
neex, you can see device whose VID:PID is FEED:0ADB on your system if firmware is uploaded properly.

MontyElephant, see these.
https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#23-macro-action
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/hhkb/keymap_hasu.c#L219
Title: Re: ADB to USB keyboard converter
Post by: neex on Sun, 22 February 2015, 15:34:07
Hmm, are you sure you put wires into appropriate holes? Maybe you had +5v and Data reversed?

Yes, everything is wired correctly, including the vcc and data.

And do you have pull-up resistor?

Yes-- it's a 1000 ohm 1/2 watt.  Thanks for prompting me to check this connection, though--it was not solid, but I fixed it.  Unfortunately, the keyboard still isn't working.  Without the resistor, the three lights on the keyboard are steady dim.  With the resistor, they are off, but the keyboard still is not functional.

neex, you can see device whose VID:PID is FEED:0ADB on your system if firmware is uploaded properly.

Thanks.  I was able to verify the the firmware did upload correctly.  I just can't get any response from the keyboard.

(https://farm9.staticflickr.com/8610/16430780099_bbb75de4e3.jpg)
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Mon, 23 February 2015, 00:54:35
Hmm, are you sure you put wires into appropriate holes? Maybe you had +5v and Data reversed?

Yes, everything is wired correctly, including the vcc and data.

And do you have pull-up resistor?

Yes-- it's a 1000 ohm 1/2 watt.  Thanks for prompting me to check this connection, though--it was not solid, but I fixed it.  Unfortunately, the keyboard still isn't working.  Without the resistor, the three lights on the keyboard are steady dim.  With the resistor, they are off, but the keyboard still is not functional.

neex, you can see device whose VID:PID is FEED:0ADB on your system if firmware is uploaded properly.

Thanks.  I was able to verify the the firmware did upload correctly.  I just can't get any response from the keyboard.


Did you try this with a single keyboard, or several ones?
Title: Re: ADB to USB keyboard converter
Post by: neex on Mon, 23 February 2015, 08:47:06
Did you try this with a single keyboard, or several ones?

I have two (2) Apple M0115s.  I've tried both.  Same results.

Again, both work properly with the Griffin iMate.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Mon, 23 February 2015, 09:41:07
Did you try this with a single keyboard, or several ones?

I have two (2) Apple M0115s.  I've tried both.  Same results.

Again, both work properly with the Griffin iMate.

Then it's something with your wiring, your firmware or your Mac. I'd recommend you try it with another computer - it it works, then it's something with your Mac.

I include my compiled hex file which definitely works, so you can try to load it, if step one woudn't work.

P.S. Heh, you're lucky one to get two AEK - so far I couldn't get one in my country and it's too expensive to ship overseas :)
Title: Re: ADB to USB keyboard converter
Post by: neex on Tue, 24 February 2015, 18:59:16
Then it's something with your wiring, your firmware or your Mac. I'd recommend you try it with another computer - it it works, then it's something with your Mac.

I include my compiled hex file which definitely works, so you can try to load it, if step one woudn't work.

It's still not working.  I uploaded your copy of the hex file (thanks for that).  I also tried it with both my MacBook Air and Mac mini.

So, for good measure I'll check/re-solder the wiring in the morning.  Although, I remain confident my wiring is good.

In the meantime, is there anyone who can confirm whether they've gotten this to work specifically with the M0115 model?

One other thing... I did run the HID Listen program.  It printed the following over and over until I terminated:

adb_host_kbd_recv: ERROR(-30)

I appreciate the ongoing help.  I really hope to figure this out!
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 24 February 2015, 19:23:14
That error occurs in case converter cannot comminicate with keyboard.
With all due respect, I'm suspecting your wiring, post detailed photos of your work(Teensy and connector) so that we can double check it.
Title: Re: ADB to USB keyboard converter
Post by: neex on Tue, 24 February 2015, 19:55:34
That error occurs in case converter cannot comminicate with keyboard.
With all due respect, I'm suspecting your wiring, post detailed photos of your work(Teensy and connector) so that we can double check it.

(https://farm8.staticflickr.com/7284/16639722665_12379513ba.jpg)

(https://farm8.staticflickr.com/7286/16639722115_169e86ecd5.jpg)

(https://farm8.staticflickr.com/7289/16017422554_fbea741b0f.jpg)

(https://farm9.staticflickr.com/8670/16432427097_9562b5c6b3.jpg)

(https://farm8.staticflickr.com/7282/16017420794_4d52320354.jpg)
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 24 February 2015, 20:05:32
Use D0 pin unless you want to edit config.h yourself.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Wed, 25 February 2015, 02:40:29
That error occurs in case converter cannot comminicate with keyboard.
With all due respect, I'm suspecting your wiring, post detailed photos of your work(Teensy and connector) so that we can double check it.

De-solder wire from F0 on Teensy and solder it to D0. It should work right after that.

Or, if you want, you can edit file config.h in directory adb_usb. Find the section

/* ADB port setting */
#define ADB_PORT        PORTD
#define ADB_PIN         PIND
#define ADB_DDR         DDRD
#define ADB_DATA_BIT    0

And replace PORTD PIND and DDRD with PORTF PINF and DDRF respectively, then recompile firmware and upload it.

(that if you don't want to re-solder)

But - it was written about PD0 pin by default right in the first post.
Title: Re: ADB to USB keyboard converter
Post by: neex on Wed, 25 February 2015, 17:53:58
Thanks!  Working now!  Don't know why I used F0... sorry to have wasted anyone's time.

BTW, this is a great hack.  I can't wait to get my keyboard back together!  Since I had everything disassembled, I started the process of doing a retrobright to the case (but it's taking a while because the weather here has been dreary and I do not have a UV lamp).  I also got a nicer braided nylon USB cable that I plan to run through one of the two round holes for the original ADB jacks.  So that the hole would more snugly fit the narrower USB cable, I made a custom small black plastic bushing, which I hope will help keep dust and critters out of my keyboard.  I'll post pics when I'm finished.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 25 February 2015, 21:32:34
Great.

Yes, post the result of your work. People including me like to see pics of DIY keyboard work.
Title: Re: ADB to USB keyboard converter
Post by: neex on Sat, 14 March 2015, 15:17:57
Finished!! Retrobright turned out looking good:
(https://farm9.staticflickr.com/8623/16786074426_9715e93996.jpg)

Closed off left side where ADB jack used to be:
(https://farm9.staticflickr.com/8745/16810848141_56d160215f.jpg)

Smaller hole on right side for USB cable:
(https://farm9.staticflickr.com/8754/16811949005_383aae61ea.jpg)

Short nylon USB cable:
(https://farm8.staticflickr.com/7584/16810843992_7852f8d6b5.jpg)

New rubber feet:
(https://farm8.staticflickr.com/7633/16624571220_e6066a1111.jpg)

The guts:
(https://farm8.staticflickr.com/7604/16624394088_75f9cb23c5.jpg)
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Sat, 14 March 2015, 15:41:47
Finished!! Retrobright turned out looking good:

Not bad at all. It's a pity you had to remove adb sockets... but I guess it's easer to conceal controller inside of keyboard case. I made an external one, but so far didn't made a case for it :)

By the way - it's a pretty good retrobright. What you used for it?
Title: Re: ADB to USB keyboard converter
Post by: neex on Sun, 15 March 2015, 09:48:22
Retrobright was a mix of Oxy Clean, over-the-counter hydrogen peroxide, and glycerine.  It actually took about 5-6 half-day long treatments.

I wanted to remove the ADB sockets from this one since I just don't think I'd ever use them again—but from a purist standpoint, I understand the regret.  I got this keyboard, however, from an elementary school, and it was really abused before I got it.  You wouldn't notice it from my photos, but it was obviously dropped more than once.  One corner has a significant crack.  There are other significant scratches and scuffs on the case.  For me, there was little incentive to preserve the original condition of the keyboard.

Plus, like I said, I have another, which is in far better cosmetic condition.  I plan to make a ADB-to-USB cable for it... eventually.  I've got an old AlphaSmart USB/ADB cable that has a nice little case in-line that I plan to gut and use to house the Teensy (the unmodified AlphaSmart doesn't work with keyboards, in case you were wondering).

Now I need to get to the bottom of a new problem: one key is unresponsive (specifically the "1/!").  Another (the "+" on the numpad) types 1-3 characters per keypress.  Thoughts?

EDIT: Pics of the AlphaSmart:
(https://farm8.staticflickr.com/7639/16202886013_848b8e387f.jpg)
(https://farm9.staticflickr.com/8573/16200463244_5febf0e3bd.jpg)
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Sun, 15 March 2015, 11:00:45
Now I need to get to the bottom of a new problem: one key is unresponsive (specifically the "1/!").  Another (the "+" on the numpad) types 1-3 characters per keypress.  Thoughts?

Switches are dirty inside. Or there are something bended inside. Or there are some problems with soldering. Or there are something happened with traces on PCB.

Well, I almost sure there are some conductive dirt inside Numpad +.
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Tue, 17 March 2015, 05:03:17

EDIT: Pics of the AlphaSmart:
Show Image
(https://farm8.staticflickr.com/7639/16202886013_848b8e387f.jpg)

Show Image
(https://farm9.staticflickr.com/8573/16200463244_5febf0e3bd.jpg)


Oh, nice one. You can solder inside Teensy or Arduino, and get your own universal ADB adapter.
Title: Re: ADB to USB keyboard converter
Post by: Papkee on Sun, 29 March 2015, 20:24:11
Okay, so I've got the hardware side of my A9M0330 (which I believe is the same as the M0116?) wired up. I'm clueless to the software side - I know my way around C decently but I cannot for the life of me figure out how to set up the library so that it works with this keyboard.

Here's what I already tried. The readme seems outdated and mentions files that don't exist, and doesn't tell you how to specify what keyboard you're compiling for.

Navigate to adm_usb directory and make - compiled OK

Upload code to teensy - uploaded OK

But I get no response from the keyboard. I checked with HID_Listen and it shows that a keyboard is connected and does not throw any errors at me. (earlier I was getting -30 due to a bad connection) However, typing does not produce any response.

EDIT:

I made my own keymap, named it keymap_papkee and used make KEYMAP=papkee

No keys work still, EXCEPT for the power key up top, which actually does put my computer to sleep.

Now things are getting really weird.

Would really appreciate some help with this.
Title: Re: ADB to USB keyboard converter
Post by: ch3wt0ys on Mon, 30 March 2015, 07:25:45
I need a bit of help with this. Found a Apple Extended Keyboard II (amongst other Apple keyboards and computers) in my garage, but this was the only one with switches and got lucky with it being the USA made with Cream Alps switches.

But, seems every tutorial I see on making a ADB -> USB converter is based around the Teensy and I happen to have a Arduino Micro ATMEGA32u4, which was given to me while back.

Bit of a novice I suppose lol. Any help would be appreciated, just want to get this keyboard working so I can get back to my finger workouts that have been put on hold since elementary school.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 30 March 2015, 14:17:05
Papkee,
post pic of you hardware, pics are always useful and save time of both side of us.
Which part of README is outdated? Let me know, I'll fix it.
hmm, power key only works? weird.

ch3wt0ys,
Arduino Mircro works, but I dont think tutorial is available. You need to learn yourself.
Title: Re: ADB to USB keyboard converter
Post by: Papkee on Mon, 30 March 2015, 15:36:39
Papkee,
post pic of you hardware, pics are always useful and save time of both side of us.
Which part of README is outdated? Let me know, I'll fix it.
hmm, power key only works? weird.

Without changing any wiring or code, it seems to just work now. All keys function fine, and I can use custom keymaps perfectly.

The outdated part I was referring to was the way in which keymaps are made and used - the readme mentions keymap.c inside of adb_usb which is not used any more. Additionally I feel it could be a bit more explanatory as to how keymaps are selected and used. It took me a while before I figured out what parts of what files needed to be changed.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 30 March 2015, 16:11:43
I see, I'll fix.
To me writing English sentences takes much more time than coding. Could you make idea of the explation?
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Tue, 31 March 2015, 15:41:13
I need a bit of help with this. Found a Apple Extended Keyboard II (amongst other Apple keyboards and computers) in my garage, but this was the only one with switches and got lucky with it being the USA made with Cream Alps switches.

But, seems every tutorial I see on making a ADB -> USB converter is based around the Teensy and I happen to have a Arduino Micro ATMEGA32u4, which was given to me while back.

Bit of a novice I suppose lol. Any help would be appreciated, just want to get this keyboard working so I can get back to my finger workouts that have been put on hold since elementary school.

I've used Arduino Pro Micro and wrote about it. If you need help with pins, read the thread.
Title: Re: ADB to USB keyboard converter
Post by: doodersbrother on Sun, 05 April 2015, 21:07:32
I just got a apple adjustable keyboard (m1242) and built this converter! It works well although it seems to requires the numpad be plugged in to be used, is there something that I am missing??
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 05 April 2015, 22:37:39
hmm, I'm a bit confused. You mean, adjustable keyboard doesn't work without numpad? This is against what I expect.(EDIT: or I read you wrongly)

This converter doesn't support ADB 'daisy chain' connection. So you cannot use both adjustable keyboard and numpad at a time. And buttons at righ side of adjustable keyboard also aren't supported.

Title: Re: ADB to USB keyboard converter
Post by: mougrim on Mon, 06 April 2015, 02:12:40
hmm, I'm a bit confused. You mean, adjustable keyboard doesn't work without numpad? This is against what I expect.(EDIT: or I read you wrongly)

This converter doesn't support ADB 'daisy chain' connection. So you cannot use both adjustable keyboard and numpad at a time. And buttons at righ side of adjustable keyboard also aren't supported.

My friend, who sold me my AEKII, has this Apple adjustable KB. He made two converters to be able use Numpad and KB simultaneously.
Title: Re: ADB to USB keyboard converter
Post by: Yoe on Mon, 06 April 2015, 05:08:42
Just throwing some pictures in if anyone is interested in seeing finished stuff.. :) Pro Micro clone and an ADB connector from a M0118. Housing is from a RJ45 F-F connector thing.

[attach=1][attach=2]
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Mon, 06 April 2015, 05:29:13
Just throwing some pictures in if anyone is interested in seeing finished stuff.. :) Pro Micro clone and an ADB connector from a M0118. Housing is from a RJ45 F-F connector thing.

(Attachment Link) (Attachment Link)

Thats... Cool. Of course we're interested!
Title: Re: ADB to USB keyboard converter
Post by: doodersbrother on Mon, 06 April 2015, 09:10:12
hmm, I'm a bit confused. You mean, adjustable keyboard doesn't work without numpad? This is against what I expect.(EDIT: or I read you wrongly)

This converter doesn't support ADB 'daisy chain' connection. So you cannot use both adjustable keyboard and numpad at a time. And buttons at righ side of adjustable keyboard also aren't supported.

Daisy chaining the keyboard and the numpad is the only way that I have been able to get it to work. Both will work at the same time off of one converter!
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 06 April 2015, 23:53:37
Hmm, very interesting.
I have an adjustable keyboard but no numpad and confirmed that the keyboard solely works with converter.
Adjustable keyboard should work without numpad.
Title: Re: ADB to USB keyboard converter
Post by: doodersbrother on Tue, 07 April 2015, 16:06:58
What ohm resistor are you using?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 07 April 2015, 17:41:12
I dont' remember, maybe 1K?

Post pic of your converter and its wiring so that I and the community can double-check.
It doesn't seems like your problem is that simple but posting pic is still very helpful on both side of us.


From the first post,
Quote
NEED HELP?
Your converter doesn't work?
Frist, post pics of your hardware and wriring this really save time of us. Don't save your time by omitting this.

If you edit code
Post your code. Don't hesitate to show your dirty code!
Title: Re: ADB to USB keyboard converter
Post by: doodersbrother on Tue, 07 April 2015, 18:17:08
http://imgur.com/Y5NxKWx
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 07 April 2015, 18:32:25
From the pic I'm not sure that resistor works properly as pull-up.
Are you sure about the pull-up resistor? Pull-up resistor should be connected between 5V and signal line, not inline of singal line.

Title: Re: ADB to USB keyboard converter
Post by: doodersbrother on Tue, 07 April 2015, 18:40:03
That sounds like it's it! Thanks tons! Any idea why that made daisy chaining work??
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 07 April 2015, 18:51:33
I've never tested multiple keyboard with 'daisy chain' connection and though it desn't work so far.
But I'm testing two ADB keyboards and it looks like they work, against my expectation, LOL.

This converter does not assign/change device's address to handle multiple devices and use default address instead. This means multiple keyboards have same address and I thought this causes some error in ADB communication, but it seems like I was wrong. At least two keyboads work with daisy chain.
Title: Re: ADB to USB keyboard converter
Post by: XMIT on Mon, 13 April 2015, 14:43:21
I'm more active on "the other forum" but did spend some time this weekend playing with TMK for ADK keyboards.

Keyboards I tried:
IIGS - Apple Desktop Bus keyboard (IIgs keyboard)
AK - Apple Keyboard (Macintosh SE keyboard)
AEK II - Apple Extended Keyboard II
AAK - Apple Adjustable Keyboard

Findings:
- AAK works okay without pullup resistors. All others work okay with 10k pullup.
- "Sparkfun Pro Micro" is an inexpensive ATmega32u4 board that works great here. I had to make sure this was in my Makefile:
Code: [Select]
MCU = atmega32u4- To program from a Mac I added this to my Makefile (and yes your port will probably differ)
Code: [Select]
# Program Sparkfun Pro Micro using avrdude
PROGRAM_CMD = avrdude -p $(MCU) -P /dev/cu.usbmodem1421 -c avr109 -U flash:w:$(TARGET).hex
- AAK's volume adjust buttons do not work. I wonder if they can be remapped.
- AK's numeric keypad is all wrong. It may need a special key map. Pressing numeric keypad buttons gets letters instead of numbers.

Overall I'm ecstatic that this works and willing to deal with / fix these last quirks. I'm going to try the M0110 converter as soon as my RJ10 cable arrives. Thank you hasu for the great work!

I'd also like to add support for additional protocols once I work my way through my collection. I have a bunch of weird old terminal keyboards that I would like to convert.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 13 April 2015, 18:50:49
Quote
- AAK's volume adjust buttons do not work. I wonder if they can be remapped.
- AK's numeric keypad is all wrong. It may need a special key map. Pressing numeric keypad buttons gets letters instead of numbers.
IIRC, Adjustable keyboard has logically two keyboard instances, one for main alpha part and other for those buttons. As I said previously TMK doesn't support handling multiple ADB keyboards properly, I think you need to implement proper ADB address management.

AK is M0116? M0116 including numpad works well at least on my side.
Title: Re: ADB to USB keyboard converter
Post by: NoahBC on Mon, 20 April 2015, 17:03:58
I have an M0116, and I'd like to map the numpad to F keys by default, and use the locking capslock switch as a numlock instead. Is this possible? If I map that key to FN0 instead of LCAP, will anything bad happen?

I.e. this code:

EDIT: This works! If you have an m0116 or similar (i.e. IIGS or ADB 2) this should work for you too! Save it to keymap_m0116.c and compile with "make KEYMAP=m0116"

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


const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* Default Layer: plain keymap
     *                     +-------+
     *                     | power |
     *                     +-------+
     * |----------------------------------------------------------.   ,---------------.
     * |ESC|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa|   |Ins|Hom|End|Mut|
     * |-----------------------------------------------------------|   |---------------|
     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|     |   | F7| F8| F9|Vl+|
     * |-----------------------------------------------------|     |   |---------------|
     * |CapsLo|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  |   | F4| F5| F6|Vl-|
     * |-----------------------------------------------------------|   |---------------|
     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |   | F1| F2| F3|   |
     * |-----------------------------------------------------------|   |-----------|Ent|
     * | FN0| Alt| Gui| ` |       Space        | \ |Lef|Rig|Up |Dwn|   |  F10  | . |   |
     * `-----------------------------------------------------------'   `---------------'
     */
    KEYMAP_M0116_ANSI(
            PWR,
    ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS,HOME, END,MUTE,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,          F7,  F8,  F9,  VOLU,
    LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,      F4,  F5,  F6,  VOLD,
    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,     F1,  F2,  F3,
    FN0,LALT,LGUI,GRV,         SPC,               BSLS,LEFT,RIGHT,DOWN,UP,     F10,      PDOT,PENT
    ),

    /* Default Layer: plain keymap
     *                     +-------+
     *                     | power |
     *                     +-------+
     * ,-----------------------------------------------------------.   ,---------------.
     * |ESC|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa|   |Ins| = | / | * |
     * |-----------------------------------------------------------|   |---------------|
     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|     |   |  7|  8|  9| + |
     * |-----------------------------------------------------|     |   |---------------|
     * |CapsLo|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  |   |  4|  5|  6| -|
     * |-----------------------------------------------------------|   |---------------|
     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |   |  1|  2|  3|   |
     * |-----------------------------------------------------------|   |-----------|Ent|
     * | FN0| Alt| Gui| ` |       Space        | \ |Lef|Rig|Up |Dwn|   |  0    | . |   |
     * `-----------------------------------------------------------'   `---------------'
     */
    KEYMAP_M0116_ANSI(
            PWR,
    ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, EQL, PSLS,PAST,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,          P7,  P8,  P9,  PMNS,
    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,      P4,  P5,  P6,  PPLS,
    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,     P1,  P2,  P3,
    FN0,LALT,LGUI,GRV,         SPC,               BSLS,LEFT,RIGHT,DOWN,UP,     P0,       PDOT,PENT
    ),
};

const uint16_t PROGMEM fn_actions[] = {
    [0] = ACTION_LAYER_MOMENTARY(1),                // Layer activate!
};

edit: hah nope that doesn't work at all. Capslock now gives me this character for some reason: ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ

edit2: oh, I guess it would help if I actually told it what FN0 was supposed to do, huh? Updated code, now it works!!

Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 20 April 2015, 18:03:23
I'm sure this is completely possible, read keymap document.
It doesn't seems your keymap is correct, you will need to have FN0 definition, at least.
Title: Re: ADB to USB keyboard converter
Post by: skullydazed on Mon, 27 April 2015, 09:57:07
Mf dad just bought a storage locker with a bunch of old ADB keyboards, so I'm trying to build converters. However, while I have basic functionality working great whenever I hit the caps lock key it causes both keyboards (the ADB board and my custom board that also uses TMK) to start go crazy and send random keys. Here's what I built using a teensy 2.0:

(http://i.imgur.com/WyPHZ1B.jpg)

All I changed in the code is what pin the DATA wire is connected to and I made sure that all keymaps use LCAP.

Code: [Select]
diff --git a/converter/adb_usb/config.h b/converter/adb_usb/config.h
index 5ce5c22..9c325d5 100644
--- a/converter/adb_usb/config.h
+++ b/converter/adb_usb/config.h
@@ -48,7 +48,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define ADB_PORT        PORTD
 #define ADB_PIN         PIND
 #define ADB_DDR         DDRD
-#define ADB_DATA_BIT    0
+#define ADB_DATA_BIT    5
 //#define ADB_PSW_BIT     1       // optional

 /* key combination for command */
diff --git a/converter/adb_usb/keymap_hasu.c b/converter/adb_usb/keymap_hasu.c
index f2e59b3..a0b3f1f 100644
--- a/converter/adb_usb/keymap_hasu.c
+++ b/converter/adb_usb/keymap_hasu.c
@@ -22,7 +22,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
     GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,FN0,      DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
-    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
+    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
     LCTL,LGUI,LALT,          SPC,                               RGUI,RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
     ),
@@ -47,7 +47,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,      INS, HOME,PGUP,    NLCK,BTN1,BTN2,BTN3,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   PSCR,SLCK,PAUS,UP,  INS, FN0,      DEL, END, PGDN,    WH_D,MS_U,WH_U,WH_D,
-    CAPS,VOLD,VOLU,MUTE,F,   G,   H,   J,   HOME,PGUP,LEFT,RGHT,     ENT,                         MS_L,MS_D,MS_R,WH_U,
+    LCAP,VOLD,VOLU,MUTE,F,   G,   H,   J,   HOME,PGUP,LEFT,RGHT,     ENT,                         MS_L,MS_D,MS_R,WH_U,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   END, PGDN,DOWN,          RSFT,          PGUP,         WH_L,MS_D,WH_R,
     LCTL,LGUI,LALT,          SPC,                               RGUI,RCTL,     HOME,PGDN,END,     BTN1,     BTN2,BTN3
     ),

I don't get any messages in hid_listen when I do this, and at this point am at a loss. This happens with an M3501 and an M0487. Any ideas?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 27 April 2015, 16:28:50
Lokcing Capslock(LCAP) works with M0116 and IIGS keyboard on my side.

To get help message press  Power + h.
Title: Re: ADB to USB keyboard converter
Post by: skullydazed on Mon, 27 April 2015, 20:02:40
Is there any way to change the magic key? On my mac the power key actually does something, making it impractical to use for this purpose.

I also attempted to wire a different teensy up directly with the same result:

(http://i.imgur.com/yF4SanH.jpg)

So I replaced the locking switch with a matias switch, loaded a firmware with locking turned off, and I have the same problem. When I press caps lock the keyboard goes crazy.

Next I decided to start eliminating variables, so I unplugged my custom keyboard that also uses the TMK firmware... and now everything works perfectly. I can use both converters with either locking or non-locking keys. Any idea why having another TMK keyboard plugged in would be interfering?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 27 April 2015, 20:18:57
Ah I see, probably LOCKING_RESYNC is the cause. Comment out LOCKING_RESYNC_ENABLE.

I think you both of two keyboards are configured with enabling locking resync. This feature doesn't work in situation that  multiple keyboards with the function are connected, I found this fact just now :D
One keyboard sends capslock then other finds capslock state was changed against its will and sends capslock to correct the state and vice vesa. This continues endlessly. LOL I'll file the problem in gihtub issue tracker.


EDIT:
I'm curious about what it happens actually in this situation. Can you explain it and what is your OS?
Quote
When I press caps lock the keyboard goes crazy.
Title: Re: ADB to USB keyboard converter
Post by: skullydazed on Mon, 27 April 2015, 20:44:43
That makes sense, but I still have the problem even after I #undef LOCKING_SUPPORT_ENABLE and LOCKING_RESYNC_ENABLE for both keyboards. The problem goes away if I change CAPS to LCTL on the adb converter, so it's definitely something related to the behavior of CAPS/LCAPS. Could those defines be getting turned on somewhere else in TMK, overriding my config.h?

If we can't solve this I can live with only having one or the other plugged in at once. I appreciate your time looking into it.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 27 April 2015, 21:09:29
Hmm, I got into the conclusion too quickly. After checking source code closely 'Locking resync' feature seems to work correctly in that situation.

OK. We will need to start over to check the problem from the begining.

Can you describe the problem in the detail?
Quote
When I press caps lock the keyboard goes crazy.


What is your OS? Don't you use keymap softwares on OS?

The custom keyboad seems to be a cause of the problem.
How does your custom keyboards look like in fact? Posting pics and source github code repository will be very helpful.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 27 April 2015, 21:52:19
Mouse is supported by mek-apelsin (https://github.com/tmk/tmk_keyboard/pull/207) NOW


(http://i.imgur.com/WNOhMbwh.jpg?1)


Enjoy!
Title: Re: ADB to USB keyboard converter
Post by: skullydazed on Mon, 27 April 2015, 22:15:29
I'm on Maverics (OS X 10.9) and I do have Karabiner running, but I don't think that would interfere. I only have a few rules:

(http://i.imgur.com/3flc0Pn.png)

My custom keyboard is a modification of the gh60 firmware. I haven't gotten it onto github yet but here's a diff between the gh60 and mine:

https://gist.github.com/anonymous/b3d6e0654a1e03c37f43

The problem, as best as I can describe it:

When you have both keyboards plugged in, everything works great until you press caps lock. At that point the keyboard starts sending a sequence of keys over and over, most often something similar to this:

^[[D]=

Here's what I was able to capture with a bit of hid_listen, but keep in mind that the computer went to sleep several times during this session because the mac actually listens to the power button and went to sleep.

https://gist.github.com/anonymous/cf0db36bef87a7d50f64
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 27 April 2015, 22:56:52
I'm wondering  what the trigger of the problem is.
Both LCAP and CAPS of ADB keyboard can cause the problem? If so Locking feature doesn't seems to be a culprit.
Can LCAP or CAPS of the custom keyboard also cause the problem?

Are you having NKRO enabled on keyboards? If so disable it and see if the problem sitll appears.
Title: Re: ADB to USB keyboard converter
Post by: skullydazed on Mon, 27 April 2015, 23:10:55
Yes, both LCAP and CAPS can trigger this. I don't have any CAPS on my custom keyboard, I will try adding one tomorrow to see what happens. Tonight is family time and while we're all on laptops in the living room, that's not in my office where I can repro this. :)

I did not specifically enable or disable NKRO, it's whatever the default is. I will try that out in the morning.
Title: Re: ADB to USB keyboard converter
Post by: Red_dino on Tue, 05 May 2015, 21:52:26
This works with Windows 7, right? In my first attempt this evening I was unable to get it working. The lights on my Apple Extended (m0115) came on but Windows wasn't recognizing it as a keyboard. If I can't figure it out by this weekend, I'll post code and pics.
Title: Re: ADB to USB keyboard converter
Post by: Red_dino on Wed, 06 May 2015, 15:52:24
Typing this on my Apple now! I went to read what exactly a pull up resistor does and realized I had put the resistor from vcc to ground instead of vcc to data. >.< Thanks for making this happen hasu!
Title: Re: ADB to USB keyboard converter
Post by: afischer on Sat, 16 May 2015, 19:26:29
Hey everyone,

First want to say thanks to everyone who has contirbuted to this project. It's awesome.

I'm trying to build a ADB to USB converter using a teensy 2.0 for the AEKII. After building and using the teensy loader, the only thing I can get the keyboard to do is flash it's LEDs and make my mouse move to the upper left corner of the screen... Any help would be appreciated.

I love the keyboard and would like to get it working asap!
Title: Re: ADB to USB keyboard converter
Post by: Blaise170 on Sat, 16 May 2015, 19:40:59
Hey everyone,

First want to say thanks to everyone who has contirbuted to this project. It's awesome.

I'm trying to build a ADB to USB converter using a teensy 2.0 for the AEKII. After building and using the teensy loader, the only thing I can get the keyboard to do is flash it's LEDs and make my mouse move to the upper left corner of the screen... Any help would be appreciated.

I love the keyboard and would like to get it working asap!

Post your pictures of the wiring.
Title: Re: ADB to USB keyboard converter
Post by: afischer on Sat, 16 May 2015, 21:08:20
Here are some photos. Yeah, my soldering isn't great, but all the wires are making contact.

(http://imgur.com/iqMWJba)
(http://i.imgur.com/Sml0Xft.jpg)

Running hid_listen.mac, I get the following:

adb_host_kbd_recv: ERROR(-30)

Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 16 May 2015, 21:32:56
Pin usage of Teensy side looks OK. And soldering is not great but it also looks OK to me.
Probably you have wrong/bad connection of wire and resistor. Check it again. Or post pic of ADB connector side.

Many people have had wrong wirings for some reason so far. So we usually suspect your wiring first :D
Title: Re: ADB to USB keyboard converter
Post by: afischer on Sun, 17 May 2015, 08:42:21
Hey hasu,

Thanks for the awesome work. Thanks for checking my work.

I'm actually just using male jumper pins  as shown in the photos. I wanted to test that it would work before soldering.

Thanks!
Title: Re: ADB to USB keyboard converter
Post by: afischer on Sun, 17 May 2015, 12:17:00
So I just attempted to build and upload to the teensy on a PC to see If the same thing happens - it does. Even **Without** the keyboard plugged into the teensy, the teensy moves my computers mouse to the top left corner over and over again.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 17 May 2015, 16:17:10
Looks like the wiring is wrong. And it better has resistor. Did you read readme and see this figure?


Code: [Select]
female socket from the front:
  ,--_--.                 
 / o4 3o \      1: DATA
| o2   1o |     2: Power SW
 -  ===  -      3: VCC
  `-___-'       4: GND
Title: Re: ADB to USB keyboard converter
Post by: afischer on Sun, 17 May 2015, 17:24:17

Looks like the wiring is wrong. And it better has resistor. Did you read readme and see this figure?


Code: [Select]
female socket from the front:
  ,--_--.                 
 / o4 3o \      1: DATA
| o2   1o |     2: Power SW
 -  ===  -      3: VCC
  `-___-'       4: GND

Yeah, I looked at the readme.

I don't see what's wrong with the wiring? It still does the mouse thing with or without the resistor The image is rotated.
Title: Re: ADB to USB keyboard converter
Post by: afischer on Mon, 18 May 2015, 15:46:06
I Found the problem!!

It was a badly soldered pull up resistor. Re-soldering it did the trick!  :p

Now all I have to do is fix the broken period and "f" keys.... :(
Title: Re: ADB to USB keyboard converter
Post by: taiwanesekid05 on Thu, 21 May 2015, 05:55:11
When I try to compile the converter in Cygwin, I get this error:

Code: [Select]
/usr/bin/sh: dfu-programmer: command not found
/usr/bin/sh: dfu-programmer: command not found

-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


mkdir -p obj_adb_usb_lufa/common
Compiling C: ../../tmk_core/common/keymap.c
avr-gcc -c -mmcu=atmega32u4 -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=4096 -DADB_MOUSE_MAXACC=8 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8  -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DADB_MOUSE_ENABLE -DMOUSE_ENABLE -DMOUSEKEY_ENABLE -DMOUSE_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DVERSION=unknown -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_adb_usb_lufa/common/keymap.lst -I. -I../../tmk_core -I../../tmk_core/protocol/lufa -I../../tmk_core/protocol/lufa/LUFA-git -I../../tmk_core/protocol -I../../tmk_core/common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_adb_usb_lufa_common_keymap.o.d  ../../tmk_core/common/keymap.c -o obj_adb_usb_lufa/common/keymap.o
../../tmk_core/common/keymap.c: In function 'action_for_key_default':
../../tmk_core/common/keymap.c:37: error: parameter 'keycode' is initialized
../../tmk_core/common/keymap.c:37: error: 'layer' undeclared (first use in this function)
../../tmk_core/common/keymap.c:37: error: (Each undeclared identifier is reported only once
../../tmk_core/common/keymap.c:37: error: for each function it appears in.)
../../tmk_core/common/keymap.c:37: error: 'key' undeclared (first use in this function)
../../tmk_core/common/keymap.c:38: error: expected declaration specifiers before 'switch'
../../tmk_core/common/keymap.c:109: error: expected declaration specifiers before '}' token
../../tmk_core/common/keymap.c:113: error: expected declaration specifiers before '__attribute__'
../../tmk_core/common/keymap.c:120: error: expected declaration specifiers before '__attribute__'
../../tmk_core/common/keymap.c:129: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
../../tmk_core/common/keymap.c:162: error: expected declaration specifiers before '__attribute__'
../../tmk_core/common/keymap.c:170: error: expected declaration specifiers before '__attribute__'
../../tmk_core/common/keymap.c:190: error: old-style parameter declarations in prototyped function definition
../../tmk_core/common/keymap.c:189: error: expected '{' at end of input
../../tmk_core/common/keymap.c:189: warning: no return statement in function returning non-void
make: *** [obj_adb_usb_lufa/common/keymap.o] Error 1

Anyone know why this might be happening?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 21 May 2015, 06:34:07
Get the latest source from github again.

Pull request I merged today caused that error and I reverted it.
Title: Re: ADB to USB keyboard converter
Post by: taiwanesekid05 on Thu, 21 May 2015, 16:07:43
Ah, it complies now.  Thank you Hasu!

Edit: I seem to have another problem now.  After I load the .hex onto the Teensy 2.0 and restart it, my cursor immediately goes to the top left hand corner of my screen and continues to go back up there even after I move the mouse.  And the keyboard doesn't work.  Any idea why this might be happening?
Title: Re: ADB to USB keyboard converter
Post by: urbanredfox on Mon, 25 May 2015, 00:24:12
taiwanesekid05,

Do you use a mouse? I had this issue while doing some coding and didn't have one plugged in. I downloaded a fresh copy from git hub at it worked so I'm not sure what exactly is going on there. If you don't use an ADB mouse you could also try commenting out the MOUSE_KEY_ENABLE option in the Makefile and see if it goes away.
Title: Re: ADB to USB keyboard converter
Post by: FattyFatty2by4 on Tue, 26 May 2015, 16:42:34
Sorry, I had a problem but it's sorted out now.
Title: Re: ADB to USB keyboard converter
Post by: taiwanesekid05 on Thu, 28 May 2015, 09:25:16
taiwanesekid05,

Do you use a mouse? I had this issue while doing some coding and didn't have one plugged in. I downloaded a fresh copy from git hub at it worked so I'm not sure what exactly is going on there. If you don't use an ADB mouse you could also try commenting out the MOUSE_KEY_ENABLE option in the Makefile and see if it goes away.

I tried commenting out MOUSEKEY_ENABLE with no avail.  I make'd while having my mouse plugged in and that did nothing.  And a fresh download from GitHub didn't help either.  I should also add that not only does plugging in the Teensy force the keyboard to go to the upper lefthand corner, but also that none of the keys on my Apple Extended Keyboard II work. 
Title: Re: ADB to USB keyboard converter
Post by: tufty on Thu, 28 May 2015, 09:36:12
Did you try reading the previous page of the thread?  Specifically, the post immediately before your first post on the thread?
Title: Re: ADB to USB keyboard converter
Post by: superbia on Sun, 14 June 2015, 15:19:40
My homebrew attempt to make my own adb-usb converter using an stm32 micro gloriously failed :rolleyes:

Now I just ended up ordering an arduino clone with 32u4 for 5$...
I hope everything will work this time  :eek: while waiting it to arrive...
Title: Re: ADB to USB keyboard converter
Post by: mougrim on Mon, 15 June 2015, 03:11:10
My homebrew attempt to make my own adb-usb converter using an stm32 micro gloriously failed :rolleyes:

Now I just ended up ordering an arduino clone with 32u4 for 5$...
I hope everything will work this time  :eek: while waiting it to arrive...

It will.
Title: Re: ADB to USB keyboard converter
Post by: phosphoric on Mon, 15 June 2015, 11:57:29
no clue about c language or anything at all, but ghosting with jkl; is pretty common - was mashing these keys in notepad just to play with the 3-key rollover and p popped up a couple of times. thought i would leave a note here - not sure if i'm contributing at all, but documentation is documentation
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 15 June 2015, 19:30:25
I can't know why you leave the note here :D
Ghost occurs in matrix of keyboard not converter, keyboard has responsibility for handling ghost.

BTW, I never noticed phantom keys on my ADB keyboards, I think they have decent ghost block.
Title: Re: ADB to USB keyboard converter
Post by: phosphoric on Tue, 16 June 2015, 16:50:03
haha! this is why i post here. i'm still fairly new to the world of mechanical keyboards (and keyboard tech in general) so i learn from peoples' replies  ;D
Title: Re: ADB to USB keyboard converter
Post by: FattyFatty2by4 on Tue, 16 June 2015, 20:52:49
Apologies for the rather long reply.

Apparently this is a new problem and it may have been sorted out for other people.
I've already soldered all of the components to the teensy and keyboard, I've checked my soldering and it's all clean, (I even tested it with a multimeter.) So then I do all of the technical steps, get my .hex file and upload it to the teensy through teensyloader. It goes asking around through windows update and all that, then once it's found the device, my mouse cursor moves to the top left of my monitor. I cannot move it back unless I unplug the teensy. I've tried it with 3 other mice but the problem persists. No LEDs on the keyboard light up, even though there's a current going through. It also does not type any keystrokes. I've tried it with 2 other proven-working .hex files and the same thing happens, except the mouse cursor works fine.

I have soldered wires directly to the PCB as seen in the pictures below. (The green wire is not connected to anything.) Here's the wiring:
RED: Data (Connected to D0)
WHITE: +5v (Connected to lower VCC)
BLACK: Ground (Connected to lower GND)
There is a 1k resistor connected on the bottom of the board to +5v and Data.
*UPDATE* I have taken off the 1k resistor to see if that was causing the problem. It still happens even when there's no resistor connected.

I'm fairly sure that my soldering is fine and I've even resoldered them because my previous attempt was poorly done. Just to be on the safe side, would you mind telling me if my soldering has any faults in it?

Unfortunately, the keyboard is from a brand that doesn't exist now and I cannot find much info about it. It's a Mac-101 E keyboard from DataDesk International. 1 month before attempting this project, it worked quite well with the Mac Quadra 660AV it was connected to.

Back to the issue, I used Cygwin to make a .hex file and I think I did it right. Here's the code:
$ cd /cygdrive/c/users/admin/desktop/tmk_keyboard/converter/adb_usb
$ make clean
$ make

I got a .hex file which I mounted onto the Teensy, and then my cursor goes to the top left and the keyboard doesn't work. I saw the previous posts and I've tried every single thing there. Still doesn't work... :(

Thanks in advance.
Title: Re: ADB to USB keyboard converter
Post by: tufty on Wed, 17 June 2015, 12:34:03
If you're not seeing LEDs on the keyboard, my guess would be that you're not connected correctly at the keyboard end.  Specifically, IIRC, the Mac101 should have a power indicator LED.  If that's not lighting up, you're not giving the keyboard power, or, more correctly, are giving it power at the wrong pin.

That otherwise unconnected green wire, for example, looks like it goes to the ground plane.  Check the keyboard end, paying careful attention to where the ADB connectors are and where the pins connect to.  A good bet would be to wire your teensy to a cut-in-half ADB or S-video cable, and then connect it externally to the board via its built-in ADB ports.

It's easy to read the ADB pinout back to front.  If you're tracing from a back-to-front pinout, you would expect things to fail interestingly; that swaps power with gnd, and adb with the power switch.
Title: Re: ADB to USB keyboard converter
Post by: FattyFatty2by4 on Wed, 17 June 2015, 19:28:40
I think you may be right. I'll try to reverse the pins and see what happens.

*UPDATE*
Thank you so much. I reversed the pins and it works great. Funny I hadn't thought of that before.
Title: Re: ADB to USB keyboard converter
Post by: chuchana on Sun, 21 June 2015, 10:28:13
Does uploading the firmware change the bootloader? I wanted to upload a new version of the firmware to the Arduino and I cannot see the port anymore (it used to be /dev/cu.usbmodem1421).
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 21 June 2015, 16:52:57
It depends on how you upload, with ISP connector bootloader will be removed while it will be there if you upload with normal Aruduino method.
Title: Re: ADB to USB keyboard converter
Post by: chuchana on Fri, 03 July 2015, 12:35:16
Thank you for your answer and for the project!

I have uploaded it directly as I could not find how to upload it via Arduino. Is there documentation on how to do that?
Title: Re: ADB to USB keyboard converter
Post by: superbia on Fri, 03 July 2015, 15:10:55
Quick start for people who bought 32u4 arduino clones on ebay (5$):

1. get avrdude (for flashing)  :thumb:
2. make the software, as hasu sugested  :thumb:
2. use avrdude to flash the firmware
2.b note: you need to press "reset" once, than fast 2 times to get into bootloader (or if you dont have the button short RST and GND pins), so you need to short it total of 3 times  :thumb:
2.c dont wait long and use this command to flash it $ avrdude -p m32u4 -c avr109 -P /dev/ttyACM0 -U flash:w:adb_usb_lufa.hex:i          ( replace /dev/ttyACM0 with your port)  :thumb:

After that, you may will find some keys working and some not, i suggest you make your own layout, as hasu documented.
I had to try my layout like 4 times to get it right, because half of modifier keys wer either swaped or not working, and i also decided to swap caps and ctrl in the end....
Pretty easy, i hope i helped somebody... Btw. i used it on french azerty aekii  :thumb:
Title: Re: ADB to USB keyboard converter
Post by: 88slides on Mon, 06 July 2015, 11:24:13
After spending about a week testing things, I still have the same issue. Whenever I attach the +5V cable from the teensy to the keyboard, my Macbook Pro shuts down the connection with a popup saying "Unplug the device using too much power to re-enable USB devices." The keyboard is the only thing plugged into my computer.

Any ideas?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 06 July 2015, 13:28:55
Seems like something goes wrong on connection of power line and it makes short circuit.
Or perhpas the keyboard is extremely power hog. What is your keyboard?

From first post...
Quote
NEED HELP?
Your converter doesn't work?
Frist, post pics of your hardware and wriring this really save time of us. Don't save your time by omitting this.

If you edit code
Post your code. Don't hesitate to show your dirty code!
Title: Re: ADB to USB keyboard converter
Post by: ShawnMeg on Mon, 06 July 2015, 17:05:04
Quick start for people who bought 32u4 arduino clones on ebay (5$):

1. get avrdude (for flashing)  :thumb:
2. make the software, as hasu sugested  :thumb:
2. use avrdude to flash the firmware
2.b note: you need to press "reset" once, than fast 2 times to get into bootloader (or if you dont have the button short RST and GND pins), so you need to short it total of 3 times  :thumb:
2.c dont wait long and use this command to flash it $ avrdude -p m32u4 -c avr109 -P /dev/ttyACM0 -U flash:w:adb_usb_lufa.hex:i          ( replace /dev/ttyACM0 with your port)  :thumb:

After that, you may will find some keys working and some not, i suggest you make your own layout, as hasu documented.
I had to try my layout like 4 times to get it right, because half of modifier keys wer either swaped or not working, and i also decided to swap caps and ctrl in the end....
Pretty easy, i hope i helped somebody... Btw. i used it on french azerty aekii  :thumb:

http://deskthority.net/workshop-f7/how-to-use-a-pro-micro-as-a-cheap-controller-converter-like-soarer-s-t8448.html (http://deskthority.net/workshop-f7/how-to-use-a-pro-micro-as-a-cheap-controller-converter-like-soarer-s-t8448.html)

According to this tutorial, you may not need to do step 2b above if the pro Micro is new and hasn't been flashed before.  The tutorial says that it'll go into bootloader mode once plugged in.  I'm about to make a converter, but awaiting for all the parts to arrive.
Title: Re: ADB to USB keyboard converter
Post by: ShawnMeg on Sun, 12 July 2015, 21:57:39
--
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 12 July 2015, 22:33:17
I don't thnk it breaks your keyboard and converter but not completely sure.
I guess It works as far as you don't use power key, which is normally pulled-up to VCC and pulled down to GND when pressed.

Title: Re: ADB to USB keyboard converter
Post by: taiwanesekid05 on Sat, 18 July 2015, 00:14:23
Did you try reading the previous page of the thread?  Specifically, the post immediately before your first post on the thread?

I did put in a 1K resistor, it produced the same problem.  So I removed the resistor, same problem.  Resoldered the resistor, same problem.  I'm not sure if it's something I'm doing wrong, or something worse.  I've attached some photos so maybe someone can let me know what I'm doing wrong.  Nothing is currently permanently soldered from the Teensy to the keyboard, so that's why I just have wires sticking out of the ADB plug.  I think I've put everything in the right place (Data to the 1 hole, VCC to the 3 hole, and Ground to the 4 hole) but I'm not 100% sure. 
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 19 July 2015, 04:27:55
Did you check README and the first post of this thread? The latest source is configured to use D0 for data. If you want to use F0 you have to change config.h.
Title: Re: ADB to USB keyboard converter
Post by: taiwanesekid05 on Sun, 19 July 2015, 17:29:07
Did you check README and the first post of this thread? The latest source is configured to use D0 for data. If you want to use F0 you have to change config.h.

Ahh... that was the issue... I based my soldering off of photos I saw and wasn't 100% sure if that was the issue.  The converter works perfectly now.  Thanks a lot Hasu!
Title: Re: ADB to USB keyboard converter
Post by: applekey2 on Sun, 30 August 2015, 11:43:09
I have about 400 ADB keyboards and about 400 adb mice in brand new condition. I need to design and make a adb to usb converter that has an adb plug on one side and a usb plug on the other side. I need to make something in bulk and cost efficient.  Anyone have suggestions? I want to make something similar to the ps2 to usb converter ? Would the same chip work? Any suggestions?
Title: Re: ADB to USB keyboard converter
Post by: superbia on Mon, 31 August 2015, 11:06:28
I have about 400 ADB keyboards and about 400 adb mice in brand new condition. I need to design and make a adb to usb converter that has an adb plug on one side and a usb plug on the other side. I need to make something in bulk and cost efficient.  Anyone have suggestions? I want to make something similar to the ps2 to usb converter ? Would the same chip work? Any suggestions?

First, you are doing something commercial.

Secondly, you can't just assume people will design the pcb, write the software, arrange the manufacturing and ship 400 converters to you.
Thirdly, check the licencing on the firmwares/tools you gonna use, best of luck.
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Mon, 07 September 2015, 23:58:20
So, I've been using my converted M0116 for a while and I'm kind of curious, since my keyboard doesn't have F keys, what do you guys do when you need to use one of the F keys?Unless I missed something and there is some sort of function layer, I haven't been able to figure out how to press F keys, so I use a second keyboard. What do you guys think?
Also, has the 2key rollover issue been solved yet, or is that a hardware level issue?
Title: Re: ADB to USB keyboard converter
Post by: Yoe on Tue, 08 September 2015, 01:10:13
So, I've been using my converted M0116 for a while and I'm kind of curious, since my keyboard doesn't have F keys, what do you guys do when you need to use one of the F keys?Unless I missed something and there is some sort of function layer, I haven't been able to figure out how to press F keys, so I use a second keyboard. What do you guys think?

You can use the tap key function in TMK and use a non modifier key of choice. I have used the escape key for this in my keyboards and adapters. When just pressing and releasing the escape key, you get escape, but keep it pressed and you activate the fuction layer. As an example, this is what keymap_iso.c looks like in my ADB to USB adapters:

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


const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    KEYMAP_EXT_ISO(
    FN0, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,                   PWR,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,PEQL,PSLS,PAST,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,ENT,      DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,NUHS,                             P4,  P5,  P6,  PPLS,
    LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     RSFT,          UP,           P1,  P2,  P3,
    LCTL,LALT,LGUI,          SPC,                               RALT,RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
    ),


    KEYMAP_EXT_ISO(
    TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,           TRNS, TRNS, TRNS,                      TRNS,
    TRNS, F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,   F9,   F10,  F11,  F12,   DEL,     TRNS, TRNS, TRNS,    TRNS, TRNS, TRNS, TRNS,
    PWR,  TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,     TRNS, TRNS, TRNS,    TRNS, TRNS, TRNS, TRNS,
    TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,                                TRNS, TRNS, TRNS, TRNS,
    TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MPRV, MNXT, MUTE, VOLD, VOLU, TRNS,       TRNS,           PGUP,          TRNS, TRNS, TRNS,
    TRNS, TRNS, TRNS,             MPLY,                               TRNS, TRNS,           HOME, PGDN, END,     TRNS,       TRNS, TRNS
    ),

};

const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_TAP_KEY(1, KC_ESC),
};
Title: Re: ADB to USB keyboard converter
Post by: skullydazed on Tue, 08 September 2015, 10:46:38
So, I've been using my converted M0116 for a while and I'm kind of curious, since my keyboard doesn't have F keys, what do you guys do when you need to use one of the F keys?Unless I missed something and there is some sort of function layer, I haven't been able to figure out how to press F keys, so I use a second keyboard. What do you guys think?
Also, has the 2key rollover issue been solved yet, or is that a hardware level issue?

Personally I plan to replace the caps lock switch with a non-locking switch and that can be my fn key. Then it's just a matter of configuring a function layer in keymap_<whatever>.c.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 09 September 2015, 18:37:44
So, I've been using my converted M0116 for a while and I'm kind of curious, since my keyboard doesn't have F keys, what do you guys do when you need to use one of the F keys?Unless I missed something and there is some sort of function layer, I haven't been able to figure out how to press F keys, so I use a second keyboard. What do you guys think?
Also, has the 2key rollover issue been solved yet, or is that a hardware level issue?

Current default keymap is very plain and has no function layer, you need to define your own keymap.

Instead you can use my keymap, you can access function layer by holding down backslash key.
https://github.com/tmk/tmk_keyboard/blob/master/converter/adb_usb/keymap_hasu.c

Build firmware like this.
Code: [Select]
make KEYMAP=hasu
Title: Re: ADB to USB keyboard converter
Post by: tufty on Fri, 11 September 2015, 02:28:39
So, I've been using my converted M0116 for a while and I'm kind of curious, since my keyboard doesn't have F keys, what do you guys do when you need to use one of the F keys?Unless I missed something and there is some sort of function layer, I haven't been able to figure out how to press F keys, so I use a second keyboard. What do you guys think?
Also, has the 2key rollover issue been solved yet, or is that a hardware level issue?

Personally I plan to replace the caps lock switch with a non-locking switch and that can be my fn key. Then it's just a matter of configuring a function layer in keymap_<whatever>.c.
Thats what I did.  Numbers row -> function keys, arrows -> home end pgup pgdn, keypad +- -> volume keys, etc.

(well out of date) https://github.com/tufty/tmk_keyboard/blob/master/converter/adb_usb/keymap_tufty.c

2 key rollover is hardware level.  You won't beat that without rewiring the matrix
Title: Re: ADB to USB keyboard converter
Post by: skullydazed on Sat, 12 September 2015, 14:10:26
I designed an adaptor that fits inside the AEKII case and replaces one of the ADB ports. I just got my prototypes back however it looks like I made a mistake and specified .1uf instead of 1uf for the UCAP cap, and I left out the VBUS/VCC cap entirely. I can program the board but when I attempt to use it I get this from hid_listen:

Code: [Select]
adb_host_kbd_recv: ERROR(-30)

When I run the teensy blinky program on my board the LED blinks too quickly to make out the morse code. This leads me to believe that specifying an incorrect cap and leaving out one cap has thrown off the timing the atmega uses enough to break the ADB protocol. I have ordered some 1uf caps and will attempt to replace them, but while I wait for that can anyone tell me if my hypothesis seems correct?

My schematic, if that will help in answering, can be found here (http://i.imgur.com/iUNXulO.png).
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 12 September 2015, 19:58:21
Sorry if I'm treating you as a too noob.

First did you read the first post of this thread?

Your schematic looks good to me and you should have correct caps on UVCC pin. Check chip datasheet, I think you need 10% tolerant good caps I usually use a 10% X5R cap. But I dont think the caps causes your problem.

Teensy has a LED on different port from your board. Did you change blinky code properly?

Probably your wiring of ADB lines have someting wrong.
Title: Re: ADB to USB keyboard converter
Post by: skullydazed on Sat, 12 September 2015, 22:40:44
Sorry if I'm treating you as a too noob.

First did you read the first post of this thread?

I never mind when people check the basics. It saves times if there's something I missed. I have read the first post and the tmk_keyboard/converter/adb_usb/README.md many times.

Your schematic looks good to me and you should have correct caps on UVCC pin. Check chip datasheet, I think you need 10% tolerant good caps I usually use a 10% X5R cap. But I dont think the caps causes your problem.

Thanks for double-checking. That's the updated schematic with corrected caps, so it's good to know that it looks good to you. The caps are YAGEO2/CC0603KRX7R9BB104 CAP CER 0.1UF 50V 10% X7R 0603 so should be within spec. The 1uf's I have on the way are also 10%.

Teensy has a LED on different port from your board. Did you change blinky code properly?

I did change the blinky code properly, the LED turns on it just flashes with improper timing. These are the only differences between the two blinky.hex's I tried:

Code: [Select]
--- blinky-teensy.c 2015-09-12 20:06:23.000000000 -0700
+++ blinky-adaptor.c 2015-09-12 19:49:58.000000000 -0700
@@ -30,8 +30,8 @@

 // Teensy 2.0: LED is active high
 #if defined(__AVR_ATmega32U4__) || defined(__AVR_AT90USB1286__)
-#define LED_ON (PORTD |= (1<<6))
-#define LED_OFF (PORTD &= ~(1<<6))
+#define LED_ON (PORTF |= (1<<0))
+#define LED_OFF (PORTF &= ~(1<<0))

 // Teensy 1.0: LED is active low
 #else

Probably your wiring of ADB lines have someting wrong.

The only thing I can think of here is that for some reason my pull-up resistor doesn't work in the current configuration. You can see the trace for the DATA line very clearly, it's the one to the right of the U1 silkscreen text, and on the back of the board are the traces that go to the via's that connect R4 between that pin and VCC:

(http://i.imgur.com/5M9bgAq.jpg)

(http://i.imgur.com/lPlXvAI.jpg)

I'm using this resistor: VD2/CRCW06031K00FKEA RES SMD 1K OHM 1% 1/10W 0603

My meter reads perfect continuity between the pin on the atmega and pin 1 on the adb connector on the other side.
Title: Re: ADB to USB keyboard converter
Post by: skullydazed on Sat, 12 September 2015, 23:01:20
One more quick data point, I have a teensy I wired up to the same pin as my adaptor (F4) and the teensy works perfectly, while my adaptor does not.

(http://i.imgur.com/JDIoDAj.jpg)

When I measured I had continuity between F4 on the teensy and F4 on my adaptor's atmega while plugged in that way. I also had continuity between VCC and GND on the teensy and various points on the adaptor.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 13 September 2015, 01:26:31
As for blinky you'll also need to set   the pin as output with DDRF somewhere.

And F4-F7 pins are not used as general IO by default. They are used for JTAG interface . You have to disable JTAG before use.
See tmk FAQ entry on github or check datasheet.
Teensy chip is configured with chip fuse settings at factory so you don't have to.

Title: Re: ADB to USB keyboard converter
Post by: skullydazed on Sun, 13 September 2015, 08:55:10
That was it! Thanks for helping me get this going.

I didn't even know that TMK had that FAQ or the wiki, and I've been looking at these pages for months now. Change blindness or similar I suppose. It might help to put a link to the FAQ and/or wiki in the README.md rather than only in the first page of this post, after a while I started to assume the content was the same between that and the first page of this thread.

(And now I have a bunch of NOTEs to read in the issue tracker, lots of great background there.)
Title: Re: ADB to USB keyboard converter
Post by: powaa on Wed, 16 September 2015, 05:43:29
Hi,

I managed to get my M0116 working with this adapter through a pro micro, wiring is all correct. Infact I'm typing this post on it. So thankyou so much for the firmware

I was wondering if I could get help with my keymap. EVerything works except for the 1st function layer that changes the numberpad to mimic the home cluster and the arrow keys, the second function layer for Fkeys works beautifully so I dont understand what I'm doing wrong.

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

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  /* Default layer : plain keymap IGNORE THE DIAGRAMS, THEY ARE NOT INDICATIVE OF THE KEYBOARD
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
   * +---------------------------------------------------------+ +---+---+---+---+
   * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
   * +-----------------------------------------------------+   | +---+---+---+---+
   * | caps | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
   * +---------------------------------------------------------+ +---+---+---+---+
   * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
   * +---------------------------------------------------------+ +-------+---|ent|
   * |Ctrl|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
   * +---------------------------------------------------------+ +-------+---+---+
   */
  KEYMAP_M0116_ANSI(
    FN2,
    ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,   DEL, EQL, PSLS,NLCK,
    TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC,       P7,  P8,  P9,  PPLS,
    LCTL, A, S, D, F, G, H, J, K, L, SCLN, QUOT,   ENT,  P4,  P5,  P6,  PMNS,
    LSFT,  Z, X, C, V, B, N, M, COMM,  DOT, SLSH, RSFT,  P1,  P2,  P3,
    FN1,LALT,LGUI,GRV,   SPC,   BSLS,LEFT,RGHT,DOWN,UP,  P0,       FN2,PENT
  ),
  /* Layer 1 :
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|     | |   |   |   |Mut|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |     |   |   |   |   |   |   |   |   |   |   |   |   |   | |   |   |   |VoU|
   * +-----------------------------------------------------+   | +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |   |      | |   |   |   |VoD|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |Capslock| |   |   |   |   |
   * +---------------------------------------------------------+ +-------+---|   |
   * |Fn1|   |     |   |                   |   |Hom|End|PgD|PgU| |       |   |   |
   * +---------------------------------------------------------+ +-------+---+---+
   */
  KEYMAP_M0116_ANSI(
    FN2,
    ESC, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,   TRNS,                 INS, HOME, PGUP, MUTE,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,                      DEL, END,PGDN, VOLU,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,    TRNS,                  TRNS, UP, TRNS,   VOLD,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,        TRNS,                   LEFT,DOWN,RGHT,
    TRNS,TRNS , TRNS, TRNS,         TRNS,      TRNS, CALC,PSCR,SLCK,BRK,                            TRNS,     TRNS,    TRNS
  ),
 
    /* Layer 2 :
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|     | |   |   |   |Mut|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |     |   |   |   |   |   |   |   |   |   |   |   |   |   | |   |   |   |VoU|
   * +-----------------------------------------------------+   | +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |   |      | |   |   |   |VoD|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |Capslock| |   |   |   |   |
   * +---------------------------------------------------------+ +-------+---|   |
   * |Fn1|   |     |   |                   |   |Hom|End|PgD|PgU| |       |   |   |
   * +---------------------------------------------------------+ +-------+---+---+
   */
  KEYMAP_M0116_ANSI(
    FN2,
    ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10,F11,F12,          TRNS,                 TRNS, TRNS, TRNS, TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,      TRNS, TRNS, TRNS, TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,    TRNS,   TRNS, TRNS, TRNS,   TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,        TRNS,      TRNS,TRNS, TRNS,
    TRNS,TRNS , TRNS, TRNS,         TRNS,      TRNS, TRNS,TRNS,TRNS,TRNS,              TRNS,     TRNS,    TRNS
  ),
};

const uint16_t PROGMEM fn_actions[] = {
ACTION_LAYER_TOGGLE(1),
ACTION_LAYER_TAP_KEY(2, KC_CAPS),
};
/*copied and edited from tufty's keymap
*/

Thanks in advance.

Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 16 September 2015, 15:30:47
I didn't even know that TMK had that FAQ or the wiki, and I've been looking at these pages for months now. Change blindness or similar I suppose. It might help to put a link to the FAQ and/or wiki in the README.md rather than only in the first page of this post, after a while I started to assume the content was the same between that and the first page of this thread.

Indeed, I'll update README and check other documentations again some later.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 16 September 2015, 15:38:17
FN1 should be ACTION_LAYER_MOMENTARY(1) because the left bottom key of M0116 has mechanical locking switch and it toggles layer with its own function, you don't need TOGGLE action in this case.

Hi,

I managed to get my M0116 working with this adapter through a pro micro, wiring is all correct. Infact I'm typing this post on it. So thankyou so much for the firmware

I was wondering if I could get help with my keymap. EVerything works except for the 1st function layer that changes the numberpad to mimic the home cluster and the arrow keys, the second function layer for Fkeys works beautifully so I dont understand what I'm doing wrong.

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

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  /* Default layer : plain keymap IGNORE THE DIAGRAMS, THEY ARE NOT INDICATIVE OF THE KEYBOARD
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
   * +---------------------------------------------------------+ +---+---+---+---+
   * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
   * +-----------------------------------------------------+   | +---+---+---+---+
   * | caps | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
   * +---------------------------------------------------------+ +---+---+---+---+
   * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
   * +---------------------------------------------------------+ +-------+---|ent|
   * |Ctrl|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
   * +---------------------------------------------------------+ +-------+---+---+
   */
  KEYMAP_M0116_ANSI(
    FN2,
    ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,   DEL, EQL, PSLS,NLCK,
    TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC,       P7,  P8,  P9,  PPLS,
    LCTL, A, S, D, F, G, H, J, K, L, SCLN, QUOT,   ENT,  P4,  P5,  P6,  PMNS,
    LSFT,  Z, X, C, V, B, N, M, COMM,  DOT, SLSH, RSFT,  P1,  P2,  P3,
    FN1,LALT,LGUI,GRV,   SPC,   BSLS,LEFT,RGHT,DOWN,UP,  P0,       FN2,PENT
  ),
  /* Layer 1 :
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|     | |   |   |   |Mut|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |     |   |   |   |   |   |   |   |   |   |   |   |   |   | |   |   |   |VoU|
   * +-----------------------------------------------------+   | +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |   |      | |   |   |   |VoD|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |Capslock| |   |   |   |   |
   * +---------------------------------------------------------+ +-------+---|   |
   * |Fn1|   |     |   |                   |   |Hom|End|PgD|PgU| |       |   |   |
   * +---------------------------------------------------------+ +-------+---+---+
   */
  KEYMAP_M0116_ANSI(
    FN2,
    ESC, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,   TRNS,                 INS, HOME, PGUP, MUTE,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,                      DEL, END,PGDN, VOLU,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,    TRNS,                  TRNS, UP, TRNS,   VOLD,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,        TRNS,                   LEFT,DOWN,RGHT,
    TRNS,TRNS , TRNS, TRNS,         TRNS,      TRNS, CALC,PSCR,SLCK,BRK,                            TRNS,     TRNS,    TRNS
  ),
 
    /* Layer 2 :
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|     | |   |   |   |Mut|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |     |   |   |   |   |   |   |   |   |   |   |   |   |   | |   |   |   |VoU|
   * +-----------------------------------------------------+   | +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |   |      | |   |   |   |VoD|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |Capslock| |   |   |   |   |
   * +---------------------------------------------------------+ +-------+---|   |
   * |Fn1|   |     |   |                   |   |Hom|End|PgD|PgU| |       |   |   |
   * +---------------------------------------------------------+ +-------+---+---+
   */
  KEYMAP_M0116_ANSI(
    FN2,
    ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10,F11,F12,          TRNS,                 TRNS, TRNS, TRNS, TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,      TRNS, TRNS, TRNS, TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,    TRNS,   TRNS, TRNS, TRNS,   TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,        TRNS,      TRNS,TRNS, TRNS,
    TRNS,TRNS , TRNS, TRNS,         TRNS,      TRNS, TRNS,TRNS,TRNS,TRNS,              TRNS,     TRNS,    TRNS
  ),
};

const uint16_t PROGMEM fn_actions[] = {
ACTION_LAYER_TOGGLE(1),
ACTION_LAYER_TAP_KEY(2, KC_CAPS),
};
/*copied and edited from tufty's keymap
*/

Thanks in advance.


Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Wed, 16 September 2015, 16:25:33
Oh that's cool, I wish I had function keys. Is there any way I can update or reflash my teensy while it is already soldered into a project? I'd love to reflash it to include the right code to make the power button a function key so that I can finally use F keys.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 16 September 2015, 18:29:47
Yes, Teensy(and many alternatives) is still reflashable via USB even after soldered and assembled.
Title: Re: ADB to USB keyboard converter
Post by: powaa on Thu, 17 September 2015, 00:27:01
Sorry, I think you misunderstand

the caps lock latch has been removed and currently works as tap (see code) (although I have swapped caps and ctrl it swaps them itself, I dont know but it works). My issue is that when the power button is pressed (FN2) it is meant to toggle the numberpad so it has arrow keys and home cluster, however this does not happen. it works fine otherwise .
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Thu, 17 September 2015, 12:49:57
Thanks Hasu, Blargg and everyone else on this thread that helped.

I'm typing on a lovely condition AEKII thanks to this lovely converter.

:)
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 17 September 2015, 15:41:22
Confused.

Quote
EVerything works except for the 1st function layer that changes the numberpad to mimic the home cluster and the arrow keys, the second function layer for Fkeys works beautifully so I dont understand what I'm doing wrong.

It says '1st function layer'(Layer 1) is issue and 'the second function layer'(Layer 2) works, right?
Did I read incorectly? Long English sentese is hard to understand to me :p


Sorry, I think you misunderstand

the caps lock latch has been removed and currently works as tap (see code) (although I have swapped caps and ctrl it swaps them itself, I dont know but it works). My issue is that when the power button is pressed (FN2) it is meant to toggle the numberpad so it has arrow keys and home cluster, however this does not happen. it works fine otherwise .

Your issue is Layer 2(FN2) now?
But I think I understand your problem, In default config.h 'Power button' is used as 'magic command' trigger key, you can't use it for your usage unless you change the config.
https://github.com/tmk/tmk_keyboard#magic-commands

Easy workaround is disable 'magic command' in Makefile. Comment out the following line with '#'.
Code: [Select]
COMMAND_ENABLE = yes

Other is that you define your own IS_COMMAND macro in config.h. See the file in other projects also.
Code: [Select]
#define IS_COMMAND() ( \
    keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LGUI)) \
)
Title: Re: ADB to USB keyboard converter
Post by: powaa on Thu, 17 September 2015, 21:50:51
Sorry, Its a bit confusing because computers start at 0 while the real world starts counting at 1.

I have moved FN2 to the period on the numberpad so I don't have to play around with the power key.

In my code I have commented in all caps what I think it is meant to do and where (obviously not because its not working) :P.

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

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  /* Default layer : plain keymap IGNORE THE DIAGRAMS, THEY ARE NOT INDICATIVE OF THE KEYBOARD
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
   * +---------------------------------------------------------+ +---+---+---+---+
   * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
   * +-----------------------------------------------------+   | +---+---+---+---+
   * | caps | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
   * +---------------------------------------------------------+ +---+---+---+---+
   * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
   * +---------------------------------------------------------+ +-------+---|ent|
   * |Ctrl|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
   * +---------------------------------------------------------+ +-------+---+---+
   *FROM WHAT I UNDERSTAND FN2 (WHICH IS CURRENTLY SET AS PERIOD ON THE NUMBERPAD) ACTIVATES THE TOGGLE COMMAND I HAVE LABELED AT THE BOTTOM
   */
  KEYMAP_M0116_ANSI(
    NO,
    ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,   DEL, EQL, PSLS,NLCK,
    TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC,       P7,  P8,  P9,  PPLS,
    LCTL, A, S, D, F, G, H, J, K, L, SCLN, QUOT,   ENT,  P4,  P5,  P6,  PMNS,
    LSFT,  Z, X, C, V, B, N, M, COMM,  DOT, SLSH, RSFT,  P1,  P2,  P3,
    FN1,LGUI,LALT,GRV,   SPC,   BSLS,LEFT,RGHT,DOWN,UP,  P0,       FN2,PENT
  ),
  /* Layer 1 :
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|     | |   |   |   |Mut|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |     |   |   |   |   |   |   |   |   |   |   |   |   |   | |   |   |   |VoU|
   * +-----------------------------------------------------+   | +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |   |      | |   |   |   |VoD|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |Capslock| |   |   |   |   |
   * +---------------------------------------------------------+ +-------+---|   |
   * |Fn1|   |     |   |                   |   |Hom|End|PgD|PgU| |       |   |   |
   * +---------------------------------------------------------+ +-------+---+---+
   *THIS LAYER IS MEANT TO ACTIVATE WHEN I TOGGLE FN2
   */
  KEYMAP_M0116_ANSI(
    TRNS,
    ESC, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,   TRNS,                 INS, HOME, PGUP, MUTE,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,                      DEL, END,PGDN, VOLU,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,    TRNS,                  TRNS, UP, TRNS,   VOLD,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,        TRNS,                   LEFT,DOWN,RGHT,
    TRNS,TRNS , TRNS, TRNS,         TRNS,      TRNS, CALC,PSCR,SLCK,BRK,                            TRNS,     TRNS,    TRNS
  ),
 
    /* Layer 2 :
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|     | |   |   |   |Mut|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |     |   |   |   |   |   |   |   |   |   |   |   |   |   | |   |   |   |VoU|
   * +-----------------------------------------------------+   | +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |   |      | |   |   |   |VoD|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |Capslock| |   |   |   |   |
   * +---------------------------------------------------------+ +-------+---|   |
   * |Fn1|   |     |   |                   |   |Hom|End|PgD|PgU| |       |   |   |
   * +---------------------------------------------------------+ +-------+---+---+
   */
  KEYMAP_M0116_ANSI(
    NO,
    ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10,F11,F12,          TRNS,                 TRNS, TRNS, TRNS, TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,      TRNS, TRNS, TRNS, TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,    TRNS,   TRNS, TRNS, TRNS,   TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,        TRNS,      TRNS,TRNS, TRNS,
    TRNS,TRNS , TRNS, TRNS,         TRNS,      TRNS, TRNS,TRNS,TRNS,TRNS,              TRNS,     TRNS,    TRNS
  ),
};

const uint16_t PROGMEM fn_actions[] = {
ACTION_LAYER_TOGGLE(1), /*THIS IS MEANT TO ACTIVATE THE LAYER THAT IS LABELED LAYER 1*/
ACTION_LAYER_TAP_KEY(2, KC_CAPS),
};
/*copied from tufty's keymap
*/

sorry for the confusion
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 17 September 2015, 22:13:51
Ah, you alreadly answered your problem yourself :D
You define only FN0 and FN1 but you are using undefined FN2.

I'd recommend you use this GCC C language extenstion in your keymap definition.
https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html#Designated-Inits

Voila, far less confusing now.
Code: [Select]
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* Layer 0 */
    [0] =  KEYMAP_M0116_ANSI(.....

    /* Layer 1 */
    [1] =  KEYMAP_M0116_ANSI(.....
    ....
};

const uint16_t PROGMEM fn_actions[] = {
    [1] = ACTION_LAYER_TOGGLE(1), /*THIS IS MEANT TO ACTIVATE THE LAYER THAT IS LABELED LAYER 1*/
    [2] = ACTION_LAYER_TAP_KEY(2, KC_CAPS),
};
Title: Re: ADB to USB keyboard converter
Post by: tominabox1 on Fri, 18 September 2015, 06:44:22
Hasu - I'd like to use Scroll Lock as a layer indicator, can you help? I have not found anyone who has done this.
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Fri, 18 September 2015, 09:48:52
Hasu - I'd like to use Scroll Lock as a layer indicator, can you help? I have not found anyone who has done this.

Oh, that would be handy.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Fri, 18 September 2015, 11:49:25
This helps you?
http://deskthority.net/viewtopic.php?t=11569
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Fri, 18 September 2015, 12:09:11
This helps you?
http://deskthority.net/viewtopic.php?t=11569

It appears that it will, I'll look this weekend.

Thanks!
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Fri, 18 September 2015, 23:12:20
Anybody have a hex code for the firmware with the power button used to switch layers and the number row F keys? I've been staring at the page for a few hours and its like I'm trying to read Greek, I'm so utterly lost. I have no idea how you people do this stuff, it is so confusing to me.
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Sat, 19 September 2015, 19:25:15
Anybody have a hex code for the firmware with the power button used to switch layers and the number row F keys? I've been staring at the page for a few hours and its like I'm trying to read Greek, I'm so utterly lost. I have no idea how you people do this stuff, it is so confusing to me.

What are you attempting to do?

I have my power button acting as a layer toggle, but I don't understand what you wrote:
Quote
...power button used to switch layers and the number row F keys?

Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Sun, 20 September 2015, 00:26:15
Anybody have a hex code for the firmware with the power button used to switch layers and the number row F keys? I've been staring at the page for a few hours and its like I'm trying to read Greek, I'm so utterly lost. I have no idea how you people do this stuff, it is so confusing to me.

What are you attempting to do?

I have my power button acting as a layer toggle, but I don't understand what you wrote:
Quote
...power button used to switch layers and the number row F keys?
Yeah, my power button acts currently acts as a power button. What I'm trying to do is have it switch layers to another layer that changes the number row to F1-F12
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Sun, 20 September 2015, 10:29:37

Anybody have a hex code for the firmware with the power button used to switch layers and the number row F keys? I've been staring at the page for a few hours and its like I'm trying to read Greek, I'm so utterly lost. I have no idea how you people do this stuff, it is so confusing to me.

What are you attempting to do?

I have my power button acting as a layer toggle, but I don't understand what you wrote:
Quote
...power button used to switch layers and the number row F keys?
Yeah, my power button acts currently acts as a power button. What I'm trying to do is have it switch layers to another layer that changes the number row to F1-F12

Oh ok, no problem.

I'll write up what you need when I'm back at my machine.
Easy fix. 
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Sun, 20 September 2015, 12:45:44

Anybody have a hex code for the firmware with the power button used to switch layers and the number row F keys? I've been staring at the page for a few hours and its like I'm trying to read Greek, I'm so utterly lost. I have no idea how you people do this stuff, it is so confusing to me.

What are you attempting to do?

I have my power button acting as a layer toggle, but I don't understand what you wrote:
Quote
...power button used to switch layers and the number row F keys?
Yeah, my power button acts currently acts as a power button. What I'm trying to do is have it switch layers to another layer that changes the number row to F1-F12

Oh ok, no problem.

I'll write up what you need when I'm back at my machine.
Easy fix.
Really? oh my word thank you so much! You are a life saver! Also, I dont want to ask too much, but is there any way you can keep the Alt Key intact in the layer with the F keys? I need it so I can use shortcuts and stuff
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Sun, 20 September 2015, 19:18:14
Layout is here (that what you wanted?):
https://github.com/tjweir/octagon_hex/blob/master/mrsquishy/keymap_squishy.c

.hex of above layout:
https://github.com/tjweir/octagon_hex/blob/master/mrsquishy/adb_usb_lufa.hex

Cool?

Edit: Derp, I noticed I swapped GUI and ALT on the layer.  I'll change that now and update.
Edit 2: Fixed.
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Sun, 20 September 2015, 19:58:17
I don't know if I did that right but whatever I did would cause the keyboard to spit out different characters than what I pressed when I press the magic key and it wont switch back
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Sun, 20 September 2015, 20:48:43

I don't know if I did that right but whatever I did would cause the keyboard to spit out different characters than what I pressed when I press the magic key and it wont switch back

Can you reflash?
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Sun, 20 September 2015, 22:59:47

I don't know if I did that right but whatever I did would cause the keyboard to spit out different characters than what I pressed when I press the magic key and it wont switch back

Can you reflash?
Yeah, I went back to my original firmware. I'm going to have my programmer friend look at it tomorrow
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Mon, 21 September 2015, 08:50:03
How are you flashing?  Using the Teensy Loader?

What characters are getting spit out?

Can you fork my repo and edit the layout, and I'll build the firmware again?
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Mon, 21 September 2015, 15:44:53
How are you flashing?  Using the Teensy Loader?

What characters are getting spit out?

Can you fork my repo and edit the layout, and I'll build the firmware again?
yeah I'm using teensy loader.
I'm too lazy to figure it out myself, I'll troubleshoot it later.
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Thu, 24 September 2015, 08:19:31
How are you flashing?  Using the Teensy Loader?

What characters are getting spit out?

Can you fork my repo and edit the layout, and I'll build the firmware again?
yeah I'm using teensy loader.
I'm too lazy to figure it out myself, I'll troubleshoot it later.

Did you get it sorted out?
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Thu, 24 September 2015, 16:26:11
How are you flashing?  Using the Teensy Loader?

What characters are getting spit out?

Can you fork my repo and edit the layout, and I'll build the firmware again?
yeah I'm using teensy loader.
I'm too lazy to figure it out myself, I'll troubleshoot it later.

Did you get it sorted out?
I haven't had time so no.
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Wed, 30 September 2015, 16:20:16
Anybody have issues with their m0116's spacebar? Mine keeps getting stuck and it is super annoying.
Title: Re: ADB to USB keyboard converter
Post by: Hzza on Wed, 30 September 2015, 16:39:32
Yeah, they're pretty sticky. I took mine off, cleaned and lubed the hole/peg thing and put it back on which helped but it still binds every now and then (though nowhere near as bad as the enter key).
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Wed, 30 September 2015, 16:48:25
Yeah, they're pretty sticky. I took mine off, cleaned and lubed the hole/peg thing and put it back on which helped but it still binds every now and then (though nowhere near as bad as the enter key).
My issue is that the stabilizer bar comes off the little pegs on the lefthand side and then I have to take it apart to fix it and it's super annoying.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 30 September 2015, 19:32:33
We'd seen poeple suffered from a mouse-going-top-left problem. Some of them had clearly hardware problems like bad connection and wiring but I didn't know exact reason actually.
https://geekhack.org/index.php?topic=14290.msg1754134#msg1754134

But now I finaly got it. You must have a pull-up resistor in the end, mouse function doesn't work without it. If you build firmware without mouse feature it may work without pull-up resistor.

Anyway pull-up resistor is a must-have.

https://github.com/tmk/tmk_keyboard/issues/249
Title: Re: ADB to USB keyboard converter
Post by: Hzza on Thu, 01 October 2015, 03:14:36
Yeah, they're pretty sticky. I took mine off, cleaned and lubed the hole/peg thing and put it back on which helped but it still binds every now and then (though nowhere near as bad as the enter key).
My issue is that the stabilizer bar comes off the little pegs on the lefthand side and then I have to take it apart to fix it and it's super annoying.
Oh, maybe try putting a shim between the stabilizer clip in the plate and the stabilizer wire to make it tighter or something? It might be worth taking the spacebar off, the clips out of the plate and trying to reseat everything, I know I had a massive pain getting mine properly in place when I first got it.
Title: Re: ADB to USB keyboard converter
Post by: DamnDan on Thu, 01 October 2015, 04:12:43
Hello All,

Just sharing pinout for M0118, might be useful for people performing internal mod:

(http://i.imgur.com/j9duRZN.jpg)

and this is my completed road warrior:
(http://i.imgur.com/1BkxwZu.jpg)

Thanks Hasu! :)
Title: Re: ADB to USB keyboard converter
Post by: Hzza on Thu, 01 October 2015, 04:21:45
Very nice. I've been on the lookout for an M0118 for ages, we only seem to get M0116's over here though.
Title: Re: ADB to USB keyboard converter
Post by: DamnDan on Thu, 01 October 2015, 04:34:07
Very nice. I've been on the lookout for an M0118 for ages, we only seem to get M0116's over here though.

Heheh, that is quite funny :) Cause I would kill for a M0116 (Poland is using US ANSI, although the typewriters were in ISO QWERTZ).
M0116 has more potential since the right modifier on m0118 is the same as left modifier (one with apple logo).
In Poland we use the right alt for non-latin characters, and having an M0116 you have 5 switches on the right to transform into modifiers if needed :)

But slight mods to the Hasu's converter and I have double right alt on both sides of the space :) Which works.

BTW: Is it normal that the enter on the M0118 gets stuck on it's stabiliser? Shoudn't there be a spring in the stabiliser insert to spring key back up?
Currently that is the only issue I have with M0118...
Title: Re: ADB to USB keyboard converter
Post by: powaa on Thu, 01 October 2015, 09:37:09
Hi!

thanks for the help. My keyboard has been great. however tonight I tried to make the keyboards function buttons as the power key, even following what was said it still doesn't work.

I changed the magic command in config.h :
Code: [Select]
/*
Copyright 2011 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef CONFIG_H
#define CONFIG_H


#define VENDOR_ID       0xFEED
#define PRODUCT_ID      0x0ADB
#define DEVICE_VER      0x0101
#define MANUFACTURER    t.m.k.
#define PRODUCT         Apple
#define DESCRIPTION     M0116 Apple Keyboard

/* matrix size */
#define MATRIX_ROWS 16  // keycode bit: 3-0
#define MATRIX_COLS 8   // keycode bit: 6-4

#define MATRIX_ROW(code)    ((code)>>3&0x0F)
#define MATRIX_COL(code)    ((code)&0x07)


/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE


/* legacy keymap support */
#define USE_LEGACY_KEYMAP


/* ADB port setting */
#define ADB_PORT        PORTD
#define ADB_PIN         PIND
#define ADB_DDR         DDRD
#define ADB_DATA_BIT    0
//#define ADB_PSW_BIT     1       // optional

/* key combination for command */
#ifndef __ASSEMBLER__
#include "adb.h"
#include "matrix.h"
/*#define IS_COMMAND() ( \
    matrix_is_on(MATRIX_ROW(ADB_POWER), MATRIX_COL(ADB_POWER)) \
)
*/

/* key combination for command */
#define IS_COMMAND() ( \
    keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)

/*#define IS_COMMAND() ( \
    keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT) | MOD_BIT(KC_LGUI)) \
)
*/


#endif

#endif

and I disabled it as well in makefile
Code: [Select]
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device.
#                Please customize your programmer settings(PROGRAM_CMD)
#
# make teensy = Download the hex file to the device, using teensy_loader_cli.
#               (must have teensy_loader_cli installed).
#
# make dfu = Download the hex file to the device, using dfu-programmer (must
#            have dfu-programmer installed).
#
# make flip = Download the hex file to the device, using Atmel FLIP (must
#             have Atmel FLIP installed).
#
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
#               (must have dfu-programmer installed).
#
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
#                (must have Atmel FLIP installed).
#
# make debug = Start either simulavr or avarice as specified for debugging,
#              with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
#                   bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------

# Target file name (without extension).
TARGET = adb_usb_lufa

# Directory common source filess exist
TMK_DIR = ../../tmk_core

# Directory keyboard dependent files exist
TARGET_DIR = .

# project specific files
SRC = keymap_common.c \
matrix.c \
led.c \
adb.c

ifdef KEYMAP
    SRC := keymap_$(KEYMAP).c $(SRC)
else
    SRC := keymap_ansi.c $(SRC)
endif

CONFIG_H = config.h


# MCU name
#MCU = at90usb1287
MCU = atmega32u4

# Processor frequency.
#     This will define a symbol, F_CPU, in all source code files equal to the
#     processor frequency in Hz. You can then use this symbol in your source code to
#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
#     automatically to create a 32-bit value in your source code.
#
#     This will be an integer division of F_USB below, as it is sourced by
#     F_USB after it has run through any CPU prescalers. Note that this value
#     does not *change* the processor frequency - it should merely be updated to
#     reflect the processor speed set externally so that the code can use accurate
#     software delays.
F_CPU = 16000000


#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8

# Input clock frequency.
#     This will define a symbol, F_USB, in all source code files equal to the
#     input clock frequency (before any prescaling is performed) in Hz. This value may
#     differ from F_CPU if prescaling is used on the latter, and is required as the
#     raw input clock is fed directly to the PLL sections of the AVR for high speed
#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
#     at the end, this will be done automatically to create a 32-bit value in your
#     source code.
#
#     If no clock division is performed on the input clock inside the AVR (via the
#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)

# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT


# Boot Section Size in *bytes*
#   Teensy halfKay   512
#   Teensy++ halfKay 1024
#   Atmel DFU loader 4096
#   LUFA bootloader  4096
#   USBaspLoader     2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096


# Build Options
#   comment out to disable the options.
#
#BOOTMAGIC_ENABLE = yes # 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
#SLEEP_LED_ENABLE = yes  # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover
#ADB_MOUSE_ENABLE = yes

# ADB Mice need acceleration for todays much bigger screens.
OPT_DEFS += -DADB_MOUSE_MAXACC=8


# Optimize size but this may cause error "relocation truncated to fit"
#EXTRALDFLAGS = -Wl,--relax

# Search Path
VPATH += $(TARGET_DIR)
VPATH += $(TMK_DIR)

include $(TMK_DIR)/protocol/lufa.mk
include $(TMK_DIR)/protocol.mk
include $(TMK_DIR)/common.mk
include $(TMK_DIR)/rules.mk

and obviously changed the keymap from the caps key to the power key.
Code: [Select]
#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  /* Default layer : plain keymap IGNORE THE DIAGRAMS, THEY ARE NOT INDICATIVE OF THE KEYBOARD
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
   * +---------------------------------------------------------+ +---+---+---+---+
   * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
   * +-----------------------------------------------------+   | +---+---+---+---+
   * | caps | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
   * +---------------------------------------------------------+ +---+---+---+---+
   * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
   * +---------------------------------------------------------+ +-------+---|ent|
   * |Ctrl|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
   * +---------------------------------------------------------+ +-------+---+---+
   *FROM WHAT I UNDERSTAND FN2 (WHICH IS CURRENTLY SET AS PERIOD ON THE NUMBERPAD) ACTIVATES THE COMMAND I HAVE LABLED AT THE BOTTOM
   */
  [0] = KEYMAP_M0116_ANSI(
    FN2,
    ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC,   DEL, EQL, PSLS,NLCK,
    TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC,       P7,  P8,  P9,  PPLS,
    LCTL, A, S, D, F, G, H, J, K, L, SCLN, QUOT,   ENT,  P4,  P5,  P6,  PMNS,
    LSFT,  Z, X, C, V, B, N, M, COMM,  DOT, SLSH, RSFT,  P1,  P2,  P3,
    CAPS,LGUI,LALT,GRV,   SPC,   BSLS,LEFT,RGHT,DOWN,UP,  P0,       FN1,PENT
  ),
  /* Layer 1 :
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|     | |   |   |   |Mut|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |     |   |   |   |   |   |   |   |   |   |   |   |   |   | |   |   |   |VoU|
   * +-----------------------------------------------------+   | +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |   |      | |   |   |   |VoD|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |Capslock| |   |   |   |   |
   * +---------------------------------------------------------+ +-------+---|   |
   * |Fn1|   |     |   |                   |   |Hom|End|PgD|PgU| |       |   |   |
   * +---------------------------------------------------------+ +-------+---+---+
   *THIS LAYER IS MEANT TO ACTIVATE WHEN I HIT FN2
   */
   [1] = KEYMAP_M0116_ANSI(
    TRNS,
    ESC, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,TRNS,TRNS,   TRNS,                 DEL, HOME, PGUP, MUTE,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,                      INS, END,PGDN, VOLU,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,    TRNS,                  TRNS, UP, TRNS,   VOLD,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,        TRNS,                   LEFT,DOWN,RGHT,
    TRNS,TRNS , TRNS, TRNS,         TRNS,      TRNS, TRNS,TRNS,TRNS,TRNS,                            TRNS,     FN1,    TRNS
  ),
 
    /* Layer 2 :
   *                     +-------+
   *                     | FN1   |
   *                     +-------+
   * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
   * |Esc|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|     | |   |   |   |Mut|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |     |   |   |   |   |   |   |   |   |   |   |   |   |   | |   |   |   |VoU|
   * +-----------------------------------------------------+   | +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |   |      | |   |   |   |VoD|
   * +---------------------------------------------------------+ +---+---+---+---+
   * |      |   |   |   |   |   |   |   |   |   |   |Capslock| |   |   |   |   |
   * +---------------------------------------------------------+ +-------+---|   |
   * |Fn1|   |     |   |                   |   |Hom|End|PgD|PgU| |       |   |   |
   * +---------------------------------------------------------+ +-------+---+---+
   */
  [2] = KEYMAP_M0116_ANSI(
    TRNS,
    ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10,F11,F12,          TRNS,                 TRNS, TRNS, TRNS, TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,      TRNS, TRNS, TRNS, TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,    TRNS,   TRNS, TRNS, TRNS,   TRNS,
    TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,        TRNS,      TRNS,TRNS, TRNS,
    TRNS,TRNS , TRNS, TRNS,         TRNS,      TRNS, TRNS,TRNS,TRNS,TRNS,              TRNS,     TRNS,    TRNS
  ),
};

const uint16_t PROGMEM fn_actions[] = {
    [1] = ACTION_LAYER_TOGGLE(1), /*THIS IS MEANT TO ACTIVATE THE LAYER THAT IS LABELED LAYER 1*/
    [2] = ACTION_LAYER_TAP_KEY(2,1),
};
/*
const uint16_t PROGMEM fn_actions[] = {
ACTION_LAYER_TOGGLE(1), THIS LAYER IS MEANT TO ACTIVATE WHEN I PRESS FN2, WHICH GOES TO LAYER 1 WHICH IS THE SECOND LAYER BECAUSE COMPUTERS COUNT FROM 0
ACTION_LAYER_TAP_KEY(2, KC_CAPS),
};

copied from tufty's keymap
*/

any Ideas? thanks.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 01 October 2015, 14:32:20
TAP_KEY(2,1) is not correct, I'm not sure what you want but you mean TAP_KEY(2, KC_1) ????

Just test with ACTION_LAYER_MOMENTARY(2).

Code: [Select]
const uint16_t PROGMEM fn_actions[] = {
    [1] = ACTION_LAYER_TOGGLE(1), /*THIS IS MEANT TO ACTIVATE THE LAYER THAT IS LABELED LAYER 1*/
    [2] = ACTION_LAYER_TAP_KEY(2,1),
};
Title: Re: ADB to USB keyboard converter
Post by: powaa on Fri, 02 October 2015, 06:37:35
Code: [Select]
const uint16_t PROGMEM fn_actions[] = {
    [1] = ACTION_LAYER_TOGGLE(1), /*THIS IS MEANT TO ACTIVATE THE LAYER THAT IS LABELED LAYER 1*/
    [2] = ACTION_LAYER_TAP_KEY(2,KC_FN1),
};

sorry, this code might make more sense

anyway that isnt the issue. the issue is that the power key doesn't do anything after changing the magic command keys and disabling the magic command.
Title: OS X 10.11
Post by: neex on Fri, 02 October 2015, 16:14:35
So I upgraded to OS X El Capitan (10.11) today.  My keyboard/converter setup (M0115 w/ Teensy) stopped working... sort of.  It works at the login screen when I startup the computer (I can use it to type my password), but it does not work after logging in.

Any suggestions on how to fix?  Thanks.
Title: Re: OS X 10.11
Post by: tominabox1 on Fri, 02 October 2015, 16:18:53
So I upgraded to OS X El Capitan (10.11) today.  My keyboard/converter setup (M0115 w/ Teensy) stopped working... sort of.  It works at the login screen when I startup the computer (I can use it to type my password), but it does not work after logging in.

Any suggestions on how to fix?  Thanks.

Thats odd. Using the exact same set up and I have not had a problem.  I have been using the 10.11 betas for weeks though so maybe you can just recompile the hex and reset the teensy and all will be well?
Title: Re: OS X 10.11
Post by: neex on Fri, 02 October 2015, 16:38:53
Thats odd. Using the exact same set up and I have not had a problem.  I have been using the 10.11 betas for weeks though so maybe you can just recompile the hex and reset the teensy and all will be well?

Making progress... My keyboard is usually plugged into a USB HUB.  To make sure there would be no glitches in the upload, I plugged directly into my laptop.  First thing I noticed was that the keyboard was working.

So, the HUB is the issue -- although, it wasn't an issue with OS X 10.10 and it is not an issue at the login screen.  I realize the purpose of this thread isn't about the particular issue I'm having, but I respect the knowledge of the people here and I would really appreciate any quick thoughts or suggestions you might have.

Edit: The ADB keyboard controller is showing up in System Information under USB, even when plugged into the HUB.  Also... I just noticed that, if I plug in the HUB to the computer... OS X opens the Photos app.  Plugging the keyboard into the HUB also opens the photos app.

Title: Re: ADB to USB keyboard converter
Post by: hasu on Fri, 02 October 2015, 16:49:49
powaa,
hmm, OK. I tried Layer change with power button on my M0116, it works as what I expected.
THen I don't know your problem. I think you can solve your problem in the end if you take time enough with patience.

Let us know what your problem was once you can solve it!

This is my change on the latest source` for the test.
Code: [Select]
diff --git a/converter/adb_usb/config.h b/converter/adb_usb/config.h
index 5ce5c22..21c9470 100644
--- a/converter/adb_usb/config.h
+++ b/converter/adb_usb/config.h
@@ -55,9 +55,15 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #ifndef __ASSEMBLER__
 #include "adb.h"
 #include "matrix.h"
+/*
 #define IS_COMMAND() ( \
     matrix_is_on(MATRIX_ROW(ADB_POWER), MATRIX_COL(ADB_POWER)) \
 )
+*/
+// NumLock/Clear */
+#define IS_COMMAND() ( \
+    matrix_is_on(MATRIX_ROW(0x47), MATRIX_COL(0x47)) \
+)
 #endif
 
 #endif
diff --git a/converter/adb_usb/keymap_hasu.c b/converter/adb_usb/keymap_hasu.c
index a0b3f1f..5d20963 100644
--- a/converter/adb_usb/keymap_hasu.c
+++ b/converter/adb_usb/keymap_hasu.c
@@ -19,7 +19,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
      * `-----------------------------------------------------------' `-----------' `---------------'
      */
     KEYMAP_EXT_ANSI(
-    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
+    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    FN0,
     GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,FN0,      DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
     LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
@@ -44,7 +44,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
      * `-----------------------------------------------------------' `-----------' `---------------'
      */
     KEYMAP_EXT_ANSI(
-    GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
+    GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    TRNS,
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,      INS, HOME,PGUP,    NLCK,BTN1,BTN2,BTN3,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   PSCR,SLCK,PAUS,UP,  INS, FN0,      DEL, END, PGDN,    WH_D,MS_U,WH_U,WH_D,
     LCAP,VOLD,VOLU,MUTE,F,   G,   H,   J,   HOME,PGUP,LEFT,RGHT,     ENT,                         MS_L,MS_D,MS_R,WH_U,
Title: Re: ADB to USB keyboard converter
Post by: hasu on Fri, 02 October 2015, 17:11:36
Wierd.
I'll skim source and search any clue later once they place it in public. I guess they changed something on keyboard or USB.
http://www.opensource.apple.com/

Thats odd. Using the exact same set up and I have not had a problem.  I have been using the 10.11 betas for weeks though so maybe you can just recompile the hex and reset the teensy and all will be well?

Making progress... My keyboard is usually plugged into a USB HUB.  To make sure there would be no glitches in the upload, I plugged directly into my laptop.  First thing I noticed was that the keyboard was working.

So, the HUB is the issue -- although, it wasn't an issue with OS X 10.10 and it is not an issue at the login screen.  I realize the purpose of this thread isn't about the particular issue I'm having, but I respect the knowledge of the people here and I would really appreciate any quick thoughts or suggestions you might have.

Edit: The ADB keyboard controller is showing up in System Information under USB, even when plugged into the HUB.  Also... I just noticed that, if I plug in the HUB to the computer... OS X opens the Photos app.  Plugging the keyboard into the HUB also opens the photos app.


Title: Re: ADB to USB keyboard converter
Post by: neex on Sat, 03 October 2015, 08:09:56
Wierd.
I'll skim source and search any clue later once they place it in public. I guess they changed something on keyboard or USB.
http://www.opensource.apple.com/

Yeah, they definitely changed something.  I just found out that, if I want the computer to crash and force a restart, I only need to tap the caps lock on my M0115 2-3 times.

Google told me that some of the dev builds had some sort of USB issues:

http://www.insanelymac.com/forum/topic/306777-guide-usb-fix-el-capitan-1011/

Not sure what all that means, but, if my experience counts for anything, it seems USB "issues" might still a problem in the public release.

Has anyone else had issues with keyboards/hubs/USB drives/etc.?
Title: Re: ADB to USB keyboard converter
Post by: tominabox1 on Sat, 03 October 2015, 08:24:51
Wierd.
I'll skim source and search any clue later once they place it in public. I guess they changed something on keyboard or USB.
http://www.opensource.apple.com/

Yeah, they definitely changed something.  I just found out that, if I want the computer to crash and force a restart, I only need to tap the caps lock on my M0115 2-3 times.

Google told me that some of the dev builds had some sort of USB issues:

http://www.insanelymac.com/forum/topic/306777-guide-usb-fix-el-capitan-1011/

Not sure what all that means, but, if my experience counts for anything, it seems USB "issues" might still a problem in the public release.

Has anyone else had issues with keyboards/hubs/USB drives/etc.?

Here's my setup - I have my teensy wired up via a cable to the pinout at the ADB header on the daughter card.  Then USB mini cable to an unpowered hub to the Mac Mini.  I have not had any issues with my computer on 10.11 or 10.11.1.  You do have the 1k pullup resistor in place right?   Maybe try to do an EFI/PRAM reset.
Title: Re: ADB to USB keyboard converter
Post by: RavenII on Sat, 03 October 2015, 19:02:18
Sorry, I thought this was the TMK thread...
Title: Re: ADB to USB keyboard converter
Post by: neex on Sun, 04 October 2015, 07:55:43
Here's my setup - I have my teensy wired up via a cable to the pinout at the ADB header on the daughter card.  Then USB mini cable to an unpowered hub to the Mac Mini.  I have not had any issues with my computer on 10.11 or 10.11.1.  You do have the 1k pullup resistor in place right?   Maybe try to do an EFI/PRAM reset.

Good to know yours is working.  I have the resistor wired properly!  Only 2 differences here: (1) I'm not running 10.11.1 yet (but yours works with 10.11, so that shouldn't matter), and (2) My hub is powered--it's a 7-port Inateck brand.  I don't have another hub laying around but I'll try to borrow one from work tomorrow just to eliminate the HUB as the problem.  Thanks!
Title: Re: ADB to USB keyboard converter
Post by: superbia on Fri, 09 October 2015, 06:37:07
Hi.. this may be of some help for AEKII users (atleast the azerty owners)

The two highlighted keys in the layout are actually swapped, but you can go around it like i did.


LAYOUT
More
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    KEYMAP_EXT_ISO(
    ESC,    F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,                   NO,
    Z,      1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,PEQL,PSLS,PAST,
    TAB,    Q,   W,   F,   P,   B,   J,   L,   U,   Y,   SCLN,LBRC,RBRC,ENT,      DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
    LCTL,   A,   R,   S,   T,   G,   M,   N,   E,   I,   O,     QUOT,NUHS,                             P4,  P5,  P6,  PPLS,
    LSFT,   GRV, X,   C,   D,   V,   NO,  K,   H,   COMM,DOT, SLSH,     RSFT,          UP,           P1,  P2,  P3,
    CAPS,   LGUI,LALT,          SPC,                               RCTL,RALT,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
    ),
};

edit: dont mind other keys, im using colemak
Title: Re: ADB to USB keyboard converter
Post by: Hzza on Fri, 09 October 2015, 07:37:47
This is mentioned in one of the docs, the ADB scancode is different for those keys in ISO and ANSI (comments at the bottom of the page (https://github.com/tmk/tmk_keyboard/blob/master/converter/adb_usb/keymap_common.h)). It's good to point it out though, it took me a while to figure out what was going on :D.
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Fri, 09 October 2015, 12:36:00
Would anyone with an Apple Adjustable Keyboard (this one: http://sandy55.fc2web.com/keyboard/adjustable/front_m.jpg) help me out and add their layout here please?
I'd rather start from a good keymap.

Thanks!
Title: Re: ADB to USB keyboard converter
Post by: superbia on Fri, 09 October 2015, 13:07:46
Would anyone with an Apple Adjustable Keyboard (this one: http://sandy55.fc2web.com/keyboard/adjustable/front_m.jpg) help me out and add their layout here please?
I'd rather start from a good keymap.

Thanks!

wow, nice keyboard :)

You can try the layout hasu provides.
You will quickly figure if everything works (or something needs to be switched).

Its really easy... If you made a controller yourself, you will fix all eventual problems that might come.
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Fri, 09 October 2015, 13:11:08
Would anyone with an Apple Adjustable Keyboard (this one: http://sandy55.fc2web.com/keyboard/adjustable/front_m.jpg) help me out and add their layout here please?
I'd rather start from a good keymap.

Thanks!

wow, nice keyboard :)

You can try the layout hasu provides.
You will quickly figure if everything works (or something needs to be switched).

Its really easy... If you made a controller yourself, you will fix all eventual problems that might come.

Yes, I know I can do it myself, but if someone had already done it and I could simply copy it, I'd appreciate it. :)
Title: Re: ADB to USB keyboard converter
Post by: superbia on Fri, 09 October 2015, 14:09:47
Would anyone with an Apple Adjustable Keyboard (this one: http://sandy55.fc2web.com/keyboard/adjustable/front_m.jpg) help me out and add their layout here please?
I'd rather start from a good keymap.

Thanks!

wow, nice keyboard :)

You can try the layout hasu provides.
You will quickly figure if everything works (or something needs to be switched).

Its really easy... If you made a controller yourself, you will fix all eventual problems that might come.

Yes, I know I can do it myself, but if someone had already done it and I could simply copy it, I'd appreciate it. :)

Its just opening a default keymap file with notepad and swaping letters (the file has 30 lines of "code") ...

Afterwards you make & flash it.. if you want, you can take a look at a post i wrote here previously (where i described the steps i made to get mines working).
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Fri, 09 October 2015, 14:31:34
Its just opening a default keymap file with notepad and swaping letters (the file has 30 lines of "code") ...

Afterwards you make & flash it.. if you want, you can take a look at a post i wrote here previously (where i described the steps i made to get mines working).

Ok, maybe I'm not being clear.
I know what to do, and how to do it and I have done it for my AEKIIs, my Octagons and Viper (sold it before I finished), so that's not the issue.

All I was looking for was someone to paste in their existing layout.c for an AAK so I could copy it.
Please don't take any of your time on my behalf.
Title: Re: ADB to USB keyboard converter
Post by: neex on Fri, 09 October 2015, 16:25:22
Here's my setup - I have my teensy wired up via a cable to the pinout at the ADB header on the daughter card.  Then USB mini cable to an unpowered hub to the Mac Mini.  I have not had any issues with my computer on 10.11 or 10.11.1.  You do have the 1k pullup resistor in place right?   Maybe try to do an EFI/PRAM reset.

Good to know yours is working.  I have the resistor wired properly!  Only 2 differences here: (1) I'm not running 10.11.1 yet (but yours works with 10.11, so that shouldn't matter), and (2) My hub is powered--it's a 7-port Inateck brand.  I don't have another hub laying around but I'll try to borrow one from work tomorrow just to eliminate the HUB as the problem.  Thanks!

I finally got a chance to try a different hub (powered Anker brand).  Still not working.  Very frustrating.  Again, the keyboard is not working when I am logged in and using a hub (computer-->hub-->teensy-->kb).  It always works fine when plugged directly into my laptop.  It also works if I'm at the login screen after a restart (but not after logging in).  Like I said, it always worked under OS X 10.10, just started having this problem after upgrading to 10.11)...
Title: Re: ADB to USB keyboard converter
Post by: superbia on Fri, 09 October 2015, 17:37:20
Here's my setup - I have my teensy wired up via a cable to the pinout at the ADB header on the daughter card.  Then USB mini cable to an unpowered hub to the Mac Mini.  I have not had any issues with my computer on 10.11 or 10.11.1.  You do have the 1k pullup resistor in place right?   Maybe try to do an EFI/PRAM reset.

Good to know yours is working.  I have the resistor wired properly!  Only 2 differences here: (1) I'm not running 10.11.1 yet (but yours works with 10.11, so that shouldn't matter), and (2) My hub is powered--it's a 7-port Inateck brand.  I don't have another hub laying around but I'll try to borrow one from work tomorrow just to eliminate the HUB as the problem.  Thanks!

I finally got a chance to try a different hub (powered Anker brand).  Still not working.  Very frustrating.  Again, the keyboard is not working when I am logged in and using a hub (computer-->hub-->teensy-->kb).  It always works fine when plugged directly into my laptop.  It also works if I'm at the login screen after a restart (but not after logging in).  Like I said, it always worked under OS X 10.10, just started having this problem after upgrading to 10.11)...

Probably some security rules to "prevent bad hardware" to pwn your machine ?
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Fri, 09 October 2015, 19:45:25
Here's my setup - I have my teensy wired up via a cable to the pinout at the ADB header on the daughter card.  Then USB mini cable to an unpowered hub to the Mac Mini.  I have not had any issues with my computer on 10.11 or 10.11.1.  You do have the 1k pullup resistor in place right?   Maybe try to do an EFI/PRAM reset.

Good to know yours is working.  I have the resistor wired properly!  Only 2 differences here: (1) I'm not running 10.11.1 yet (but yours works with 10.11, so that shouldn't matter), and (2) My hub is powered--it's a 7-port Inateck brand.  I don't have another hub laying around but I'll try to borrow one from work tomorrow just to eliminate the HUB as the problem.  Thanks!

I finally got a chance to try a different hub (powered Anker brand).  Still not working.  Very frustrating.  Again, the keyboard is not working when I am logged in and using a hub (computer-->hub-->teensy-->kb).  It always works fine when plugged directly into my laptop.  It also works if I'm at the login screen after a restart (but not after logging in).  Like I said, it always worked under OS X 10.10, just started having this problem after upgrading to 10.11)...

Probably some security rules to "prevent bad hardware" to pwn your machine ?
I've looked at your problem and after assessing everything you have said, I have realized what your problem is:
Apple sucks.
Title: Re: ADB to USB keyboard converter
Post by: Toorop on Wed, 11 November 2015, 03:06:15
Hi everyone,

First thanks for your works :thumb:
Second: excuse my poor english and my lack of knowledge, i try to do my best but when you are noob... you are noob.

That's said, i've found a M0118 azerty iso, it working perfectly (i'm typing with it currently) except that i do not find how to do a @ (for those asking themselves: "but wait you just have done it so you can ?!" i've just done a copy/paste ;))

Thanks for your help
Title: Re: ADB to USB keyboard converter
Post by: Blaise170 on Wed, 11 November 2015, 20:00:28
Hi everyone,

First thanks for your works :thumb:
Second: excuse my poor english and my lack of knowledge, i try to do my best but when you are noob... you are noob.

That's said, i've found a M0118 azerty iso, it working perfectly (i'm typing with it currently) except that i do not find how to do a @ (for those asking themselves: "but wait you just have done it so you can ?!" i've just done a copy/paste ;))

Thanks for your help

Mauvais! Have you checked the layout to make sure it is proper for your M0118?
Title: Re: ADB to USB keyboard converter
Post by: yomammary on Fri, 13 November 2015, 10:53:09
Does anyone have one that he could sell me or will I have to make one? :'(
Title: Re: ADB to USB keyboard converter
Post by: Toorop on Sun, 15 November 2015, 03:43:17
Mauvais! Have you checked the layout to make sure it is proper for your M0118?

The main problem is that the m0118 azerty doesn't have the "`" key (which is normally, on modern mac kb, on the upper left or at the left of spacebar on older kb) and which is used on mac layout for the "@".

(http://i.imgur.com/RXeWfmi.jpg)

An easy workaround is to switch from "mac layout" to 'pc layout" on the MacOs control panel and use "alt + 0".
When i'll be more familiar with tmk fw, i'll probably add another layout with Fn functions && a direct @ access.

Thanks ;)
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Sun, 15 November 2015, 06:01:15
Does anyone have one that he could sell me or will I have to make one? :'(

There's this: https://geekhack.org/index.php?topic=75213.msg1864261#msg1864261

Unsure of it's current state.

I cut an ADB cable so I had a connector and about 2inches of internal wires.  I then stripped those and soldered them and the 1K resistor to the teensy.
It's only three solder locations, give it a shot. :)
Title: Re: ADB to USB keyboard converter
Post by: yomammary on Mon, 16 November 2015, 07:38:29
Does anyone have one that he could sell me or will I have to make one? :'(

There's this: https://geekhack.org/index.php?topic=75213.msg1864261#msg1864261

Unsure of it's current state.

I cut an ADB cable so I had a connector and about 2inches of internal wires.  I then stripped those and soldered them and the 1K resistor to the teensy.
It's only three solder locations, give it a shot. :)
Yeah I think I will :)
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Mon, 16 November 2015, 08:51:20
This may help, just ignore the gross soldering, could not find my fine tip, so I had to ham-fist it. :)

Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 16 November 2015, 15:40:56
Does anyone have one that he could sell me or will I have to make one? :'(

You can buy an preassembled converter here.
https://geekhack.org/index.php?topic=72052.0
Title: Re: ADB to USB keyboard converter
Post by: yomammary on Tue, 17 November 2015, 08:02:32
Does anyone have one that he could sell me or will I have to make one? :'(

You can buy an preassembled converter here.
https://geekhack.org/index.php?topic=72052.0
Thanks, I've bought a teensy 2.0 to try doing it myself. :confused:
Title: Re: ADB to USB keyboard converter
Post by: superbia on Wed, 25 November 2015, 04:03:32
I see people paying 20$ for a teensy
while you can buy this converter for 30$ (made by hasu)
(https://i.imgur.com/iLMqfslh.jpg)

However you can use microcontrollers with same chip as teensy has that cost 6$ (pictured bellow)
(https://i.imgur.com/iHk29lj.jpg)

I am just confused, if you want to DIY why don't you pay 6$ for the chip (it doesn't need to be a teensy),
or just pop 30$ for a pro grade converter (hassle free, it works, its tidy, it looks nice) and support the maker
Title: Re: ADB to USB keyboard converter
Post by: yomammary on Mon, 30 November 2015, 11:19:20
I see people paying 20$ for a teensy
while you can buy this converter for 30$ (made by hasu)
Show Image
(https://i.imgur.com/iLMqfslh.jpg)


However you can use microcontrollers with same chip as teensy has that cost 6$ (pictured bellow)
Show Image
(https://i.imgur.com/iHk29lj.jpg)


I am just confused, if you want to DIY why don't you pay 6$ for the chip (it doesn't need to be a teensy),
or just pop 30$ for a pro grade converter (hassle free, it works, its tidy, it looks nice) and support the maker
I get it, it's just fun doing it myself. Money is no object ;)
Title: Re: ADB to USB keyboard converter
Post by: yomammary on Mon, 30 November 2015, 13:23:20
Here is my work so far, everything worked great. The soldering job is not that good mostly because I've soldered a couple of times before. You can also see that I've fixed some things in place with hot glue.
I used Windows + Cygwin for the generation of the Hex file.
Tested the keys (because I was unsure) with EK' switch hitter and it's working great.
The only this remaining is to clean the keycaps.

(http://i.imgur.com/O6Nnb2T.jpg)
(http://i.imgur.com/pryjjYX.jpg)
(http://i.imgur.com/WnUpSPd.jpg)

I'll post more pics when I'm done.
Title: Re: ADB to USB keyboard converter
Post by: asaturn on Sat, 05 December 2015, 05:24:04
can anyone help me out?

I have a teensy 2.0 wired to the board on an apple A9M 0330 keyboard

I know the teensy works (I can send the flashing light program and it works) but I get zero output when flashing the adb hex program.

do the pin numbers on the keyboard circuit correspond to the pin numbers assigned here to the ADB connection?

see photos

(http://i.imgur.com/XQKMYJV.jpg)

(http://i.imgur.com/Cm6nO4h.jpg)

(http://i.imgur.com/2w72BEx.jpg)
Title: Re: ADB to USB keyboard converter
Post by: asaturn on Sat, 05 December 2015, 05:37:57
PS I originally read this site:

http://ifixit.org/blog/4468/hack-it-better-apple-extended-keyboard-ii/jhjgjhcxzczc

but then I found this forum and thread, so I made sure to use D0 instead of F0.

I ran "make" just like the site says... but I'm not sure if I have to change anything else? new to this stuff.
Title: Re: ADB to USB keyboard converter
Post by: asaturn on Sat, 05 December 2015, 14:03:50
so I don't know what I did wrong, but I deleted, resync'd, recompiled, and now it works! I do get the mouse going to the upper left, but that's known -- I'll throw the resistor on there.

THANKS!
Title: Re: ADB to USB keyboard converter
Post by: stoic-lemon on Mon, 07 December 2015, 11:27:05
Another noob to all this just dropping by to say thanks to everyone for sharing successes and failures. They are so helpful. I managed to get my M0116 up and running. Most difficult parts were setting up the software on Windows and getting round a few C based confusions. Being back on the command line has me feeling nostalgic for when I was Linux only.

Next things to do are to make it all look presentable. I think I will put the Teensy in the case and have a USB cable running out the side of the case.

Thanks again!
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 17 December 2015, 21:38:19
REQUEST FOR HELP: Extended mouse protocol support
It is required for more buttons and movement resolution of mouse/trackball.
Do you have multiple button mouse? Implement it!
https://github.com/tmk/tmk_keyboard/issues/274

This converter currently supports only 'classic mouse protrocol' which allows only one or two buttons, while 'extended protocol' can support multiple-button devices up to eight buttons.

Thanks
Title: Re: ADB to USB keyboard converter
Post by: Stabilized on Tue, 22 December 2015, 17:24:52
I was wondering if anyone could help me use a Pro Micro as the controller for this firmware.

I have read the post a couple of pages ago (https://geekhack.org/index.php?topic=14290.msg1789587#msg1789587) and also the post on Deskthority (http://deskthority.net/workshop-f7/how-to-use-a-pro-micro-as-a-cheap-controller-converter-like-soarer-s-t8448.html) about using a Pro Micro instead of a Teensy.

I used both guides and soldered up my controller and successfully flashed it, but it doesn't work with either my Apple Extended keyboard or my Apple Adjustable keyboard and I can't work out what I have done wrong!

This is my first time using and flashing the TMK firmware, so I do assume that it is something to do with that. I have flashed soarer's converter on about 3 Pro Micros without any problem. Also when I look in my Mac's keyboard menu in the settings, the converter doesn't come up as a recognised keyboard, should it?

Anyway here's a picture of my soldering job, I originally connected the Power SW line to PD1 because I wasn't thinking, but I don't think should effect the functionality right?

(http://i.imgur.com/O2MQXjn.jpg)(http://i.imgur.com/o4CPpkF.jpg)

The resistor is 1.16K and I am using a short 4 pole s-video cable.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 22 December 2015, 18:59:21
Yes, it is recognized as keyboard once firmware runs on controller.
Right, Power switch line won't affect unless the wiring is mess.
Title: Re: ADB to USB keyboard converter
Post by: Stabilized on Wed, 23 December 2015, 05:34:32
I think it is a problem with me building it, I tried with v1.12 soarer's converter using the same pro micro and that works without problems in Mac OS X (10.11).
For some reason when I flash the TMK ADB hex it doesn't come up in my device list on Mac OS.

I have tried different cables, building it multiple times, and I can't get it work! I follow all the build instructions over on this page (https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/build.md), but it still isn't shown on either Mac OS or Windows 10.

Would really appreciate help or maybe a pre-compiled .hex file if you have one handy?
Title: Re: ADB to USB keyboard converter for Teensy
Post by: merlin64 on Sun, 10 January 2016, 22:20:05
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
(http://cfile7.uf.tistory.com/image/1947915A4D651B381E3C0D)


Anyone know where Jeffrey got that mini usb connector? Been looking for one like it, but haven't been successful.
Title: Re: ADB to USB keyboard converter for Teensy
Post by: MAR82 on Mon, 11 January 2016, 03:04:49
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
(http://cfile7.uf.tistory.com/image/1947915A4D651B381E3C0D)


Anyone know where Jeffrey got that mini usb connector? Been looking for one like it, but haven't been successful.

Looking for something like this?
http://www.ebay.com/itm/10pcs-Mini-USB-Female-5Pin-180-Socket-Connector-vertical-Legs-HW-MU-5F-23-/170961675619?hash=item27ce1c2563:g:jhEAAMXQMmJRNBRi
Because it looks like Jeffrey used one, and then just hot glued it into the ADB port housing
Title: Re: ADB to USB keyboard converter
Post by: merlin64 on Mon, 11 January 2016, 10:18:47
I wish he was still active on the forum, It almost looks like he just soldered his teensy 2.0++ to some pins shared by the original microcontroller.
Title: Re: ADB to USB keyboard converter
Post by: mastermachetier on Mon, 11 January 2016, 17:43:49
Hey Guys,

I am copying my message from the tmk_keyboard main thread . I fell that it is more relevant here



Quote
Hey first of all thank you for the awesome firmware its beautiful. I am pretty new to the world of hardware and also coding. I have a apple standard keyboard M0116 that i converted from adb using the tmk firmware. It is working beautifully, the next step i would like to do is convert it to bluetooth. I saw the bluetooth protocol in the repo this is just if you are using serial. I have a bluefruit ez-link that supports serial , but i also have a bluefruit le spi that supports bluetooth hid. https://learn.adafruit.com/introducing-the-adafruit-bluefruit-spi-breakout/hidkeyboard  . So after all that my questions are

1. Is there an advantage to using the bluetooth hid instead of serial ? If so how hard would it be to implement and where would I begin.
2. How do I add the bluefruit protocol in the firmware to the makefile for the adb converter .

Thanks !
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Wed, 03 February 2016, 16:50:59
Ok so I'm trying to go through this whole process again because I have more time now, and i really could use ,y function layer, but I seem to be stuck on the very first step! I'm using a Teensy btw. So my problem is that when I open cygwin and type in:
cd tmk_keyboard/converter/adb_usb
nothing happens!
I downloaded the zip archive and made sure to extract it as well. My problem might be the Atmel AVR toolchain, I'm not really sure how that one works, but I downloaded it and all I got was a zip file, no executable or anything.
When I run the command in Cygwin, I get an output saying that there is no such file or directory. I'm at aloss here, any help would be appreciated.
Title: Re: ADB to USB keyboard converter
Post by: mastermachetier on Thu, 11 February 2016, 12:15:38
Hey guys and Hasu. I have been using this firmware for about a month now everyday on my m0116 as a matter of fact I am typing with it right now. I am having an issue though were If I do not use the keyboard for a little bit of time It stops responding until I unplug it both from the adbport on the keyboard and the usb from the teensy. The way i wired this was by getting a spare adb cable stripping the ends and soldering it directly to a teensy. I was wondering you could lead me in the correct direction of troubleshooting this issue.

Thank you,
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Thu, 11 February 2016, 13:34:27
Hey guys and Hasu. I have been using this firmware for about a month now everyday on my m0116 as a matter of fact I am typing with it right now. I am having an issue though were If I do not use the keyboard for a little bit of time It stops responding until I unplug it both from the adbport on the keyboard and the usb from the teensy. The way i wired this was by getting a spare adb cable stripping the ends and soldering it directly to a teensy. I was wondering you could lead me in the correct direction of troubleshooting this issue.

Thank you,
Weird,I've been using the code on an M0116 as well for about a year and I haven't ever had this issue. Do you have the stock configuration or did you add a function layer? I'm starting to get annoyed  by the lack of F keys
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 11 February 2016, 15:38:37
Hey guys and Hasu. I have been using this firmware for about a month now everyday on my m0116 as a matter of fact I am typing with it right now. I am having an issue though were If I do not use the keyboard for a little bit of time It stops responding until I unplug it both from the adbport on the keyboard and the usb from the teensy. The way i wired this was by getting a spare adb cable stripping the ends and soldering it directly to a teensy. I was wondering you could lead me in the correct direction of troubleshooting this issue.

Thank you,

Check first post, again. In particular, "NEED HELP?" section.
Title: Re: ADB to USB keyboard converter
Post by: mastermachetier on Thu, 11 February 2016, 15:58:03
Hey guys and Hasu. I have been using this firmware for about a month now everyday on my m0116 as a matter of fact I am typing with it right now. I am having an issue though were If I do not use the keyboard for a little bit of time It stops responding until I unplug it both from the adbport on the keyboard and the usb from the teensy. The way i wired this was by getting a spare adb cable stripping the ends and soldering it directly to a teensy. I was wondering you could lead me in the correct direction of troubleshooting this issue.

Thank you,
Weird,I've been using the code on an M0116 as well for about a year and I haven't ever had this issue. Do you have the stock configuration or did you add a function layer? I'm starting to get annoyed  by the lack of F keys

I am using the default layout still i wrote a layout yesterday but missed something as it is not compiling but I have yet to go over it again .

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


const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
    * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
    * +-----------------------------------------------------+   | +---+---+---+---+
    * | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
    * +---------------------------------------------------------+ +-------+---|ent|
    * |fn0|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
    * +---------------------------------------------------------+ +-------+---+---+
    */
  KEYMAP_M0116_ANSI( \
                                     POWER,                                                          \
       ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,   NLCK,EQL, PSLS,PAST, \
       TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,        P7,  P8,  P9,  PMNS, \
       LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,    P4,  P5,  P6,  PPLS, \
       LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,   P1,  P2,  P3,        \
       FN0, LALT,LGUI,GRV,           SPC,      BSLS,LEFT,RGHT,DOWN,UP,          P0,       PDOT,PENT),

    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +----+----+--+-+---+
    * |esc| F1| F2| F3| F4| F5| F6| F7| F8| F9| F0| - | = | del | |    |    |    |   |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | |    |    |    | + |
    * +-----------------------------------------------------+   | +----+----+----+---+
    * | bks  | a | s | d | f | g | h | j | k | l | ; | ' |return| |    | UP |    | - |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | |Left|DOWN|RGHT|   |
    * +---------------------------------------------------------+ +---------+----|ent|
    * |   |opt|comnd| clr|                  | \ |lef|rig|dwn|up | |  DEL    |bks |   |
    * +---------------------------------------------------------+ +---------+----+---+
    */
  KEYMAP_M0116_ANSI( \
                                     TRNS,                                                            \
       TRNS,F1,  F2,  F3,  F4,  F5,  f6,  F7,  F8,  F9,  F0,  TRNS,TRNS, DEL,    NO  ,NO  ,NO  ,NO  , \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         NO  ,NO  ,NO  ,TRNS, \
       BSPC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,    NO  ,UP  ,NO  ,TRNS, \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,    LEFT,DOWN,RGHT,      \
       NO,  TRNS,TRNS,LCTL,          TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,         DEL ,     BSPC,TRNS),

};

const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),             
};     


error

Code: [Select]
make -f Makefile.teensy KEYMAP=raf                                                     
sh: dfu-programmer: command not found
sh: dfu-programmer: command not found

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


mkdir -p obj_adb_usb_lufa
Compiling C: keymap_raf.c
avr-gcc -c -mmcu=at90usb1286  -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=2048 -DADB_MOUSE_MAXACC=8 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" -DFIXED_CONTROL_ENDPOINT_SIZE=8  -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DBOOTMAGIC_ENABLE -DMOUSEKEY_ENABLE -DMOUSE_ENABLE -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DNKRO_ENABLE -DVERSION=5c89d73-dirty -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_adb_usb_lufa/keymap_raf.lst -I. -I../../tmk_core -I../../tmk_core/protocol/lufa -I../../tmk_core/protocol/lufa/LUFA-git -I../../tmk_core/protocol -I../../tmk_core/common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_adb_usb_lufa_keymap_raf.o.d  keymap_raf.c -o obj_adb_usb_lufa/keymap_raf.o
In file included from keymap_raf.c:1:0:
keymap_common.h:149:65: error: 'KC_f6' undeclared here (not in a function)
   { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
                                                                 ^
keymap_raf.c:47:3: note: in expansion of macro 'KEYMAP_M0116_ANSI'
   KEYMAP_M0116_ANSI( \
   ^
keymap_common.h:150:55: error: 'KC_F0' undeclared here (not in a function)
   { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
                                                       ^
keymap_raf.c:47:3: note: in expansion of macro 'KEYMAP_M0116_ANSI'
   KEYMAP_M0116_ANSI( \
   ^
make: *** [obj_adb_usb_lufa/keymap_raf.o] Error 1
Title: Re: ADB to USB keyboard converter
Post by: mastermachetier on Thu, 11 February 2016, 16:00:07
Hey guys and Hasu. I have been using this firmware for about a month now everyday on my m0116 as a matter of fact I am typing with it right now. I am having an issue though were If I do not use the keyboard for a little bit of time It stops responding until I unplug it both from the adbport on the keyboard and the usb from the teensy. The way i wired this was by getting a spare adb cable stripping the ends and soldering it directly to a teensy. I was wondering you could lead me in the correct direction of troubleshooting this issue.

Thank you,

Check first post, again. In particular, "NEED HELP?" section.


Wow sorry Hasu have read this thread through so many you would think I saw that. I will post with pictures when I have a chance to open up my "converter box". I am at work and don't have screw drivers here.

Thanks though !
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Thu, 18 February 2016, 07:20:16
Master, any updates on the layout you wrote?
Title: Re: ADB to USB keyboard converter
Post by: mastermachetier on Thu, 18 February 2016, 10:53:00
Master, any updates on the layout you wrote?

I got the code working after some tweaks turns out I forgot to put "F" before some of the function keys. I am using a basic setup right now to get function keys, but I plan on making a better keymap when I have some time. I also re-soldered my teensy internally and it seems to have resolve the issues I was having with they keyboard freezing. In the future I plan on using the locking key to change before colemak and qwerty and move the fn key to where GRV is using shift and FN to get ` ~ and access the fkeys using FN. 

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

/*
 * Mastermachetier
 */
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
    * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
    * +-----------------------------------------------------+   | +---+---+---+---+
    * | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
    * +---------------------------------------------------------+ +-------+---|ent|
    * |fn0|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
    * +---------------------------------------------------------+ +-------+---+---+
    */
  KEYMAP_M0116_ANSI( \
                                     POWER,                                                          \
       ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,   NLCK,EQL, PSLS,PAST, \
       TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,        P7,  P8,  P9,  PMNS, \
       LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,    P4,  P5,  P6,  PPLS, \
       LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,   P1,  P2,  P3,        \
       FN0, LALT,LGUI,GRV,           SPC,      BSLS,LEFT,RGHT,DOWN,UP,          P0,       PDOT,PENT),

    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +----+----+--+-+---+
    * |esc| F1| F2| F3| F4| F5| F6| F7| F8| F9| F0| - | = | del | |    |    |    |   |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | |    |    |    | + |
    * +-----------------------------------------------------+   | +----+----+----+---+
    * | bks  | a | s | d | f | g | h | j | k | l | ; | ' |return| |    | UP |    | - |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | |Left|DOWN|RGHT|   |
    * +---------------------------------------------------------+ +---------+----|ent|
    * |fn0|opt|comnd| clr|                  | \ |lef|rig|dwn|up | |  DEL    |bks |   |
    * +---------------------------------------------------------+ +---------+----+---+
    */
  KEYMAP_M0116_ANSI( \
                                     TRNS,                                                            \
       TRNS,F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10,  F11, F12, DEL,    NO  ,NO  ,NO  ,NO  , \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         NO  ,NO  ,NO  ,TRNS, \
       BSPC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,    NO  ,UP  ,NO  ,TRNS, \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,    LEFT,DOWN,RGHT,      \
       TRNS,TRNS,TRNS,TRNS,          TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,         DEL ,     BSPC,TRNS),

};

const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),             
};     

More
[attachimg=1]
[attachimg=2]
[attachimg=3]
[attachimg=4]
[attachimg=5]
[attachimg=6]
[attachimg=7]
[attachimg=8]

quick edit : has anyone figured out how to use bootmagic on adb ? Also can you access layers on the keyboard while in bios using function keys for the "F" keys ?
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Thu, 18 February 2016, 23:05:16
Master, any updates on the layout you wrote?

I got the code working after some tweaks turns out I forgot to put "F" before some of the function keys. I am using a basic setup right now to get function keys, but I plan on making a better keymap when I have some time. I also re-soldered my teensy internally and it seems to have resolve the issues I was having with they keyboard freezing. In the future I plan on using the locking key to change before colemak and qwerty and move the fn key to where GRV is using shift and FN to get ` ~ and access the fkeys using FN. 

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

/*
 * Mastermachetier
 */
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
    * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
    * +-----------------------------------------------------+   | +---+---+---+---+
    * | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
    * +---------------------------------------------------------+ +-------+---|ent|
    * |fn0|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
    * +---------------------------------------------------------+ +-------+---+---+
    */
  KEYMAP_M0116_ANSI( \
                                     POWER,                                                          \
       ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,   NLCK,EQL, PSLS,PAST, \
       TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,        P7,  P8,  P9,  PMNS, \
       LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,    P4,  P5,  P6,  PPLS, \
       LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,   P1,  P2,  P3,        \
       FN0, LALT,LGUI,GRV,           SPC,      BSLS,LEFT,RGHT,DOWN,UP,          P0,       PDOT,PENT),

    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +----+----+--+-+---+
    * |esc| F1| F2| F3| F4| F5| F6| F7| F8| F9| F0| - | = | del | |    |    |    |   |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | |    |    |    | + |
    * +-----------------------------------------------------+   | +----+----+----+---+
    * | bks  | a | s | d | f | g | h | j | k | l | ; | ' |return| |    | UP |    | - |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | |Left|DOWN|RGHT|   |
    * +---------------------------------------------------------+ +---------+----|ent|
    * |fn0|opt|comnd| clr|                  | \ |lef|rig|dwn|up | |  DEL    |bks |   |
    * +---------------------------------------------------------+ +---------+----+---+
    */
  KEYMAP_M0116_ANSI( \
                                     TRNS,                                                            \
       TRNS,F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10,  F11, F12, DEL,    NO  ,NO  ,NO  ,NO  , \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         NO  ,NO  ,NO  ,TRNS, \
       BSPC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,    NO  ,UP  ,NO  ,TRNS, \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,    LEFT,DOWN,RGHT,      \
       TRNS,TRNS,TRNS,TRNS,          TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,         DEL ,     BSPC,TRNS),

};

const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),             
};     

More

quick edit : has anyone figured out how to use bootmagic on adb ? Also can you access layers on the keyboard while in bios using function keys for the "F" keys ?
No experience with bootmagic, but that looks like some solid code. I'd borrow it but I can't seem to get my compiler to work. Oh well.
Title: Re: ADB to USB keyboard converter
Post by: mastermachetier on Thu, 18 February 2016, 23:20:25
Master, any updates on the layout you wrote?

I got the code working after some tweaks turns out I forgot to put "F" before some of the function keys. I am using a basic setup right now to get function keys, but I plan on making a better keymap when I have some time. I also re-soldered my teensy internally and it seems to have resolve the issues I was having with they keyboard freezing. In the future I plan on using the locking key to change before colemak and qwerty and move the fn key to where GRV is using shift and FN to get ` ~ and access the fkeys using FN. 

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

/*
 * Mastermachetier
 */
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
    * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
    * +-----------------------------------------------------+   | +---+---+---+---+
    * | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
    * +---------------------------------------------------------+ +-------+---|ent|
    * |fn0|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
    * +---------------------------------------------------------+ +-------+---+---+
    */
  KEYMAP_M0116_ANSI( \
                                     POWER,                                                          \
       ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,   NLCK,EQL, PSLS,PAST, \
       TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,        P7,  P8,  P9,  PMNS, \
       LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,    P4,  P5,  P6,  PPLS, \
       LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,   P1,  P2,  P3,        \
       FN0, LALT,LGUI,GRV,           SPC,      BSLS,LEFT,RGHT,DOWN,UP,          P0,       PDOT,PENT),

    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | power |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +----+----+--+-+---+
    * |esc| F1| F2| F3| F4| F5| F6| F7| F8| F9| F0| - | = | del | |    |    |    |   |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | |    |    |    | + |
    * +-----------------------------------------------------+   | +----+----+----+---+
    * | bks  | a | s | d | f | g | h | j | k | l | ; | ' |return| |    | UP |    | - |
    * +---------------------------------------------------------+ +----+----+----+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | |Left|DOWN|RGHT|   |
    * +---------------------------------------------------------+ +---------+----|ent|
    * |fn0|opt|comnd| clr|                  | \ |lef|rig|dwn|up | |  DEL    |bks |   |
    * +---------------------------------------------------------+ +---------+----+---+
    */
  KEYMAP_M0116_ANSI( \
                                     TRNS,                                                            \
       TRNS,F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10,  F11, F12, DEL,    NO  ,NO  ,NO  ,NO  , \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         NO  ,NO  ,NO  ,TRNS, \
       BSPC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,    NO  ,UP  ,NO  ,TRNS, \
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,    LEFT,DOWN,RGHT,      \
       TRNS,TRNS,TRNS,TRNS,          TRNS,     TRNS,TRNS,TRNS,TRNS,TRNS,         DEL ,     BSPC,TRNS),

};

const uint16_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),             
};     

More

quick edit : has anyone figured out how to use bootmagic on adb ? Also can you access layers on the keyboard while in bios using function keys for the "F" keys ?
No experience with bootmagic, but that looks like some solid code. I'd borrow it but I can't seem to get my compiler to work. Oh well.


what errors are you getting ? What os are you trying to compile on ? Also what type of microcontroller?
Title: Re: ADB to USB keyboard converter
Post by: mr.squishy on Fri, 19 February 2016, 00:31:19
I'm on windows 10 with a teensy 2.0, my error is that my compiler (cygwin) can't seem to figure out how to switch directories. I'm not sure why, but when I tell it to switch directories it tells me that the directory does not exist, no matter what i put in.

Additionally, I'm getting a missing libusb0.dll error when I attempt to use the dfu programmer, so that might be my issue
Title: Re: ADB to USB keyboard converter
Post by: zhyiou on Thu, 07 April 2016, 08:00:10
Hello,

currently I scored an AEKII and am waiting for a pro micro clone from China. However, because I have to wait for such a long time I was already thinking a bit about what I wanted my keyboard to do.

I would like to make a layer in which I type greek symbols such as Δ δ and the like. However, there are no keycodes for this. From reading the documentation (I have absolutely zero experience with linux nor microcontrollers) it would seem that the keycodes are defined in common/keycode.h However, I do not quite understand how I would go about adding greek symbols to this list.

Could somebody explain this to me?

Regards,
Zhyiou

EDIT?:
I might try to use macros in the keymap_xxx.c file where a third layer has all keys substituted by e.g. FN12 keys like so:

const uint16_t PROGMEM fn_actions[] = {
    [12] = MACRO( I(0), D(ALT), T(2), T(2), T(5), U(ALT), END ) : MACRO_NONE ),
};

Would this code run a macro that types ALT+225 (which would result in ß)?

EDIT2?: Or perhaps this sequence?
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case FN12:
            return (record->event.pressed ?
                    MACRO( I(0), D(ALT), T(P2), T(P2), T(P5), U(ALT), END ) :
                    MACRO_NONE );
        case FN13:
            return (record->event.pressed ?
                    MACRO( I(0), D(ALT), T(P2), T(P2), T(P4), U(ALT), END ) :
                    MACRO_NONE );
        case LSHIFT_FN12:
        case RSHIFT_FN12:
            return (record->event.pressed ?
                    MACRO( I(0), D(ALT), T(P_), T(P_), T(P_), U(ALT), END ) :
                    return MACRO_NONE;
    }
    return MACRO_NONE;
}
Title: Re: ADB to USB keyboard converter
Post by: zhyiou on Sat, 09 April 2016, 07:26:59
And another question if anybody could help:

Currently I got a pretty decent idea for the macro, but I would like to change the behavior of the macro depending on the active layer (e.g. layer 1 is lower case, Fn0 temporary changes to layer 2, where the same key is now upper case). For this to work I got the following code:

Code: [Select]
enum macro_id {
    THETA, //first row FN1..

};

const uint16_t PROGMEM fn_actions[] = {
    [0] = ACTION_LAYER_MOMENTARY(2),                  // FN0, momentarily switch between layer 1 and 2 (greek lower and upper)

    [1] = ACTION_MACRO(THETA),                        // Macros for greek letters --> ALT+unicode

};

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt, uint8_t layer) //can you add 'uint8_t layer' to know what layer is active currently?
{
    switch (id) {
        case THETA:

            #if(layer==2)              //layer 2 is upper case
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P8), U(LALT), END ) :
                    MACRO_NONE );
            #else                      // only can get to layer 3 from 2 (temporary keyaction Fn0), so if not 2 then is 1 AKA lower case
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P8), U(LALT), END ) :
                    MACRO_NONE );
    }
    return MACRO_NONE;
}

Normally, the macro would be:
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)

but can I add a variable layer like so?
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt, uint8_t layer)

TY
Title: Re: ADB to USB keyboard converter
Post by: goflo on Sat, 09 April 2016, 13:06:53
I got a ADB to USB Converter from Hasu directly and tried to get my Apple M0118 with a german layout running.

(http://computer-retro.de/Bilder/Festplatten/Macintosh-Tastatur-M0118-mit-Apple-Logo-FCC-ID-BCG6LWM0117.jpg)

The standard programming of the adbtousb converter seems to fit the Apple AEK.
Has anyone got a layout file for the M0118? Or have I overlooked it in the files?

Thx
Flo
Title: Re: ADB to USB keyboard converter
Post by: zhyiou on Sat, 09 April 2016, 13:50:01
@ goflo

as far as I can tell M0116 and M0118 are either identical or very similar. This layout can be found in https://github.com/tmk/tmk_keyboard/blob/master/converter/adb_usb/keymap_common.h

Or in code format:
Code: [Select]
/* M0116 Apple Standard Keyboard ANSI
*                     +-------+
*                     | power |
*                     +-------+
* +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
* |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |clr| = | / | * |
* +---------------------------------------------------------+ +---+---+---+---+
* | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
* +-----------------------------------------------------+   | +---+---+---+---+
* | ctrl | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
* +---------------------------------------------------------+ +---+---+---+---+
* | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
* +---------------------------------------------------------+ +-------+---|ent|
* |cap|opt|comnd| ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
* +---------------------------------------------------------+ +-------+---+---+
*/
#define KEYMAP_M0116_ANSI( \
                           K7F,                                              \
   K35,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K47,K51,K4B,K43, \
   K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,     K59,K5B,K5C,K45, \
   K36,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,    K24, K56,K57,K58,K4E, \
   K38,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,        K7B, K53,K54,K55,     \
   K39,K3A,K37,K32,        K31,        K2A,K3B,K3C,K3D,K3E, K52,    K41,K4C  \
) { \
  { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \
  { KC_##K08, KC_##K09, KC_NO,    KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \
  { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \
  { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \
  { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \
  { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \
  { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO,    KC_##K35, KC_##K36, KC_##K37 }, \
  { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_NO    }, \
  { KC_NO,    KC_##K41, KC_NO,    KC_##K43, KC_NO,    KC_##K45, KC_NO,    KC_##K47 }, \
  { KC_NO,    KC_NO,    KC_NO,    KC_##K4B, KC_##K4C, KC_NO,    KC_##K4E, KC_NO    }, \
  { KC_NO,    KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \
  { KC_##K58, KC_##K59, KC_NO,    KC_##K5B, KC_##K5C, KC_NO,    KC_NO,    KC_NO    }, \
  { KC_NO,    KC_NO,    KC_NO,    KC_NO   , KC_NO,    KC_NO,    KC_NO,    KC_NO    }, \
  { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO    }, \
  { KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO,    KC_NO    }, \
  { KC_NO   , KC_NO,    KC_NO   , KC_##K7B, KC_NO,    KC_NO,    KC_NO,    KC_##K7F }  \
}
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 09 April 2016, 20:52:56
zhyiou, you can know current layer state from uint32_t variables; layer_state and default_layer_state of common/action_layer.h. Note that each bit of the variables represent each layer state.
For example, you can know if layer 2 is enabled with
Code: [Select]
#include "action_layer.h"

if ((layer_state | default_layer_state) & (1<<2))


goflo, you can use ISO AEK layout without any acutal problem.
Title: Re: ADB to USB keyboard converter
Post by: zhyiou on Sun, 10 April 2016, 05:35:16
zhyiou, you can know current layer state from uint32_t variables; layer_state and default_layer_state of common/action_layer.h. Note that each bit of the variables represent each layer state.
For example, you can know if layer 2 is enabled with
Code: [Select]
#include "action_layer.h"

if ((layer_state | default_layer_state) & (1<<2))


goflo, you can use ISO AEK layout without any acutal problem.

Thank you so much! I know very little of programming, and nothing about either C or bitoperations. Fingers crossed that it will actually work!

For anyone perhaps interested in how I intend to add greek symbols (lower and upper case) to my keyboard, with Hasu's variable added it looks like so:
Code: [Select]
#include "keymap_common.h"
#include "action_layer.h"


const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* 0 Default Layer: plain keymap
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |   |
     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
     * ,-----------------------------------------------------------. ,-----------. ,---------------.
     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
     * |-----------------------------------------------------------| |-----------| |---------------|
     * |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]| Fn31| |Del|End|PgD| |  7|  8|  9|  -|
     * |-----------------------------------------------------------| `-----------' |---------------|
     * |CapsLo|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return  |               |  4|  5|  6|  +|
     * |-----------------------------------------------------------|     ,---.     |---------------|
     * |Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |     |Up |     |  1|  2|  3|   |
     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
     * |Ctrl |Gui |Alt |         Space             |Alt |Gui |Ctrl | |Lef|Dow|Rig| |      0|  .|   |
     * `-----------------------------------------------------------' `-----------' `---------------'
     */
    KEYMAP_EXT_ANSI(
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,FN31,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
    LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
    LCTL,LGUI,LALT,                 SPC,                        RGUI,RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
    ),

    /* 1 Default Layer: Greek lower
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |   |
     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
     * ,-----------------------------------------------------------. ,-----------. ,---------------.
     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
     * |-----------------------------------------------------------| |-----------| |---------------|
     * |Tab  |thta|omg|eps|xi|tau|psi|mu|iota|omc|rho|  [|  ]|    \| |Del|End|PgD| |  7|  8|  9|  -|
     * |-----------------------------------------------------------| `-----------' |---------------|
     * |CapsLo|alph|sig|del|ups|gam|pi|phi|kap|lmb|  ;|  '|Return  |               |  4|  5|  6|  +|
     * |-----------------------------------------------------------|     ,---.     |---------------|
     * |Fn0     |zet|chi|   |nu|beta|eta|   |  ,|  ,|  /|Fn0       |     |Up |     |  1|  2|  3|   |
     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
     * |Ctrl |Gui |Alt |         Space             |Alt |Gui |Ctrl | |Lef|Dow|Rig| |      0|  .|   |
     * `-----------------------------------------------------------' `-----------' `---------------'
     */
    KEYMAP_EXT_ANSI(
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
    GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
    TAB, FN1, FN2, FN3, FN4, FN5, FN6, FN7, FN8, FN9, FN10,LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
    LCAP,FN11,FN12,FN13,FN14,FN15,FN16,FN17,FN18,FN19,SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
    FN0, FN20,FN21,  NO,FN22,FN23,FN24,  NO,COMM,DOT, SLSH,          FN0,           UP,           P1,  P2,  P3,
    LCTL,LGUI,LALT,                 SPC,                        RGUI,RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
    ),

    /* 2 Default Layer: Greek upper
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
     * |Esc|   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |   |
     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
     * ,-----------------------------------------------------------. ,-----------. ,---------------.
     * |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|Backspa| |Ins|Hom|PgU| |NmL|  =|  /|  *|
     * |-----------------------------------------------------------| |-----------| |---------------|
     * |Tab  |THTA|OMG|EPS|XI|TAU|PSI|MU|IOTA|OMC|RHO|  [|  ]|    \| |Del|End|PgD| |  7|  8|  9|  -|
     * |-----------------------------------------------------------| `-----------' |---------------|
     * |CapsLo|ALPH|SIG|DEL|UPS|GAM|PI|PHI|KAP|LMB|  ;|  '|Return  |               |  4|  5|  6|  +|
     * |-----------------------------------------------------------|     ,---.     |---------------|
     * |Fn0     |ZET|CHI|   |NU|BETA|ETA|   |  ,|  ,|  /|Fn0       |     |Up |     |  1|  2|  3|   |
     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
     * |Ctrl |Gui |Alt |         Space             |Alt |Gui |Ctrl | |Lef|Dow|Rig| |      0|  .|   |
     * `-----------------------------------------------------------' `-----------' `---------------'
     */
    KEYMAP_EXT_ANSI(
    TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,           TRNS, TRNS, TRNS,                    NO,
    TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,     TRNS, TRNS, TRNS,  TRNS, TRNS, TRNS, TRNS,
    TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,     TRNS, TRNS, TRNS,  TRNS, TRNS, TRNS, TRNS,
    TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,       TRNS,                        TRNS, TRNS, TRNS, TRNS,
    TRNS, TRNS, TRNS, NO,   TRNS, TRNS, TRNS, NO,   TRNS, TRNS, TRNS,             TRNS,           TRNS,        TRNS, TRNS, TRNS,
    TRNS, TRNS, TRNS,                       TRNS,                           TRNS, TRNS,     TRNS, TRNS, TRNS,  TRNS,       TRNS, TRNS
    ),

    /* 3 Default Layer: mouse and media keymap
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.             ,---.
     * |`  |   |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau|             |   |
     * `---'   `---------------' `---------------' `---------------' `-----------'             `---'
     * ,-----------------------------------------------------------. ,-----------. ,---------------.
     * |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| Fn31| |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             |Alt |Gui |Ctrl | |Hom|PgD|End| |    Mb1|Mb2|   |
     * `-----------------------------------------------------------' `-----------' `---------------'
     */
    KEYMAP_EXT_ANSI(
    GRV, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    NO,
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12, DEL,      INS, HOME,PGUP,    NLCK,BTN1,BTN2,BTN3,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   PSCR,SLCK,PAUS,UP,  INS, FN31,     DEL, END, PGDN,    WH_D,MS_U,WH_U,WH_D,
    LCAP,VOLD,VOLU,MUTE,F,   G,   H,   J,   HOME,PGUP,LEFT,RGHT,     ENT,                         MS_L,MS_D,MS_R,WH_U,
    LSFT,Z,   X,   C,   V,   B,   N,   M,   END, PGDN,DOWN,          RSFT,          PGUP,         WH_L,MS_D,WH_R,
    LCTL,LGUI,LALT,                 SPC,                        RGUI,RCTL,     HOME,PGDN,END,     BTN1,     BTN2,BTN3
    ),
};

enum macro_id {
    THETA, //first row FN1..
    OMEGA,
    EPSILON,
    XI,
    TAU,
    PSI,
    MU,
    IOTA,
    OMICRON,
    RHO,
    ALPHA, //second row
    SIGMA,
    DELTA,
    UPSILON,
    GAMMA,
    PI,
    PHI,
    KAPPA,
    LAMBDA,
    ZETA, //third row
    CHI,
    NU,
    BETA,
    ETA, // FN24
};

const uint16_t PROGMEM fn_actions[] = {
    [0] = ACTION_LAYER_MOMENTARY(2),                  // FN0, momentarily switch between layer 1 and 2 (greek lower and upper)

    [1] = ACTION_MACRO(THETA),                        // Macros for greek letters --> Unicode format
    [2] = ACTION_MACRO(OMEGA),
    [3] = ACTION_MACRO(EPSILON),
    [4] = ACTION_MACRO(XI),
    [5] = ACTION_MACRO(TAU),
    [6] = ACTION_MACRO(PSI),
    [7] = ACTION_MACRO(MU),
    [8] = ACTION_MACRO(IOTA),
    [9] = ACTION_MACRO(OMICRON),
    [10] = ACTION_MACRO(RHO),
    [11] = ACTION_MACRO(ALPHA),
    [12] = ACTION_MACRO(SIGMA),
    [13] = ACTION_MACRO(DELTA),
    [14] = ACTION_MACRO(UPSILON),
    [15] = ACTION_MACRO(GAMMA),
    [16] = ACTION_MACRO(PI),
    [17] = ACTION_MACRO(PHI),
    [18] = ACTION_MACRO(KAPPA),
    [19] = ACTION_MACRO(LAMBDA),
    [20] = ACTION_MACRO(ZETA),
    [21] = ACTION_MACRO(CHI),
    [22] = ACTION_MACRO(NU),
    [23] = ACTION_MACRO(BETA),
    [24] = ACTION_MACRO(ETA),

    [31] = ACTION_LAYER_TAP_KEY(3, KC_BSLS),          // FN31, switch to mouse and media keymap
};

// use unicodes to input non-standard characters: D(LALT), T(PPLS), T(P3), T(B), T(P8), U(LALT) = U+03B8 / x3B8 for lower case theta

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    switch (id) {
        case THETA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P8), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P8), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case OMEGA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P9), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P9), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case EPSILON:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P5), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P5), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case XI:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(E), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(E), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case TAU:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P4), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P4), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case PSI:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P8), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P8), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case MU:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(C), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(C), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case IOTA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P9), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P9), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case OMICRON:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(F), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(F), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case RHO:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P1), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P1), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case ALPHA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P1), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P1), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case SIGMA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P3), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P3), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case DELTA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P4), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P4), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case UPSILON:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P5), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P5), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case GAMMA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P3), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P3), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case PI:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P0), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P0), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case PHI:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P6), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P6), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case KAPPA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(A), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(A), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case LAMBDA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(B), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(B), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case ZETA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P6), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P6), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case CHI:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(A), T(P7), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(C), T(P7), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case NU:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(D), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(D), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case BETA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P2), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P2), U(LALT), END ) :
                    MACRO_NONE );
            #endif

        case ETA:
            #if ((layer_state | default_layer_state) & (1<<2))
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(P9), T(P7), U(LALT), END ) :
                    MACRO_NONE );
            #else
            return (record->event.pressed ?
                    MACRO( I(0), D(LALT), T(PPLS), T(P3), T(B), T(P7), U(LALT), END ) :
                    MACRO_NONE );
            #endif
    }
    return MACRO_NONE;
}


The code is based on Hasu's keymap, with a default layer (0), and a key to switch to a mouse/media layer, which I switched to layer 3 with FN31 instead of layer 1 with FN0.

I intend to switch to my greek symbols layout via Magic+1/F1 command so that it does not go by accident.
In the first layer (lower case greek symbols, layer 1) I switched out the RSHIFT and LSHIFT with Fn0, making this key temporarily switch to layer 2 - with all the keys the same (TRNS).

In my macro, I test if the current layer is 2 or not (thanks Hasu!) and depending on the answer, I make the macro input the unicode for either lower or upper case greek letter. Hopefully this works (should get my pro micro clones sometime next weekend to test), and if anybody wishes to use this feel free!
Title: Re: ADB to USB keyboard converter
Post by: goflo on Tue, 12 April 2016, 10:04:39
I forgot the KEYMAP=iso, now it fits much better. I tweaked the iso mapping a bit (see below).
One key refuses to give me some output, the key right of the left shift key (> <) that is labeled "NUBS" in the layout.
But if I use xev and press the key I get the following output:

Code: [Select]
KeyPress event, serial 37, synthetic NO, window 0x4000001,
    root 0x1de, subw 0x0, time 3623194, (24,-59), root:(766,381),
    state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) ""
    XmbLookupString gives 1 bytes: (1b) ""
    XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4000001,
    root 0x1de, subw 0x0, time 3623314, (50,-47), root:(792,393),
    state 0x0, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) ""
    XFilterEvent returns: Fals

The layout used is this one:

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

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* Layer 0: QWERTZ Layout */
    KEYMAP_EXT_ISO(
    ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,          PSCR,SLCK,PAUS,                   MUTE,
    ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,    INS, HOME,PGUP,    NLCK,PEQL,PSLS,PAST,
    TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,ENT,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,NUHS,                            P4,  P5,  P6,  PPLS,
    LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     RSFT,         UP,           P1,  P2,  P3,
    LCTL,LALT,FN0,          SPC,                               RALT,RALT,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
    ),
    /* Layer 1: */
    KEYMAP_EXT_ISO(
    TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         TRNS,TRNS,TRNS,                  TRNS,
    TRNS, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10,  F11,F12, DEL,     TRNS,TRNS,TRNS,   TRNS,TRNS,TRNS,TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,   TRNS,TRNS,TRNS,   TRNS,  TRNS,  TRNS,  TRNS,
    TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,                          TRNS,  TRNS,  TRNS,  TRNS,
    TRNS,RALT,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,             VOLU,        TRNS,  TRNS,  TRNS,
    TRNS,TRNS,TRNS,          TRNS,                           TRNS,TRNS,        TRNS,VOLD,MUTE,   TRNS,    TRNS,TRNS
    ),
};

const uint16_t PROGMEM fn_actions[] = {
     /* QWERTZ Layout */
    [0] = ACTION_LAYER_MOMENTARY(1),  // to Fn over
};

Maybe someone has got an idea, why the keypress isn't recognized by the firmware.
All other keys are functional.

Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 13 April 2016, 00:00:00
goflo,

Very old bug, seems I failed to fix that.
https://github.com/tmk/tmk_keyboard/issues/35

This is patch for this to swap K32 and K0A. I'll update repository soon.
Quote

diff --git a/converter/adb_usb/keymap_common.h b/converter/adb_usb/keymap_common.h
index bdca38e..c11a4b3 100644
--- a/converter/adb_usb/keymap_common.h
+++ b/converter/adb_usb/keymap_common.h
@@ -93,10 +93,10 @@ extern const uint16_t fn_actions[];
  */
 #define KEYMAP_EXT_ISO( \
     K35,  K7A,K78,K63,K76, K60,K61,K62,K64, K65,K6D,K67,K6F, K69,K6B,K71,              K7F, \
-    K32,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74,  K47,K51,K4B,K43, \
+    K0A,K12,K13,K14,K15,K17,K16,K1A,K1C,K19,K1D,K1B,K18,K33, K72,K73,K74,  K47,K51,K4B,K43, \
     K30,K0C,K0D,K0E,K0F,K11,K10,K20,K22,K1F,K23,K21,K1E,K24, K75,K77,K79,  K59,K5B,K5C,K4E, \
     K39,K00,K01,K02,K03,K05,K04,K26,K28,K25,K29,K27,K2A,                   K56,K57,K58,K45, \
-    K38,K0A,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,    K7B,     K3E,      K53,K54,K55,     \
+    K38,K32,K06,K07,K08,K09,K0B,K2D,K2E,K2B,K2F,K2C,    K7B,     K3E,      K53,K54,K55,     \
     K36,K3A,K37,        K31,                        K7C,K7D, K3B,K3D,K3C,  K52,    K41,K4C  \
 ) { \
     { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07 }, \

EDIT: pushed this fix to github repository (and add untested M0118 keymap)
Title: Re: ADB to USB keyboard converter
Post by: goflo on Wed, 13 April 2016, 11:06:28
Yes !!!!   Thanks alot.  :thumb:
M0118 German layout working fine now.
What a fine little keyboard  :D
Title: Re: ADB to USB keyboard converter
Post by: alh84001 on Wed, 04 May 2016, 04:08:06
I don't have a 1k resistor with me right now, but I have two 1.5k available. Would either of 1.5k or 750 pull-up work?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 04 May 2016, 04:46:24
Either of them will work. Just try it and report.
Title: Re: ADB to USB keyboard converter
Post by: alh84001 on Wed, 04 May 2016, 10:52:47
Yep. 1.5k resistor worked splendidly (I didn't try 750 setup). Thanks!
Title: Re: ADB to USB keyboard converter
Post by: guster11 on Wed, 04 May 2016, 12:39:18
Has anyone had any issues with dfu-programmer on windows? I have installed the drivers for libusb after it first wouldn't start due due to the lack of that. Now whenever I try to run the program, it opens and instantly closes. I can't make without it so I am sort of stuck at the moment.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 04 May 2016, 17:09:53
How do you run the program? I afraid you double click it :)
Title: Re: ADB to USB keyboard converter
Post by: guster11 on Wed, 04 May 2016, 18:14:10
How do you run the program? I afraid you double click it :)

I am trying to use the precompiled version that has an exe, so admittedly I had tried that.  :))

 I also tried running as an admin to no luck, should I be opening it through cygwin?
Title: Re: ADB to USB keyboard converter
Post by: need on Sun, 08 May 2016, 08:38:33
Will the same pre-made converter works with M0116 and AEKII ISO and AEKII ANSI at the same time (no need for changing the hex file if I keep swapping keyboards) ?

EDIT: also, can someone please let know how do I do this part :

To build firmware:

$ make -f Makefile clean
$ make -f Makefile

Is this a code to put in ? I'm so frustrated in trying to build my converter... :-\
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 08 May 2016, 18:10:27
Yes, the converrter should work with all ADB keyboads, ISO keyboards have weird swap keys but it still works. You may want to use ISO keymap though.
https://github.com/tmk/tmk_keyboard/issues/35

The first of make comamnd removes compiled firmware files created by previous run and second one creates compiled firmware binary. You can flash the binary into your converter with your favorite tool.

$ mkae -f Makefile dfu

This will work for you if you installed dfu-programmer. Did you read the doc? :(
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/build.md#2-program-with-dfu-bootloader
Title: Re: ADB to USB keyboard converter
Post by: alh84001 on Mon, 09 May 2016, 00:47:56
Also, if you are using pro micro it has ATmega32u4, so use the rev1 makefile.

Code: [Select]
make -f Makefile.rev1
Took me some 15 minutes to figure out why nothing was happening when I ran make with vanilla file  :))

@hasu would editing vanilla Makefile to change the target make it work with Pro Micro or are there other differences?
Title: Re: ADB to USB keyboard converter
Post by: need on Mon, 09 May 2016, 07:26:23
Yes I'm using a pro micro, and now I tried the rev1 command, but it shows up this  :-\:
Does anyone know what's happening ? I got dfu programmer installed (flashes and closed when I try to open it).
Title: Re: ADB to USB keyboard converter
Post by: orihalcon on Fri, 20 May 2016, 19:33:16
Hello All,

I just started using Hasu's awesome ADB converter and it's an all around great project!

Does anyone know how to go about updating hex file after getting it into bootloader mode using the bootloader magic key?

I am using a Pro Micro.

I was able to get to the bootloader mode as evidenced by the output in HID listen when using Power Key + Pause, but then it just reboots after about 5 seconds.

During the short time  showing up while it is in the bootloader, so I can't program it with Arduino Builder since I don't see a new COM port show up.

Main reason for wanting to do this is for those that have their Arduinos mounted inside their case so that a manual reset doesn't need to be done each time you want to modify the firmware.

Anyone else have success with a Pro Micro and the bootloader magic key, and if so, how is it done?

Thanks in advance!
Title: Re: ADB to USB keyboard converter
Post by: hasu on Fri, 20 May 2016, 19:57:09
It seems Power+Pause jumps the controller into bootlaoder mode successfully but the bootloader runs keyboard application immediately for some reason.
I guess Pro Micro's bootloader checks some condition to decide if it stays in bootloader or starts application code. It is maybe magic number in somewhere in SRAM.
You have to meet the condition before jumping to bootloader with the magic key combo.

This is related to this topic.
https://github.com/tmk/tmk_keyboard/issues/256

EDIT: this codes is what you need, methink.
https://github.com/ahtn/tmk_keyboard/commit/773d609bd87d15bb48b3176209c2e2db0b2db178#diff-15c696338fb35b3fa3201e97e19ece2eR112
Title: Re: ADB to USB keyboard converter
Post by: orihalcon on Sun, 22 May 2016, 13:50:53
Yeah, that looks like what I need, though I'm not sure how to implement it.  I assume those lines need to get copied into a certain file?  Once that's done, is it the same bootloader magic combination to test if it works? Thanks!
Title: Re: ADB to USB keyboard converter
Post by: need on Tue, 24 May 2016, 16:51:56
EDIT: My other machine (Win7 32bit) works nicely ! But my daily machine (Win7 64bit) doesn't work...
Thank you hasu, it works perfectly with my ISO AEKII  :D

I've finally put everything together using a teensy, but it doesn't work.

I thought everything have went smoothly, but the keyboard doesn't register any key strokes.
When I plugged it in, the numlock, caps lock and scroll lock LED lights flashed once.

There's nothing happens when the keyboard is plugged in, only the converter is recognised by the computer. (Win7)

Here are some photos, it takes so long to install driver, but finally everything has the green tick next to them.

Thank you !
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 24 May 2016, 17:22:22
EDIT: My other machine (Win7 32bit) works nicely ! But my daily machine (Win7 64bit) doesn't work...
Thank you hasu, it works perfectly with my ISO AEKII  :D

Congrat!
EDIT: As for Windows problem try removing all of drivers related to the converter, or chainging VID and PID.
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#2-remove-drivers-from-device-managerwindows

BTW,
The converter supports ISO layout by autodetect layout now. I think it should work :D With this one firmware can work with both ANSI and ISO. Anyone with both keyboards, test it!
https://github.com/tmk/tmk_keyboard/commit/49f44a2aedce6d727d9e6aa7998e766b899c6eda
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 24 May 2016, 17:29:57
Yeah, that looks like what I need, though I'm not sure how to implement it.  I assume those lines need to get copied into a certain file?  Once that's done, is it the same bootloader magic combination to test if it works? Thanks!

You can place it in your own keymap as athn did, or replace this function with the code.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/avr/bootloader.c#L99
Title: Re: ADB to USB keyboard converter
Post by: need on Tue, 24 May 2016, 19:47:16
I tried the new firmware, but the output keys are the same...meaning some keys are incorrect on the ISO.

Or did I get this wrong?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 24 May 2016, 19:53:50
I tried the new firmware, but the output keys are the same...meaning some keys are incorrect on the ISO.

Or did I get this wrong?

I'm not sure but  thanks for your testing. Seems that we need another testers!
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 24 May 2016, 20:29:23
I tried the new firmware, but the output keys are the same...meaning some keys are incorrect on the ISO.

Or did I get this wrong?

I found a bug. Can you test it again with the latest code on github?
And let me know your ISO keyboard's handler_id with using 'hid_listen' tool if possible. You will see handler_id on hid_listen at startup.
Title: Re: ADB to USB keyboard converter
Post by: need on Wed, 25 May 2016, 12:32:18
I tried the newest one, there are three two keystrokes incorrect (but I personally don't use those keys at all...)

[attach=1]
Sorry I don't know what those are called:
1. Both keys in RED gives the same keys as ORANGE
2.    \   in BLUE gives  `  instead
I think this is correct.
Actually I got a question, do you know why ` looks like \  on the keycap?
[attach=3]

For hid_listen, it got stuck here forever:
[attachimg=2]

By the way, the deleting all drivers method works like a charm, and now it's being typed on my main computer. Thanks!
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 25 May 2016, 20:13:17
Thanks for testing this.

Quote
For hid_listen, it got stuck here forever:

Open hid_listen, after that plug-in, you will see output like this.


Listening:
handler_id: 01 -> 01
Keyboard start.

Title: Re: ADB to USB keyboard converter
Post by: vulgris on Fri, 27 May 2016, 09:20:32
Hey guys,

first of all i want to thank you for these impressive work.
It inspired me, to buy a cheap AEK II on eBay and work my own into this thing.

As far as im not good im programming stuff, I asked my friend to do the coding for me.
He took the code and compiled it and packed it on an MicroPro. He said that it is now recognized as an Converter under Linux.
I first stick it into my machine (iMac 21 2015 El Capitan) and there was no reaction at all. The code was not modified at all.

Could there be a problem with the coding? Should the code have been adapted?
Is there any problem, or why don't i get any information by plugging the converter on?

The next strange thing is that when i plug the converter on (wired as you can see in this picture) the status lamps of the AEK II flash for one sec and then get dark.
No other reaction here. I could not stroke a single key or something.

(http://i.imgur.com/PGTJD3K.jpg)

(http://i.imgur.com/3Z5gSNd.jpg)

Is there any kind of wrong wiring or should i use another pull-up-resistor? (now 1K)

Would be glad if you could help me out.

Thanks so far for your help!
Title: Re: ADB to USB keyboard converter
Post by: need on Fri, 27 May 2016, 18:07:01
Quote

And let me know your ISO keyboard's handler_id with using 'hid_listen' tool if possible. You will see handler_id on hid_listen at startup.

[attach=1]

I just wanna know... why do you need this?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Fri, 27 May 2016, 19:27:51
need, thank you. handler id of your keyboard is 5 originally(and the converter changes to 3) to support extended function. You can know whether the keyboard is ANSI or ISO from the id and swap weird scan codes for ISO.
https://github.com/tmk/tmk_keyboard/issues/35
https://github.com/tmk/tmk_keyboard/commit/f43a2df7614503708818c258439d3a7c90d65e95#diff-8afe7f90ed21578b25dd1ad5fe82c810R77

vulgris, wiring looks good, I guess your board is 3.3V version? you need 5V one.
Title: Re: ADB to USB keyboard converter
Post by: vulgris on Sat, 28 May 2016, 06:52:49
Hey hasu,

thanks for the fast reply.

As far as my eBay contact described it should be a 5V version.
Any other suggestions?

Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 28 May 2016, 07:26:36
Is it recognized as a keyboard on your PC? If so check your wiring again. If not measure voltage of vcc with dmm to check if it is really 5v.

Sent from my Nexus 5X using Tapatalk

Title: Re: ADB to USB keyboard converter
Post by: alh84001 on Mon, 30 May 2016, 04:08:59
It looks to me from the pic that J1 jumper is connected, so it should be 5V.

On one of these that I have inputs simply don't work. I can program the LEDs for instance, but any input is just ignored on the I/O pins (don't know for output). @vulgris have you tried using it with any other board/firmware to check if it works?
Title: Re: ADB to USB keyboard converter
Post by: vulgris on Thu, 02 June 2016, 07:41:28
Thanks for the comments guys.

I tryed a Teensy 2.0 and everything works fine. No problem now.
Think there was a problem with the compiled code for the MicroPro.

My mac now recognizes the adb converter and all keys are functional.

The only thing that is strange is that the status lamps such as num roll or caps will not shine.
There is no reaction when Im for example activate the caps mode. This only happens under OSX (El capitan btw).

When I use the converter under Linux all the lamps are functional. The converter even switches the keyboard layout from German to English (because of my Linux OS).

Ar there any suggestions what this problem could cause and what I could do about it? Is it only a software thing?

Thanks for the great help so far! And sorry for my sh**** english =)
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 04 June 2016, 09:56:17
UPDATE:
Code was updated in repository and Apple Adjustable Keyboard's volume keys are supported now.
https://github.com/tmk/tmk_keyboard/issues/130#issuecomment-223759515
Title: Re: ADB to USB keyboard converter
Post by: Aran.E99 on Thu, 23 June 2016, 19:58:00
hey guys,

I'm new here  :p , but certainly not to the keyboard community. I'm not a programming whiz considering i'm younger however I know soldering, and all the hardware behind the project (already done). this is a very... basic question that may have an obvious answer. basically i have my teensy 2.0 all wired up etc. but i'm not sure how to get all the code files onto my teensy. I know that a loader is necessary (i have one) but i can't seem to get it working. what i am asking is can anyone briefly guide me guide me through the steps. with the loader it wants me to import a .hex image. to do this would I get all the '.c' and '.h' files from the github page and then compile them and format it to a .hex?. sorry if i was brief but i have been up all night working this out. Also, if there are instructions somewhere, i certainly don't know about them and if that is the case, i am deeply sorry for my ignorance, i am more of a 'get it done fast' guy

Thanks a lot guys,
-Aran
Title: Re: ADB to USB keyboard converter
Post by: Aran.E99 on Sat, 25 June 2016, 16:45:56
deeply sorry for my ignorance, I have found the correct way to do it realizing the tutorial was there waiting for me. either way I am about to test it.

Aran
Title: Re: ADB to USB keyboard converter
Post by: chaos_jockey on Thu, 11 August 2016, 15:49:00
I'm ignorant, this all works with the Apple Adjustable Keyboard (and it's numpad extension) with a teensy 2.0 ++, correct?

I got it all compiled and flashed but when I hook everything up and plug it in there isn't any output. Windows detects the HID and the teensy flashes whenever I press a key.

I can post pictures of my setup but I promise you I made sure the wiring and resistor is all correct. The only different thing I did was plug jumper wires into the adb socket on the keyboard then plug 'em into a breadboard with the teensy.

I just grabbed a spare s-video cable to replace the jumper wires but it's quite long (planning on shortening it), and I don't want to harvest my only ADB cables. We'll see how that goes, just wanted to post about my complication to see if somebody could enlighten me.

I am willing to solder directly to the keyboards pcb but only as a last resort.
Title: Re: ADB to USB keyboard converter
Post by: Aran.E99 on Thu, 11 August 2016, 19:06:19
I'm ignorant, this all works with the Apple Adjustable Keyboard (and it's numpad extension) with a teensy 2.0 ++, correct?

I got it all compiled and flashed but when I hook everything up and plug it in there isn't any output. Windows detects the HID and the teensy flashes whenever I press a key.

I can post pictures of my setup but I promise you I made sure the wiring and resistor is all correct. The only different thing I did was plug jumper wires into the adb socket on the keyboard then plug 'em into a breadboard with the teensy.

I just grabbed a spare s-video cable to replace the jumper wires but it's quite long (planning on shortening it), and I don't want to harvest my only ADB cables. We'll see how that goes, just wanted to post about my complication to see if somebody could enlighten me.

I am willing to solder directly to the keyboards pcb but only as a last resort.

sure you have the ADB pinout correct?

maybe you have accidentally connected the wrong pin / connected to multiple pins on the teensy?
Title: Re: ADB to USB keyboard converter
Post by: chaos_jockey on Fri, 12 August 2016, 09:12:11
I'm ignorant, this all works with the Apple Adjustable Keyboard (and it's numpad extension) with a teensy 2.0 ++, correct?

I got it all compiled and flashed but when I hook everything up and plug it in there isn't any output. Windows detects the HID and the teensy flashes whenever I press a key.

I can post pictures of my setup but I promise you I made sure the wiring and resistor is all correct. The only different thing I did was plug jumper wires into the adb socket on the keyboard then plug 'em into a breadboard with the teensy.

I just grabbed a spare s-video cable to replace the jumper wires but it's quite long (planning on shortening it), and I don't want to harvest my only ADB cables. We'll see how that goes, just wanted to post about my complication to see if somebody could enlighten me.

I am willing to solder directly to the keyboards pcb but only as a last resort.

sure you have the ADB pinout correct?

maybe you have accidentally connected the wrong pin / connected to multiple pins on the teensy?
(http://uploads.tapatalk-cdn.com/20160812/a67281203d6b469ae66874d47d01c5c8.jpg)

Sent from my SM-G935V using Tapatalk

Title: Re: ADB to USB keyboard converter
Post by: Aran.E99 on Fri, 12 August 2016, 09:33:59
I'm ignorant, this all works with the Apple Adjustable Keyboard (and it's numpad extension) with a teensy 2.0 ++, correct?

I got it all compiled and flashed but when I hook everything up and plug it in there isn't any output. Windows detects the HID and the teensy flashes whenever I press a key.

I can post pictures of my setup but I promise you I made sure the wiring and resistor is all correct. The only different thing I did was plug jumper wires into the adb socket on the keyboard then plug 'em into a breadboard with the teensy.

I just grabbed a spare s-video cable to replace the jumper wires but it's quite long (planning on shortening it), and I don't want to harvest my only ADB cables. We'll see how that goes, just wanted to post about my complication to see if somebody could enlighten me.

I am willing to solder directly to the keyboards pcb but only as a last resort.

sure you have the ADB pinout correct?

maybe you have accidentally connected the wrong pin / connected to multiple pins on the teensy?
Show Image
(http://uploads.tapatalk-cdn.com/20160812/a67281203d6b469ae66874d47d01c5c8.jpg)


Sent from my SM-G935V using Tapatalk

the wiring looks fine, maybe you have one of those 'booby trap' breadboards where the rows are connected? it's rare but i have bought faulty breadboard before off of ebay. try connecting the wires directly to the pins so that we can rule out that however its highly unlikely. if not, it may be that your code is faulty, double check you compiled correctly and that you used teensy loader correctly (unless you used something different).
Title: Re: ADB to USB keyboard converter
Post by: chaos_jockey on Fri, 12 August 2016, 10:30:48
Attached the jumpers and resistors directly to the teensy and it hasn't made a difference. Gave hid_listen a try and here's the output:

Waiting for new device:.....
Listening:
Before init:
After init:
debug enabled.
Keyboard start.

Pressing keys doesn't do anything.

The only thing I've edited are these lines in Makefile.teensy

line   69 MCU = at90usb1286
line 124 OPT_DEFS += -DBOOTLOADER_SIZE=4096
Title: Re: ADB to USB keyboard converter
Post by: Aran.E99 on Fri, 12 August 2016, 10:45:19
Attached the jumpers and resistors directly to the teensy and it hasn't made a difference. Gave hid_listen a try and here's the output:

Waiting for new device:.....
Listening:
Before init:
After init:
debug enabled.
Keyboard start.

Pressing keys doesn't do anything.

The only thing I've edited are these lines in Makefile.teensy

line   69 MCU = at90usb1286
line 124 OPT_DEFS += -DBOOTLOADER_SIZE=4096

ok, that is odd. i would recommend starting the makefile from fresh in case you accidentally put down the wrong code.
Title: Re: ADB to USB keyboard converter
Post by: chaos_jockey on Fri, 12 August 2016, 10:51:57
Attached the jumpers and resistors directly to the teensy and it hasn't made a difference. Gave hid_listen a try and here's the output:

Waiting for new device:.....
Listening:
Before init:
After init:
debug enabled.
Keyboard start.

Pressing keys doesn't do anything.

The only thing I've edited are these lines in Makefile.teensy

line   69 MCU = at90usb1286
line 124 OPT_DEFS += -DBOOTLOADER_SIZE=4096

ok, that is odd. i would recommend starting the makefile from fresh in case you accidentally put down the wrong code.
Not to sound snarky but I literally did that minutes before my last post just to make sure.

Sent from my SM-G935V using Tapatalk

Title: Re: ADB to USB keyboard converter
Post by: Aran.E99 on Fri, 12 August 2016, 11:00:33
Attached the jumpers and resistors directly to the teensy and it hasn't made a difference. Gave hid_listen a try and here's the output:

Waiting for new device:.....
Listening:
Before init:
After init:
debug enabled.
Keyboard start.

Pressing keys doesn't do anything.

The only thing I've edited are these lines in Makefile.teensy

line   69 MCU = at90usb1286
line 124 OPT_DEFS += -DBOOTLOADER_SIZE=4096

ok, that is odd. i would recommend starting the makefile from fresh in case you accidentally put down the wrong code.
Not to sound snarky but I literally did that minutes before my last post just to make sure.

Sent from my SM-G935V using Tapatalk

being honest, that is all i can really think of that could've gone wrong. i'm sure that your chip is supported but the only other thing i can recommend is either buying s new teensy or testing it on another pc.
Title: Re: ADB to USB keyboard converter
Post by: chaos_jockey on Fri, 12 August 2016, 11:06:59
Attached the jumpers and resistors directly to the teensy and it hasn't made a difference. Gave hid_listen a try and here's the output:

Waiting for new device:.....
Listening:
Before init:
After init:
debug enabled.
Keyboard start.

Pressing keys doesn't do anything.

The only thing I've edited are these lines in Makefile.teensy

line   69 MCU = at90usb1286
line 124 OPT_DEFS += -DBOOTLOADER_SIZE=4096

ok, that is odd. i would recommend starting the makefile from fresh in case you accidentally put down the wrong code.
Not to sound snarky but I literally did that minutes before my last post just to make sure.

Sent from my SM-G935V using Tapatalk

being honest, that is all i can really think of that could've gone wrong. i'm sure that your chip is supported but the only other thing i can recommend is either buying s new teensy or testing it on another pc.
Aside from using a multimeter to test if it has power, is there any other way I can test if it's fried without an old Mac or buying an adb to usb adapter? Since buying one would defeat the purpose.

Has anyone wrote something that flashes the led on the teensy when a key is pressed? That could more or less test if it's fried, yeah?

Sent from my SM-G935V using Tapatalk
Title: Re: ADB to USB keyboard converter
Post by: hasu on Fri, 12 August 2016, 20:06:29
I'm ignorant, this all works with the Apple Adjustable Keyboard (and it's numpad extension) with a teensy 2.0 ++, correct?

I got it all compiled and flashed but when I hook everything up and plug it in there isn't any output. Windows detects the HID and the teensy flashes whenever I press a key.

I can post pictures of my setup but I promise you I made sure the wiring and resistor is all correct. The only different thing I did was plug jumper wires into the adb socket on the keyboard then plug 'em into a breadboard with the teensy.

I just grabbed a spare s-video cable to replace the jumper wires but it's quite long (planning on shortening it), and I don't want to harvest my only ADB cables. We'll see how that goes, just wanted to post about my complication to see if somebody could enlighten me.

I am willing to solder directly to the keyboards pcb but only as a last resort.

sure you have the ADB pinout correct?

maybe you have accidentally connected the wrong pin / connected to multiple pins on the teensy?
Show Image
(http://uploads.tapatalk-cdn.com/20160812/a67281203d6b469ae66874d47d01c5c8.jpg)


Sent from my SM-G935V using Tapatalk



I confirmed my firmware works fine with Teensy 2.0++ and Adjustable keyboard,  so I'm 99% sure that your problem is your wiring or hardware now.

Your edited Makefile looks fine, I also used Makefile.teensy just with 'MCU = at90usb1286' like yours. I think bootloader size is not matter either way.

From the pic it looks good on controller side but you could still fail to wire on connector/cable side. Or your keyboard, cable or Teensy also can have defect certainly but I guess not for some reason.

Title: Re: ADB to USB keyboard converter
Post by: chaos_jockey on Fri, 12 August 2016, 20:14:57
I'm ignorant, this all works with the Apple Adjustable Keyboard (and it's numpad extension) with a teensy 2.0 ++, correct?

I got it all compiled and flashed but when I hook everything up and plug it in there isn't any output. Windows detects the HID and the teensy flashes whenever I press a key.

I can post pictures of my setup but I promise you I made sure the wiring and resistor is all correct. The only different thing I did was plug jumper wires into the adb socket on the keyboard then plug 'em into a breadboard with the teensy.

I just grabbed a spare s-video cable to replace the jumper wires but it's quite long (planning on shortening it), and I don't want to harvest my only ADB cables. We'll see how that goes, just wanted to post about my complication to see if somebody could enlighten me.

I am willing to solder directly to the keyboards pcb but only as a last resort.

sure you have the ADB pinout correct?

maybe you have accidentally connected the wrong pin / connected to multiple pins on the teensy?
Show Image
(http://uploads.tapatalk-cdn.com/20160812/a67281203d6b469ae66874d47d01c5c8.jpg)


Sent from my SM-G935V using Tapatalk



I confirmed my firmware works fine with Teensy 2.0++ and Adjustable keyboard,  so I'm 99% sure that your problem is your wiring or hardware now.

Your edited Makefile looks fine, I also used Makefile.teensy just with 'MCU = at90usb1286' like yours. I think bootloader size is not matter either way.

From the pic it looks good on controller side but you could still fail to wire on connector/cable side. Or your keyboard, cable or Teensy also can have defect certainly but I guess not for some reason.
Edit: I was looking at my svideo cable backwards.... No fault to you, Hasu. I very much appreciate your help with this.

P.S. Feeling like an idiot >.<

Sent from my SM-G935V using Tapatalk
Title: Re: ADB to USB keyboard converter
Post by: slabdabs on Tue, 23 August 2016, 22:21:01
I've spent the entire day pulling my hair out over this!  :eek:
I'm using a Pro Micro ATMega32u4, I have set in the makefile the proper chip type.
I've checked wiring with a multimeter, on my original cable end, on the female adapter I have on there now, on various ADB cables running through it.
I have a resistor added though that only seemed to solve my mouse moving.

I tested this chip with the HID_Listen blinking script so the chip itself works.
Testing it with the ADB to USB hex will recognize it *should* be a keyboard but still will not take in any inputs.

I've tried with MANY keyboards and cables, I currently have nearly 70 vintage Apple Boards in my living room so I tried a variety of them including knock off that use ADB.

I'd be happy with even incorrect inputs being sent at this point! Does anyone have suggestions or an ATMega32u4 .hex that worked for them I could try?

Edit: Forgot to add I even tried changing the Data line in the makefile and changing where it was actually soldered too. (To FD4)

Thanks!

(http://i.imgur.com/HZUjVpY.jpg)
(http://i.imgur.com/Ifcy79i.jpg)
(http://i.imgur.com/OguXjyU.jpg)
Title: Re: ADB to USB keyboard converter
Post by: slabdabs on Tue, 23 August 2016, 23:44:26
OH LORD
So uhhhh since I had a mega pack of resistors....
(https://usercontent.irccloud-cdn.com/file/8vNFX06x/irccloudcapture-951659913.jpg)

Hugest face palm ever, so now they're alive!!!!!

(https://usercontent.irccloud-cdn.com/file/0lX1pqSK/irccloudcapture-839435272.jpg)
(https://usercontent.irccloud-cdn.com/file/CENGRV7M/irccloudcapture-656743045.jpg)
Title: Re: ADB to USB keyboard converter
Post by: Aran.E99 on Wed, 24 August 2016, 07:22:18
OH LORD
So uhhhh since I had a mega pack of resistors....
Show Image
(https://usercontent.irccloud-cdn.com/file/8vNFX06x/irccloudcapture-951659913.jpg)


Hugest face palm ever, so now they're alive!!!!!

Show Image
(https://usercontent.irccloud-cdn.com/file/0lX1pqSK/irccloudcapture-839435272.jpg)

Show Image
(https://usercontent.irccloud-cdn.com/file/CENGRV7M/irccloudcapture-656743045.jpg)


oh
my
lord

you have a lot of keyboards xD

are they all alps switches?
Title: Re: ADB to USB keyboard converter
Post by: slabdabs on Wed, 24 August 2016, 09:06:54
oh
my
lord

you have a lot of keyboards xD

are they all alps switches?
All of the ones in that picture aside from the few Apple I keyboards are all ALPs, so like 60ish alps boards.
Title: Re: ADB to USB keyboard converter
Post by: alh84001 on Wed, 24 August 2016, 09:18:28
The Adjustable keyboards are not ALPS SKCL/M though. And those smaller ones on the left are Apple Keyboard II, and not Apple ADB Keyboards I believe, and these also don't have Alps. But that lot of 50ish AEK IIs  :eek:
Title: Re: ADB to USB keyboard converter
Post by: slabdabs on Sun, 28 August 2016, 18:40:57
So, I have a 1K Ohm resistor on my adapter and using a Y splitter it appears to run two keyboards just fine!

(https://usercontent.irccloud-cdn.com/file/4xUNvDgO/20160828_173904.jpg)
Title: Re: ADB to USB keyboard converter
Post by: rmwatson on Mon, 05 September 2016, 21:29:20
Hi All,

Great project!

I am giving this one a go myself. Having trouble generating the HEX file on windows. Has anyone seen this error when compiling,

../../tmk_core/common/keymap.c: In function 'keymap_fn_to_action':
../../tmk_core/common/keymap.c:246: internal compiler error: in iterative_hash_expr, at tree.c:5363
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://sourceforge.net/tracker/?atid=520074&group_id=68108&func=browse> for instructions.
make: *** [obj_adb_usb_teensy/common/keymap.o] Error 1



Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 06 September 2016, 14:07:17
Hi All,

Great project!

I am giving this one a go myself. Having trouble generating the HEX file on windows. Has anyone seen this error when compiling,

../../tmk_core/common/keymap.c: In function 'keymap_fn_to_action':
../../tmk_core/common/keymap.c:246: internal compiler error: in iterative_hash_expr, at tree.c:5363
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://sourceforge.net/tracker/?atid=520074&group_id=68108&func=browse> for instructions.
make: *** [obj_adb_usb_teensy/common/keymap.o] Error 1





Try this.
https://github.com/tmk/tmk_keyboard/wiki/Build-firmware-on-VirtualBox
Title: Re: ADB to USB keyboard converter
Post by: rmwatson on Tue, 06 September 2016, 17:12:13
Hi All,

Great project!

I am giving this one a go myself. Having trouble generating the HEX file on windows. Has anyone seen this error when compiling,

../../tmk_core/common/keymap.c: In function 'keymap_fn_to_action':
../../tmk_core/common/keymap.c:246: internal compiler error: in iterative_hash_expr, at tree.c:5363
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://sourceforge.net/tracker/?atid=520074&group_id=68108&func=browse> for instructions.
make: *** [obj_adb_usb_teensy/common/keymap.o] Error 1





Try this.
https://github.com/tmk/tmk_keyboard/wiki/Build-firmware-on-VirtualBox

That worked. Thank you.
Title: Re: ADB to USB keyboard converter
Post by: claimempty on Sat, 10 September 2016, 01:59:41
Hi i've been struggling for the last few hours to get the a abd to usb converter teensy converter to work. The output i get out of hid_listen is this whether the keyboard is plugged in or not.
Code: [Select]
Listening:
Before init:
Scan: addr:1, reg3:FFE2
Scan: addr:2, reg3:FFE2
Scan: addr:3, reg3:FFE2
Scan: addr:4, reg3:FFE2
Scan: addr:5, reg3:FFE2
Scan: addr:6, reg3:FFE2
Scan: addr:7, reg3:FFE2
Scan: addr:8, reg3:FFE2
Scan: addr:9, reg3:FFE2
Scan: addr:10, reg3:FFE2
Scan: addr:11, reg3:FFE2
Scan: addr:12, reg3:FFE2
Scan: addr:13, reg3:FFE2
Scan: addr:14, reg3:FFE2
Scan: addr:15, reg3:FFE2
After init:
Scan: addr:1, reg3:FFE2
Scan: addr:2, reg3:FFE2
Scan: addr:3, reg3:FFE2
Scan: addr:4, reg3:FFE2
Scan: addr:5, reg3:FFE2
Scan: addr:6, reg3:FFE2
Scan: addr:7, reg3:FFE2
Scan: addr:8, reg3:FFE2
Scan: addr:9, reg3:FFE2
Scan: addr:10, reg3:FFE2
Scan: addr:11, reg3:FFE2
Scan: addr:12, reg3:FFE2
Scan: addr:13, reg3:FFE2
Scan: addr:14, reg3:FFE2
Scan: addr:15, reg3:FFE2
debug enabled.
Keyboard start.
adb_host_kbd_recv: ERROR(-30)
I think the wiring is good since the keyboard lights up when plugged in although my soldering is terrible. I also know that i have it in d1 instead of the default d0 but i think I changed the config file properly
Code: [Select]
/* ADB port setting */
#define ADB_PORT        PORTD
#define ADB_PIN         PIND
#define ADB_DDR         DDRD
#define ADB_DATA_BIT    1
//#define ADB_PSW_BIT     1       // optional
thx for the help in advance
Title: Re: ADB to USB keyboard converter
Post by: n_hof on Sun, 11 September 2016, 15:55:41
(http://i.imgur.com/bQiHWvz.jpg)

Keyboard was $3 at resale store, Micro $10 at Radio Shack. 1.7K resistor works perfectly.  Thanks to everyone who provided info in thread!
Title: Re: ADB to USB keyboard converter
Post by: djpyle on Fri, 23 September 2016, 21:35:52
Has anyone else upgraded to macOS Sierra yet? I did, and suddenly my locking caps lock is no longer working. I've tried two different keyboards and two different controllers (a Teensy and a Pro Micro clone), and I get the same results no matter what combination I use. No caps lock and no caps lock light. If I boot into my Yosemite partition though, everything works like it always has. I'm not sure what about Sierra could be causing this, but if anybody has any ideas, I'd love to get it figured out.
Title: Re: ADB to USB keyboard converter
Post by: alh84001 on Sat, 24 September 2016, 03:36:47
From what I've heard, they revamped the keyboard (or the whole input?) system in Sierra. That's the reason Karabiner is not working, so it could have something to do with your issue as well.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 24 September 2016, 05:24:03
Pushing Locking caps  key actually sends press and release of caps lock in short period. No wait between them in current firmware, I guess the wait is needed in some situations.

Try place delay here and see result if possible.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/action.c#L366-L369



Sent from my Nexus 5X

Title: Re: ADB to USB keyboard converter
Post by: alh84001 on Sat, 24 September 2016, 05:46:24
@hasu is that true of all SKCL lock keys in combination with all controllers? E.g. if I were to put a lock key into Omnikey, do you know if it would just work, or would additional converter (controller?) configuration be needed?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 24 September 2016, 05:58:01
@hasu is that true of all SKCL lock keys in combination with all controllers? E.g. if I were to put a lock key into Omnikey, do you know if it would just work, or would additional converter (controller?) configuration be needed?
Omnikey won't work with mechanical locking switch. Yes you need custom controller or converter.

Sent from my Nexus 5X

Title: Re: ADB to USB keyboard converter
Post by: djpyle on Sat, 24 September 2016, 10:27:03
Try place delay here and see result if possible.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/action.c#L366-L369

Success! Including wait.h and adding a wait_ms(100) delay did the trick. Thanks, hasu!
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 24 September 2016, 18:50:37
Try place delay here and see result if possible.
https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/common/action.c#L366-L369

Success! Including wait.h and adding a wait_ms(100) delay did the trick. Thanks, hasu!

Nice. Thanks for reporting!
I'll add some wait on the code in repository.

EDIT: filed the issue. https://github.com/tmk/tmk_keyboard/issues/390
Title: Re: ADB to USB keyboard converter
Post by: stat on Mon, 26 September 2016, 03:52:34
Hello! Thank you for making this. I'm typing from my AEKII now, after following the instructions here: https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/build.md (https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/doc/build.md)

I was trying to revisit the keymapping and possibly change the Power key to something like F16 which I can assign in AutoHotKey. I edited config.h, but kept backups of the original config.h and hex file I generated about a week ago.

When I went to re-make Makefile.rev1, I noticed that I somehow uninstalled avr-gcc. So I got the avr8-gnu-toolchain from Atmel and added its /bin folder to Path. It still didn't recognize it, so I put avr-gcc.exe in the working directory. It saw it, but couldn't find /device-specs/specs-atmega32u4, and I couldn't find a way around that. I had read that WinAVR doesn't always work, but I tried it, and I guess there was some bug so it didn't work.

I still have dfu-programmer and avr-dude, and I believe those both still work. I've been using MinGW on Windows 7. I have an atmega32u4 instead of teensy, and it seems to be working well so far.

Ultimately, this is probably a simple question but I can't remember how I did it before: what's the procedure to installing avr-gcc on Win7?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 26 September 2016, 04:14:14
Not sure exactly what your problem is but you may still want to check wiki for build on Windows.

Or you can just use keymap editor.

Sent from my Nexus 5X

Title: Re: ADB to USB keyboard converter
Post by: stat on Mon, 26 September 2016, 19:11:35
Not sure exactly what your problem is but you may still want to check wiki for build on Windows.

Or you can just use keymap editor.

Sent from my Nexus 5X

Thanks for the quick response! I saw the wiki, which directed me toward build.md which I have been following. I have already edited the keymap in the files. I'm using MinGW/msys for bash commands.

My problem is that I can't use avr-gcc. I have the directory downloaded from Atmel, but I can't get MinGW or my computer to recognize or use it.

I have 8-bit version 3.5.3 from here: http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORWINDOWS.aspx (http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORWINDOWS.aspx)
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 26 September 2016, 19:44:07
That toolchain should work. Just configure your PATH environment variable correctly.

You don't have to move or copy tool chain.

Sent from my Nexus 5X

Title: Re: ADB to USB keyboard converter
Post by: stat on Mon, 26 September 2016, 21:19:51
That toolchain should work. Just configure your PATH environment variable correctly.

You don't have to move or copy tool chain.

Sent from my Nexus 5X

I added avr8-gnu-toolchain\bin to the path variable before, is there anything else?
Title: Re: ADB to USB keyboard converter
Post by: hasu on Mon, 26 September 2016, 21:28:21
That toolchain should work. Just configure your PATH environment variable correctly.

You don't have to move or copy tool chain.

Sent from my Nexus 5X

I added avr8-gnu-toolchain\bin to the path variable before, is there anything else?

Did you add it in .bashrc or something?
If you are familiar with these things, I might be wrong. But if not you have to learn about basic usage of 'bash'.
Title: Re: ADB to USB keyboard converter
Post by: stat on Mon, 26 September 2016, 21:57:56
That toolchain should work. Just configure your PATH environment variable correctly.

You don't have to move or copy tool chain.

Sent from my Nexus 5X

I added avr8-gnu-toolchain\bin to the path variable before, is there anything else?

Did you add it in .bashrc or something?
If you are familiar with these things, I might be wrong. But if not you have to learn about basic usage of 'bash'.

I added it to the Windows environment variable named "Path" in system properties. I usually use git bash or cmd.exe for a command prompt, but the instructions I saw were for MinGW/Cygwin so I used the one of those two I already had.
Title: Re: ADB to USB keyboard converter
Post by: Astrobus on Tue, 27 September 2016, 16:30:31
I've spent the entire day pulling my hair out over this!  :eek:
I'm using a Pro Micro ATMega32u4, I have set in the makefile the proper chip type.
I've checked wiring with a multimeter, on my original cable end, on the female adapter I have on there now, on various ADB cables running through it.
I have a resistor added though that only seemed to solve my mouse moving.

I tested this chip with the HID_Listen blinking script so the chip itself works.
Testing it with the ADB to USB hex will recognize it *should* be a keyboard but still will not take in any inputs.

I've tried with MANY keyboards and cables, I currently have nearly 70 vintage Apple Boards in my living room so I tried a variety of them including knock off that use ADB.

I'd be happy with even incorrect inputs being sent at this point! Does anyone have suggestions or an ATMega32u4 .hex that worked for them I could try?

Edit: Forgot to add I even tried changing the Data line in the makefile and changing where it was actually soldered too. (To FD4)

Thanks!

Show Image
(http://i.imgur.com/HZUjVpY.jpg)

Show Image
(http://i.imgur.com/Ifcy79i.jpg)

Show Image
(http://i.imgur.com/OguXjyU.jpg)


Hi do you mind telling how did you solved your problem if you did?
I am having a similar problem with my setup, I am using a Pro Micro, I was able to reflash it a few times and the led turns on when nothing is soldered to it so I assume that it is not broken.
The keyboard in the other hand is a AEK II that I bought used and have no way of knowing if it worked before or have any way to test it.
When it is wired to the pro micro the leds of the pro micro won't turn on, also the leds of the keyboard do not turn on. The device is not recognised by linux neither.

I have generated the .hex with Makefile.rev1 for old TMK Converter rev.1 because my Pro Micro is Atmega32u4 based.
I have also checked the wiring with the multimeter and it seems to be ok, the resistor is a 1 kohm one.

http://i.imgur.com/3GCy7VF.jpg
http://i.imgur.com/51DW5m9.jpg
http://i.imgur.com/Q7FQ2FR.jpg
http://i.imgur.com/wo2K91o.jpg

If anybody could give a hint where tsomeany kind of help it would be much appreciated.
Title: Re: ADB to USB keyboard converter
Post by: stat on Wed, 28 September 2016, 02:45:22
Hello again, I was able to make the hex file.

I can't get the 32u4 to reset though. When I short RST and GND twice, the device still shows as "Standard PS/2 Keyboard" regardless (so I can't get a COM port number). Neither avrdude nor dfu-programmer could recognize it to flash the hex file.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Wed, 28 September 2016, 16:42:20
Hello again, I was able to make the hex file.

I can't get the 32u4 to reset though. When I short RST and GND twice, the device still shows as "Standard PS/2 Keyboard" regardless (so I can't get a COM port number). Neither avrdude nor dfu-programmer could recognize it to flash the hex file.

Consult with seller or manufacturer.
I think double short method is for Sparkfun firmwarebootloader, it will work if your board use the firmwarebootloader.
Anyway, a bit off topic here.
Title: Re: ADB to USB keyboard converter
Post by: Moistgun on Wed, 28 September 2016, 16:44:12
Random post here, but I have a pretty nice adb to adb cable from an AEK that I have no use for, if anyone is interested, they can have it.
would look nice if you use a converter towards the pc side of the keyboard connection.
Title: Re: ADB to USB keyboard converter
Post by: Norman_the_Owl on Wed, 16 November 2016, 18:13:37
Is it possible to post a generic hex file? I got hung up at the change directory step :'(

I'm apparently nowhere near competent enough to do this

I'm using a pro micro clone on windows for an AEK 2 if it matters...
Title: Re: ADB to USB keyboard converter
Post by: ShawnMeg on Wed, 16 November 2016, 23:45:01
Is it possible to post a generic hex file? I got hung up at the change directory step :'(

I'm apparently nowhere near competent enough to do this

I'm using a pro micro clone on windows for an AEK 2 if it matters...

http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1 (http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1)

This is much easier than trying to compile the files.  You can customize your mapping, function layers, etc.  Then, click the download button about 4/5th's of the way down to obtain your hex.  I used this about a month ago, and it worked great for my converter.
Title: Re: ADB to USB keyboard converter
Post by: Norman_the_Owl on Thu, 17 November 2016, 05:45:01
Is it possible to post a generic hex file? I got hung up at the change directory step :'(

I'm apparently nowhere near competent enough to do this

I'm using a pro micro clone on windows for an AEK 2 if it matters...

http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1 (http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1)

This is much easier than trying to compile the files.  You can customize your mapping, function layers, etc.  Then, click the download button about 4/5th's of the way down to obtain your hex.  I used this about a month ago, and it worked great for my converter.
Ah man, really?

Why wasn't that mentioned on github  :(

Thanks, though
Title: Re: ADB to USB keyboard converter
Post by: 128keaton on Tue, 22 November 2016, 17:15:08
One thing that really tripped me up using the Micro was that you should use the Makefile.rev1 while building. I just got an AEKII and made a beautiful custom key map and I'm loving it!
Title: Re: ADB to USB keyboard converter
Post by: Darkshado on Sat, 17 December 2016, 04:59:06
++numberOfTMKConverters; // :)

That ISO AEK II still needs quite a bit of attention, but I am typing this post with it.

I am observing the swap issue using today's master branch code, with no KEYMAP variable set in the makefile. The keys to the left of '1' and the one between 'left shift' and 'Z' are reverse of what I'd expect. I'll have to look around the code to understand what's going on.

Regards,

Darkshado
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 17 December 2016, 17:40:11
++numberOfTMKConverters; // :)

That ISO AEK II still needs quite a bit of attention, but I am typing this post with it.

I am observing the swap issue using today's master branch code, with no KEYMAP variable set in the makefile. The keys to the left of '1' and the one between 'left shift' and 'Z' are reverse of what I'd expect. I'll have to look around the code to understand what's going on.

Regards,

Darkshado

ISO keyobard autodetection was implemented some ago,
the swap issue should be resolved if your keyboard is recognized as ISO by converter.
https://github.com/tmk/tmk_keyboard/blob/master/converter/adb_usb/matrix.c#L66-L78

Can you post output of 'hid_listen' at startup? I'd like to see value of ADB register 3  these lines print out.
https://github.com/tmk/tmk_keyboard/blob/master/converter/adb_usb/matrix.c#L57-L64
Title: Re: ADB to USB keyboard converter
Post by: Darkshado on Mon, 19 December 2016, 01:04:08
I have a fix for the problem, see pull request #416 (https://github.com/tmk/tmk_keyboard/pull/416).

Sincerely,

Darkshado
Title: Re: ADB to USB keyboard converter
Post by: Norman_the_Owl on Mon, 09 January 2017, 18:17:16
Every now and then I'll have this problem where my converter will either stop working completely or will output the last pressed key continuously. Does this sound like a problem with my converter, or my keyboard, or what?


The pull up resistor is 4.7k, it's all i had on hand. I tried taking some pictures but they weren't clear. I'm not concerned about the construction though, because it works most of the time (typing on it now). Can furnish with photos if you think it's necessary.

Edit: It'll work fine for hours until i start a game, and then it stops working completely. Sometimes it'll also stop outputting, wait a few seconds, and then send everything i've typed all at once. This is extremely frustrating, it behaves really erratically.
Title: Re: ADB to USB keyboard converter
Post by: H3NT4I on Sun, 22 January 2017, 19:52:10
Apple IIgs issues. Have my board wired up properly to the teensy, resistor correctly installed. Loading firmware is straight forward, Teensy flashes no problem then when I go to use it: nada. It shows up as correctly as ADB to USB converter and a HID Keyboard but no keys work whatsoever. Even tried using other .hex files from the thread but no luck, any ideas as to what I could be doing wrong? link to hardware gallery: http://imgur.com/a/03neQ
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sun, 22 January 2017, 20:13:34
WIth quick look pics I'm not sure which pin you are using for DATA.
You should use D0(PD0) pin for DATA with default configuration.
Title: Re: ADB to USB keyboard converter
Post by: H3NT4I on Sun, 22 January 2017, 21:04:33
sure enough, thanks hasu

WIth quick look pics I'm not sure which pin you are using for DATA.
You should use D0(PD0) pin for DATA with default configuration.
Title: Re: ADB to USB keyboard converter
Post by: H3NT4I on Thu, 26 January 2017, 22:20:34
I have my iigs working with ShawnMeg's posted code and it works great but my own coding is less than ideal. I have little experience so here's what i'm working with. When I run git bash and compile my custom keymap it comes out as a file with no extension. I had errors initially compiling with the function action prior but working through it looking at others code I got to this point where it's making a file just not sure where I went wrong. Will continue to read everything I can again and retrace steps. Any assistance is appreciated. 
Code: [Select]
#include "keymap_common.h"


const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | mute  |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +---+---+---+---+
    * |esc| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | bks | |del| = | / | * |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | | 7 | 8 | 9 | + |
    * +-----------------------------------------------------+   | +---+---+---+---+
    * | Fn0  | a | s | d | f | g | h | j | k | l | ; | ' |return| | 4 | 5 | 6 | - |
    * +---------------------------------------------------------+ +---+---+---+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | | 1 | 2 | 3 |   |
    * +---------------------------------------------------------+ +-------+---|ent|
    * |cap|alt|ctrl | ` |                   | \ |lef|rig|dwn|up | |   0   | . |   |
    * +---------------------------------------------------------+ +-------+---+---+
    */
  KEYMAP_M0116_ANSI(
                                     MUTE,                                                           
       ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,   DEL ,EQL, PSLS,PAST,
       TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,        P7,  P8,  P9,  PMNS,
       FN0, A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,    P4,  P5,  P6,  PPLS,
       LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,   P1,  P2,  P3,       
       CAPS, LALT,LCTL,GRV,           SPC,      BSLS,LEFT,RGHT,DOWN,UP,          P0,       PDOT,PENT
),
    /* M0116 Apple Standard Keyboard ANSI
    *                     +-------+
    *                     | mute  |
    *                     +-------+
    * +---+---+---+---+---+---+---+---+---+---+---+---+---+-----+ +----+----+--+-+---+
    * |esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| bks | | ins| hom|end |prt|
    * +---------------------------------------------------------+ +----+----+----+---+
    * | tab | q | w | e | r | t | y | u | i | o | p | [ | ] |   | |    |    |    |pgu|
    * +-----------------------------------------------------+   | +----+----+----+---+
    * | Fn0  | a | s | d | f | g | h | j | k | l | ; | ' |return| |    | up |    |pgd|
    * +---------------------------------------------------------+ +----+----+----+---+
    * | shift  | z | x | c | v | b | n | m | , | . | / |  shift | |left|down|rght|   |
    * +---------------------------------------------------------+ +---------+----|   |
    * |cap|alt|ctrl| clr|                   |ply|prv|nxt|vod|vou| |         |    |   |
    * +---------------------------------------------------------+ +---------+----+---+
    */
  KEYMAP_M0116_ANSI(
                                     TRNS,                                                           
       TRNS,F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10,  F11, F12,TRNS,    INS,HOME ,END ,PSCR,
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,         NO  ,NO  ,NO  ,PGUP,
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,     TRNS,    NO  ,UP  ,NO  ,PGDN,
       TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,          TRNS,    LEFT,DOWN,RGHT,     
       TRNS,TRNS,TRNS,TRNS,          TRNS,     MPLY,MPRV,MNXT,VOLD,VOLU,         NO  ,     NO  ,NO 
),
};

const action_t PROGMEM fn_actions[] = {
  [0] = ACTION_LAYER_MOMENTARY(1),             
};     

EDIT: Got it. fiddle enough days with Code and eventually you'll get there.
Title: Re: ADB to USB keyboard converter
Post by: happylacquer on Sat, 04 February 2017, 03:00:18
I am trying to flash a Sparkfun Pro micro a friend sent me with adb_usb firmware. I can flash it with avrdude, but then when I plug it into any linux or windows machine, it doesn't recognize *any* USB as having been plugged in. What should I do? lsusb in linux shows nothing...

Edit: I have come to the conclusion that despite flashing the right adb_usb.hex, it must have flashed for a 3.3v/8mhz unit or else something else is wrong. Either way, i need to get it back so any computer can recognize it. I have been trying to do the reset procedure involving the Arduino IDE but it never finishes flashing the test program on... and I'm not sure it's seeing the right COM port either (COM3 and COM4 are always available in the menu and never change)

If the pro micro is just a piece of garbage what should i get instead?
Title: Re: ADB to USB keyboard converter
Post by: need on Sat, 04 February 2017, 19:19:23
Does anyone know how to turn the numpad on a M0116 into a navigation layer (pgup/pgdn, home/end) ?
Title: Re: ADB to USB keyboard converter
Post by: Tactile on Sat, 04 February 2017, 19:55:07
If the pro micro is just a piece of garbage what should i get instead?

One of these (https://www.pjrc.com/store/teensy.html). Or you can buy one here (https://www.adafruit.com/products/199).
Title: Re: ADB to USB keyboard converter
Post by: happylacquer on Sat, 04 February 2017, 23:16:38
If the pro micro is just a piece of garbage what should i get instead?

One of these (https://www.pjrc.com/store/teensy.html). Or you can buy one here (https://www.adafruit.com/products/199).

Great price, thanks a billion. About 9-10 hours total of messing with this 4 dollar pro micro and it just bricks constantly  >:D
Title: Re: ADB to USB keyboard converter
Post by: hasu on Sat, 04 February 2017, 23:28:01
If the pro micro is just a piece of garbage what should i get instead?

One of these (https://www.pjrc.com/store/teensy.html). Or you can buy one here (https://www.adafruit.com/products/199).

Great price, thanks a billion. About 9-10 hours total of messing with this 4 dollar pro micro and it just bricks constantly  >:D

I don't think it is Sparkfun Pro Micro. It costs $19.95, not cheap like that.
https://www.sparkfun.com/products/12640

It is not important whether it is genuine Sparkfun or not, though.
Title: Re: ADB to USB keyboard converter
Post by: happylacquer on Sun, 05 February 2017, 01:01:03
If the pro micro is just a piece of garbage what should i get instead?

One of these (https://www.pjrc.com/store/teensy.html). Or you can buy one here (https://www.adafruit.com/products/199).

Great price, thanks a billion. About 9-10 hours total of messing with this 4 dollar pro micro and it just bricks constantly  >:D

I don't think it is Sparkfun Pro Micro. It costs $19.95, not cheap like that.
https://www.sparkfun.com/products/12640

It is not important whether it is genuine Sparkfun or not, though.

I am trying to flash adb_usb.hex with

Code: [Select]
-c avr109 -p m32u4 -F -e -I flash:w:adb_usb.hex:a -U eeprom:w:adb_usb.eep:a

With or without the eep file specified it still  bricks and will not be recognized by either windows or linux except for the 8 second bootloader window...
Title: Re: ADB to USB keyboard converter
Post by: PancakeMSTR on Thu, 23 February 2017, 00:33:27
I'm not gonna lie the instructions for doing this are cryptic, to say the least.

I have an AEKII, and an arduino pro-micro clone with an atmega32u4. What do I do? What firmware do I install and how?
Title: Re: ADB to USB keyboard converter
Post by: alh84001 on Thu, 23 February 2017, 08:20:01
@happylacquer, did you add a pull-up resistor?

@PancakeMSTR have you read everything at https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb? For pro micro you have to use Makefile.rev1 makefile.
Title: Re: ADB to USB keyboard converter
Post by: PancakeMSTR on Thu, 23 February 2017, 11:29:40
@happylacquer, did you add a pull-up resistor?

@PancakeMSTR have you read everything at https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb? For pro micro you have to use Makefile.rev1 makefile.

Yeah I've read a lot of it, didn't know I'd have to use makefile.rev1

I'm really not sure if I installed the DFG tools correctly, or crosspack, or even if my pro micro is in bootloader mode. I can't load anything on it, I'll run

make -f Makefile dfu

and then get the following

sh: dfu-programmer: command not found
sh: dfu-programmer: command not found
-n dfu-programmer: waiting
-n .
-n .


and I have not the slightest clue what this means.
Title: Re: ADB to USB keyboard converter
Post by: PancakeMSTR on Thu, 23 February 2017, 13:43:40
Okay, screw the Pro-micro. It's a lost cause. Which Teensy should I get? The 2.0 right? Then which version of the adb-usb converter do I need to use?

I'm gonna be honest here, the instructions are REALLY confusing. I'm honestly not even sure how to program the teensy. All I need is a hex file, right? I can make the hex file on linux/mac, then move it over to the teensy loader and that should work? Which makefile do I use?

Seriously I'm so confused.

And then how do I edit the layout? You produce a config file and somehow...this gets loaded onto whatever microcontroller I'm using?

I'm sorry I just can't parse the instructions. They are not answering questions.
Title: Re: ADB to USB keyboard converter
Post by: Tactile on Thu, 23 February 2017, 14:22:46
Okay, screw the Pro-micro. It's a lost cause. Which Teensy should I get? The 2.0 right? Then which version of the adb-usb converter do I need to use?

I'm gonna be honest here, the instructions are REALLY confusing. I'm honestly not even sure how to program the teensy. All I need is a hex file, right? I can make the hex file on linux/mac, then move it over to the teensy loader and that should work? Which makefile do I use?

Seriously I'm so confused.

And then how do I edit the layout? You produce a config file and somehow...this gets loaded onto whatever microcontroller I'm using?

I'm sorry I just can't parse the instructions. They are not answering questions.

Yes, a Teensy 2.0. And, when you have your hex file built, all you need is this (https://www.pjrc.com/teensy/loader.html) to flash it.
Title: Re: ADB to USB keyboard converter
Post by: PancakeMSTR on Wed, 01 March 2017, 01:30:23
Okay, screw the Pro-micro. It's a lost cause. Which Teensy should I get? The 2.0 right? Then which version of the adb-usb converter do I need to use?

I'm gonna be honest here, the instructions are REALLY confusing. I'm honestly not even sure how to program the teensy. All I need is a hex file, right? I can make the hex file on linux/mac, then move it over to the teensy loader and that should work? Which makefile do I use?

Seriously I'm so confused.

And then how do I edit the layout? You produce a config file and somehow...this gets loaded onto whatever microcontroller I'm using?

I'm sorry I just can't parse the instructions. They are not answering questions.

Yes, a Teensy 2.0. And, when you have your hex file built, all you need is this (https://www.pjrc.com/teensy/loader.html) to flash it.


Welp, that didn't work.

I ran, on my mac,

 make -f Makefile.teensy

copied the hex file over to my windows computer, programmed the teensy, plugged everything in aaaand nothing. Keyboard doesn't work.

Wiring could be wrong, but shouldn't there be SOME indication that I've gotten this to work?
Title: Re: ADB to USB keyboard converter
Post by: Tactile on Wed, 01 March 2017, 11:30:59
Welp, that didn't work.

I ran, on my mac,

 make -f Makefile.teensy

copied the hex file over to my windows computer, programmed the teensy, plugged everything in aaaand nothing. Keyboard doesn't work.

Wiring could be wrong, but shouldn't there be SOME indication that I've gotten this to work?

What shows up in Control Panel > Devices and Printers?
Title: Re: ADB to USB keyboard converter
Post by: PancakeMSTR on Wed, 01 March 2017, 11:37:29
Welp, that didn't work.

I ran, on my mac,

 make -f Makefile.teensy

copied the hex file over to my windows computer, programmed the teensy, plugged everything in aaaand nothing. Keyboard doesn't work.

Wiring could be wrong, but shouldn't there be SOME indication that I've gotten this to work?

What shows up in Control Panel > Devices and Printers?


I'll have to check, but the computer doesn't really identify anything. No like "found keyboard" or anything.

But I haven't actually looked at what device manager says.

Suppose I plugged just the teensy in. What should device manager say? Would it indicate something different with the teensy only in versus the teensy connected to the keyboard?
Title: Re: ADB to USB keyboard converter
Post by: Tactile on Wed, 01 March 2017, 12:07:55
Not Device Manager.
Quote
Control Panel > Devices and Printers

Recognized input devices like keyboards and mice should show up here.
Title: Re: ADB to USB keyboard converter
Post by: Tactile on Wed, 01 March 2017, 12:17:29
When you switched from the Pro Micro to the Teensy you should have changed one or more configuration settings in the Makefile. The bootloader size for the Teensy is 512, not 4096. And check out the other settings as well, I can't remember all of them.
Title: Re: ADB to USB keyboard converter
Post by: PancakeMSTR on Wed, 01 March 2017, 12:37:28
When you switched from the Pro Micro to the Teensy you should have changed one or more configuration settings in the Makefile. The bootloader size for the Teensy is 512, not 4096. And check out the other settings as well, I can't remember all of them.

I definitely have no clue how to do that.


I also tried generating a hex file from the layout configurator, i.e.: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1


I just left everything default (as is when you open the link) and then downloaded the hex file. Didn't work.


Literally all the instructions say to do is

"To program Teensy you can use teensy target:

$ make -f Makefile.teensy [KEYMAP=(plain|ansi|iso|hasu)] teensy"

One note about that, I left off "teensy" at the end because I wasn't programming the teensy through my mac. My presumption is

make -f Makefile.teensy

compiles the hex file, with the default/plain keymap. Don't know if I'm wrong about that.

What am I missing?
Title: Re: ADB to USB keyboard converter
Post by: Tactile on Wed, 01 March 2017, 12:52:11
You need to edit "Makefile" - no extension.

Change this:
Code: [Select]
# Boot Section Size in *bytes*
#   Teensy halfKay   512
#   Teensy++ halfKay 1024
#   Atmel DFU loader 4096 for TMK Converter rev.1/rev.2
#   LUFA bootloader  4096
#   USBaspLoader     2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096

to this:
Code: [Select]
# Boot Section Size in *bytes*
#   Teensy halfKay   512
#   Teensy++ halfKay 1024
#   Atmel DFU loader 4096 for TMK Converter rev.1/rev.2
#   LUFA bootloader  4096
#   USBaspLoader     2048
OPT_DEFS += -DBOOTLOADER_SIZE=512
Title: Re: ADB to USB keyboard converter
Post by: PancakeMSTR on Wed, 01 March 2017, 13:00:45
You need to edit "Makefile" - no extension.

Change this:
Code: [Select]
Boot Section Size in *bytes*
#   Teensy halfKay   512
#   Teensy++ halfKay 1024
#   Atmel DFU loader 4096 for TMK Converter rev.1/rev.2
#   LUFA bootloader  4096
#   USBaspLoader     2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096

to this:
Code: [Select]
Boot Section Size in *bytes*
#   Teensy halfKay   512
#   Teensy++ halfKay 1024
#   Atmel DFU loader 4096 for TMK Converter rev.1/rev.2
#   LUFA bootloader  4096
#   USBaspLoader     2048
OPT_DEFS += -DBOOTLOADER_SIZE=512

Okay I'll give that a try and get back to you.
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Wed, 01 March 2017, 13:04:02
When you switched from the Pro Micro to the Teensy you should have changed one or more configuration settings in the Makefile. The bootloader size for the Teensy is 512, not 4096. And check out the other settings as well, I can't remember all of them.

I definitely have no clue how to do that.


I also tried generating a hex file from the layout configurator, i.e.: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1


I just left everything default (as is when you open the link) and then downloaded the hex file. Didn't work.


Literally all the instructions say to do is

"To program Teensy you can use teensy target:

$ make -f Makefile.teensy [KEYMAP=(plain|ansi|iso|hasu)] teensy"

One note about that, I left off "teensy" at the end because I wasn't programming the teensy through my mac. My presumption is

make -f Makefile.teensy

compiles the hex file, with the default/plain keymap. Don't know if I'm wrong about that.

What am I missing?

Maybe go back to basics just as a test.

Grab this: https://www.pjrc.com/teensy/blink_both.zip and flash your teensy with it.  If you have a Teensy 2, then you want to load "blink_slow_Teensy2.hex" and reboot the teensy (not your machine).
Using the GUI tool that @Tactile refers to should be all you need.

Verify that your Teensy is good first.

If it is, grab a fresh copy of TMK, then:
Code: [Select]
> cd path/to/your/tmk_keyboard/converter/adb_usb
> make clean && make

After a bunch of standard informational logging, you should get something like this:
Code: [Select]
Creating load file for Flash: adb_usb_lufa.hex
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature adb_usb_lufa.elf adb_usb_lufa.hex

Creating load file for EEPROM: adb_usb_lufa.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex adb_usb_lufa.elf adb_usb_lufa.eep || exit 0

Creating Extended Listing: adb_usb_lufa.lss
avr-objdump -h -S -z adb_usb_lufa.elf > adb_usb_lufa.lss

Creating Symbol Table: adb_usb_lufa.sym
avr-nm -n adb_usb_lufa.elf > adb_usb_lufa.sym

Size after:
   text    data     bss     dec     hex filename
  20130      52     172   20354    4f82 adb_usb_lufa.elf

-------- end --------
You will have a file named "adb_usb_lufa.hex"

Load that on to your teensy as you did above using the GUI Loader and try your keyboard.
Title: Re: ADB to USB keyboard converter
Post by: PancakeMSTR on Thu, 02 March 2017, 11:45:43
When you switched from the Pro Micro to the Teensy you should have changed one or more configuration settings in the Makefile. The bootloader size for the Teensy is 512, not 4096. And check out the other settings as well, I can't remember all of them.

I definitely have no clue how to do that.


I also tried generating a hex file from the layout configurator, i.e.: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1


I just left everything default (as is when you open the link) and then downloaded the hex file. Didn't work.


Literally all the instructions say to do is

"To program Teensy you can use teensy target:

$ make -f Makefile.teensy [KEYMAP=(plain|ansi|iso|hasu)] teensy"

One note about that, I left off "teensy" at the end because I wasn't programming the teensy through my mac. My presumption is

make -f Makefile.teensy

compiles the hex file, with the default/plain keymap. Don't know if I'm wrong about that.

What am I missing?

Maybe go back to basics just as a test.

Grab this: https://www.pjrc.com/teensy/blink_both.zip and flash your teensy with it.  If you have a Teensy 2, then you want to load "blink_slow_Teensy2.hex" and reboot the teensy (not your machine).
Using the GUI tool that @Tactile refers to should be all you need.

Verify that your Teensy is good first.

If it is, grab a fresh copy of TMK, then:
Code: [Select]
> cd path/to/your/tmk_keyboard/converter/adb_usb
> make clean && make

After a bunch of standard informational logging, you should get something like this:
Code: [Select]
Creating load file for Flash: adb_usb_lufa.hex
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature adb_usb_lufa.elf adb_usb_lufa.hex

Creating load file for EEPROM: adb_usb_lufa.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex adb_usb_lufa.elf adb_usb_lufa.eep || exit 0

Creating Extended Listing: adb_usb_lufa.lss
avr-objdump -h -S -z adb_usb_lufa.elf > adb_usb_lufa.lss

Creating Symbol Table: adb_usb_lufa.sym
avr-nm -n adb_usb_lufa.elf > adb_usb_lufa.sym

Size after:
   text    data     bss     dec     hex filename
  20130      52     172   20354    4f82 adb_usb_lufa.elf

-------- end --------
You will have a file named "adb_usb_lufa.hex"

Load that on to your teensy as you did above using the GUI Loader and try your keyboard.

I tested blink, the teensy works fine.

I'll try your suggestion. Why use that over the teensy code?
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Thu, 02 March 2017, 12:06:22
Quote
I'll try your suggestion. Why use that over the teensy code?

To eliminate as many changes as possible.  It's also the exact way I flash my teensy.
Title: Re: ADB to USB keyboard converter
Post by: PancakeMSTR on Thu, 02 March 2017, 23:01:11
When you switched from the Pro Micro to the Teensy you should have changed one or more configuration settings in the Makefile. The bootloader size for the Teensy is 512, not 4096. And check out the other settings as well, I can't remember all of them.

I definitely have no clue how to do that.


I also tried generating a hex file from the layout configurator, i.e.: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1


I just left everything default (as is when you open the link) and then downloaded the hex file. Didn't work.


Literally all the instructions say to do is

"To program Teensy you can use teensy target:

$ make -f Makefile.teensy [KEYMAP=(plain|ansi|iso|hasu)] teensy"

One note about that, I left off "teensy" at the end because I wasn't programming the teensy through my mac. My presumption is

make -f Makefile.teensy

compiles the hex file, with the default/plain keymap. Don't know if I'm wrong about that.

What am I missing?

Maybe go back to basics just as a test.

Grab this: https://www.pjrc.com/teensy/blink_both.zip and flash your teensy with it.  If you have a Teensy 2, then you want to load "blink_slow_Teensy2.hex" and reboot the teensy (not your machine).
Using the GUI tool that @Tactile refers to should be all you need.

Verify that your Teensy is good first.

If it is, grab a fresh copy of TMK, then:
Code: [Select]
> cd path/to/your/tmk_keyboard/converter/adb_usb
> make clean && make

After a bunch of standard informational logging, you should get something like this:
Code: [Select]
Creating load file for Flash: adb_usb_lufa.hex
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature adb_usb_lufa.elf adb_usb_lufa.hex

Creating load file for EEPROM: adb_usb_lufa.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex adb_usb_lufa.elf adb_usb_lufa.eep || exit 0

Creating Extended Listing: adb_usb_lufa.lss
avr-objdump -h -S -z adb_usb_lufa.elf > adb_usb_lufa.lss

Creating Symbol Table: adb_usb_lufa.sym
avr-nm -n adb_usb_lufa.elf > adb_usb_lufa.sym

Size after:
   text    data     bss     dec     hex filename
  20130      52     172   20354    4f82 adb_usb_lufa.elf

-------- end --------
You will have a file named "adb_usb_lufa.hex"

Load that on to your teensy as you did above using the GUI Loader and try your keyboard.

Nope. I get "adb_usb.hex" but no "adb_usb_lufa.hex"

Programmed the teensy with that file anyway and it does nothing.

The file loads fine, but after rebooting the teensy it's not recognized by the computer as anything and the LED doesn't turn off.


By the way, device manager recognizes the teensy (with whatever random converter hexfile I've decided to put on it) as "ADB keyboard converter."

Also my mouse is slowly jumping to the top right corner of my monitor. Was there a fix for that? I couldn't tell.

It's working. In fact I'm typing this edit on it at this very moment. Changing that line in the makefile is what did it. Seems the pull up resistor is also quite necessary indeed. Assuredly does not work without it. Anyway, thanks for the help all, much appreciated and sorry for being so difficult.

For everyone's viewing pleasure: My crappy electronics test bench: http://imgur.com/a/K5VBi
Title: Re: ADB to USB keyboard converter
Post by: tjweir on Fri, 03 March 2017, 08:27:42
Glad it's working.  Hasu mentions that the pull up is a must, looks like we have another data point that confirms this. :)
Title: Re: ADB to USB keyboard converter
Post by: apprentice57 on Tue, 14 March 2017, 00:26:25
Hi all.

I've been doing an internal adb-usb converter for my ANSI apple extended keyboard I. I believe the hardware modification to wire the old data/power points to my teensy 2.0 has gone correctly. However I am running into software issues when I try to flash the device.

My workflow has been to download the default configuration from http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?adb_usb_rev1 (Without modifications, I don't need anything fancy) for adb_usb rev 1 as a hex file, then to flash that hex file to my teensy using the teensy loader application.

However, once I do so there are a few keys that are mapped incorrectly.
(The label(s) on the key(s) I press) -> (The character that is produced on screen)

(shift and 2) -> "
(shift and 6) -> &
(shift and 7) -> '
(shift and 8 ) -> (
(shift and 9) -> )
(shift and 0) -> 0
( = )              -> ^
(shift and =) -> ~
( [ )             -> @
(shift and {) -> `
( ] )             -> [
(shift and ] ) -> {
( \ )              -> ]
( shift and \ ) -> }
(shift and ; )   -> +
( ' )               -> :
(shift and ')    -> *

To my knowledge, every other key is working, so this is quite bizzare! It's almost like some characters like the parenthesis and brackets are shifted right or left one key.


I do not think this is a hardware/wiring issue, because if I set these problematic keys to something that is not problematic currently (like an alpha character) then these keys work just fine producing that alpha character. Conversely, if I set keys that should be alphas normally to these problematic characters, they have the same issue.

However, if anyone suspects this is a hardware issue I'll follow up with images. I'd just prefer to avoid taking apart my setup since I have electrical tape everywhere.

What I was wondering is:

1) Has anyone run into a similar issue with the online configurator and flashing the hex file through the teensy program?
2) Would someone be willing to give me a working .hex file for their AEK? Hopefully from a ANSI AEK I and Teensy 2.0 setup.
3) Would someone be willing to flash their ANSI AEK I with the .hex file I have been using and let me know if you have any issue? The file is attached.

That and any other help would be appreciated. Thanks in advance.

EDIT: At this point I was able to compile the hex myself on my machine using the "plain" and "ansi" layouts, and flashed those with teensy loader. I get the same issue with wrong mappings, so I'm now more befuddled.

P.S. I have tried to compile the .hex file locally but I keep getting an error:
">> make -f Makefile.teensy
sh: avr-gcc: command not found
make: *** [gccversion] Error 127"
I have already installed avr from https://www.obdev.at/products/crosspack/download.html for macOS. I have also attempted to install avr via homebrew but the install has been taking an hour+ (still going) so I don't know if it is working properly.


I have also attempted to flashusing dfu-programmer instead of the teensy program, but I keep getting a "dfu-programmer: no device present." error.

Very frustrating. 3 roadblocks at once  :(.
Title: Re: ADB to USB keyboard converter
Post by: hasu on Tue, 14 March 2017, 07:22:00
What layout are you using on your OS? ANSI or one of ISO?

Sent from my Nexus 5X

Title: Re: ADB to USB keyboard converter
Post by: apprentice57 on Tue, 14 March 2017, 09:51:29
What layout are you using on your OS? ANSI or one of ISO?

Sent from my Nexus 5X

Should be ANSI, I'm in the states. I've been primarily using macOS, but the issue occurs at work at my Debian computer too.

EDIT: Something must be off about the OS, you're completely right there. I hooked the keyboard to an OS that probably few others here use commonly: FreeBSD (I have a FreeNAS system), and the thing works like a charm! No incorrect mappings.

 I'll play around with configurations in macOS, cause something there is obviously the problem.

Thanks Hasu :)
Title: Re: ADB to USB keyboard converter
Post by: sneaux on Thu, 16 March 2017, 17:14:35
The converter works with teensy 2.0 ++ by changing the processor in teensy makefile as everyone said. The pull up resistor was necessary with a coiled lindy cable. My only issue is that capslock doesn't really work for me at the moment. It registers, but does not act as if I've held it down when I have. At first I thought it might be because of the locking caps, so I removed the locking mechanism from the switch but that didn't help. I then commented the locking caps line of the config file, but this didn't change anything. Changing LCAP to CAP results in an undefined error, same for changing the "keycode" in the map file to match the one for CAP. I'm guessing this is what I need to understand better, but figured I would see if anyone else had a fix for this already. The output from Karabiner is this:

eventType:KeyDown         code:0x28       name:k               flags:                                   misc:KeyCode::K    characters:k   
eventType:KeyUp           code:0x28       name:k               flags:                                   misc:KeyCode::K    characters:k   
eventType:KeyDown         code:0x28       name:k               flags:                                   misc:KeyCode::K    characters:k   
eventType:KeyDown         code:0x28       name:k               flags:                                   misc:KeyCode::K    characters:k   
eventType:KeyDown         code:0x28       name:k               flags:                                   misc:KeyCode::K    characters:k   
eventType:KeyDown         code:0x28       name:k               flags:                                   misc:KeyCode::K    characters:k   
eventType:KeyDown         code:0x28       name:k               flags:                                   misc:KeyCode::K    characters:k   
eventType:KeyUp           code:0x28       name:k               flags:                                   misc:KeyCode::K    characters:k   
eventType:FlagsChanged    code:0x3f       name:Fn              flags:Fn                                 misc:KeyCode::FN    characters:   
eventType:FlagsChanged    code:0x3f       name:Fn              flags:                                   misc:KeyCode::FN    characters:
 
and this is from me pressing a character key, getting the usual up/down events. Next I briefly held the key down, and I got the expected output. For the caps which is then sent to fn, I held the key down, but got the two events immediately and no additional event upon release. 
Title: Re: ADB to USB keyboard converter
Post by: hasu on Thu, 16 March 2017, 17:49:28
Those events look decent for TMK locking key support but which you don't want in your keymap. What you have to do will be just to find proper keycode.

You will find how to find the keycode in keymap document. You can find keymap document in README, btw.
Title: Re: ADB to USB keyboard converter
Post by: sneaux on Thu, 16 March 2017, 22:52:52
Perfect. Thank you. I had changed the instances of LCAP to CAP, but should have changed them to CAPS   :D
Title: Re: ADB to USB keyboard converter
Post by: mrrm14 on Thu, 06 April 2017, 12:12:27
Hi All,

I'm following this handy little guide to convert the Apple Extended Keyboard II to USB:
http://ifixit.org/blog/4468/hack-it-better-apple-extended-keyboard-ii/ (http://ifixit.org/blog/4468/hack-it-better-apple-extended-keyboard-ii/)

I followed all of the instructions to the letter but I have a problem. The Teensy 2 powers on when plugged as does the Keyboard Num Lock, Caps Lock and Scroll Lock LEDs. The Teensy' LED is on constantly but flashes every 10 seconds. When it flashes the mouse pointer on the screen moves about an inch to the right.

I'm still a bit new to micro controllers and Hex Code so I can't debug the issue myself, to my eyes it seems all good. I've included the code used and my wiring.

Any advice is much appreciated!

Thanks!

http://imgur.com/a/omVjP (http://imgur.com/a/omVjP)

Code: [Select]
:100000000C9499050C94DD050C94DD050C94DD052C
:100010000C94DD050C94DD050C94DD050C94DD05D8
:100020000C94DD050C94DD050C94920F0C94641077
:100030000C940D1F0C94DD050C94DD050C94DD056E
:100040000C94DD050C94DD050C94DD050C94DD05A8
:100050000C94DD050C94801F0C94DD050C94DD05DB
:100060000C94DD050C94DD050C94DD050C94DD0588
:100070000C94DD050C94DD050C94DD050C94DD0578
:100080000C94DD050C94DD050C94DD050C94DD0568
:100090000C94DD050C94DD050C94DD050C94DD0558
:1000A0000C94DD050C94DD050C94DD05C910EB10F6
:1000B000D611EB10D6112D115011D611A511B81172
:1000C000B715B715E515E51541167D16801880188A
:1000D000951680188C178C175A18801880186E186F
:1000E00035A131A1041607090B0A1D1B0619640569
:1000F000141A08151C171E1F202123222E26242D1A
:1001000025273012182F0C13280F0D340E33C1364B
:10011000381110372B2CC02A5829E0E3E182E25035
:100120004F5152006C6365556D570053A9AAA854EE
:100130005800566D6E2E62595A5B5C5D5E5F6F6053
:10014000618987853E3F403C4142914490466B47E0
:10015000004365450048494A4B4C3D4D3B4E3AE50E
:10016000E6E40000AAA9A8090B0A1D1B06196405EC
:10017000141A08151C173A3B3C3D3F3E454240448B
:100180004143494718524648284B0D4F4A50C14DEC
:100190005111104E2B2CC04C5835E0E3E182E24A5D
:1001A0004D4E4B006CF565F66DF90053A9AAA8F504
:1001B000F600FA6D6EF4F4FBF1FCF2F1F3FA6FF075
:1001C000F98987853E3F403C4142914490466B47C8
:1001D000004365450048494A4B4C3D4D3B4E3AE58E
:1001E000E6E400006164625F686F73745F6B626471
:1001F0005F726563763A204552524F522825642932
:100200000A000A0025303458006164625F686F7329
:10021000745F6B62645F726563763A200045525288
:100220004F523A206D65646961206B6579300A0030
:100230004552524F523A206D65646961206B657971
:10024000310A005D0A0025640020002564007C005E
:100250002530325800200025303258006164625F3A
:100260006D6F757365207261773A205B000A002517
:1002700030313662006164625F686F73745F6D6F06
:100280007573655F726563763A20006465627567B1
:1002900020656E61626C65642E0A005363616E3A7C
:1002A00020616464723A25642C20726567333A25B4
:1002B0003034580A00416674657220696E69743A78
:1002C0000A00466F756E643A206D65646961206B43
:1002D0006579730A005363616E3A20616464723A0F
:1002E00025642C20726567333A253034580A004261
:1002F00065666F726520696E69743A0A004B6579AC
:10030000626F6172642073746172742E0A005553B7
:100310004220636F6E666967757265642E0A000D10
:100320000A696E69740A005B445D005B435D002EE0
:100330000341004400420020006B00650079006228
:10034000006F00610072006400200063006F006EA7
:100350000076006500720074006500720000000EF7
:100360000374002E006D002E006B002E00000004B0
:1003700003090409027400040100A032090400000A
:1003800001030101000921110100012240000705BC
:10039000810308000A090401000103010200092188
:1003A00011010001224D000705820308000A09041B
:1003B00002000103000000092111010001223600A2
:1003C0000705830308000A09040300020300000074
:1003D00009211101000122220007058403200001E8
:1003E000070504032000011201100100000008EDC0
:1003F000FEDB0A0101010200010631FF0974A101BF
:100400000975150026FF00952075088102097615EB
:100410000026FF00952075089102C005010980A102
:1004200001850216810026B7001A81002AB70075DF
:100430001095018100C0050C0901A1018503160179
:1004400000269C021A01002A9C0275109501810069
:10045000C005010902A1010901A10005091901292D
:10046000051500250195057501810295017503812A
:10047000010501093009311581257F950275088133
:100480000609381581257F950175088106050C0A36
:1004900038021581257F950175088106C0C00501C8
:1004A0000906A101050719E029E7150025019508AE
:1004B0007501810295017508810105081901290559
:1004C00095057501910295017503910105071900C4
:1004D00029FF150026FF00950675088100C0636F8F
:1004E0006E73756D65723A20253034580A00737941
:1004F0007374656D3A20253034580A000A0025309F
:10050000325820006B6579626F6172643A20004C4A
:1005100045443A20253032580A00253032583A20D6
:100520002530386225730A00722F63203031323350
:10053000343536370A00290A002575002F00257545
:10054000005D28002564002000256400200025644B
:100550000020002564007C0025303258006D6F7546
:1005600073656B6579205B62746E7C782079207688
:1005700020685D287265702F61636C293A205B00EA
:100580006D6B5F776865656C5F74696D655F746FCF
:100590005F6D6178203D2025640A006D6B5F776890
:1005A00065656C5F6D61785F7370656564203D2083
:1005B00025640A006D6B5F74696D655F746F5F6DB4
:1005C0006178203D2025640A006D6B5F6D61785F66
:1005D0007370656564203D2025640A006D6B5F695A
:1005E0006E74657276616C203D2025640A006D6B27
:1005F0005F64656C6179203D2025640A006D6B5F46
:10060000776865656C5F74696D655F746F5F6D6158
:1006100078203D2025640A006D6B5F776865656C06
:100620005F6D61785F7370656564203D2025640AA5
:10063000006D6B5F74696D655F746F5F6D617820CD
:100640003D2025640A006D6B5F6D61785F73706596
:100650006564203D2025640A006D6B5F696E7465DA
:100660007276616C203D2025640A006D6B5F6465C5
:100670006C6179203D2025640A000A00257500364A
:100680003A20776865656C5F74696D655F746F5F4C
:100690006D61783A20000A00257500353A207768A8
:1006A00065656C5F6D61785F73706565643A2000A5
:1006B0000A00257500343A2074696D655F746F5FB8
:1006C0006D61783A20000A00257500333A206D618B
:1006D000785F73706565643A20000A002575003202
:1006E0003A20696E74657276616C286D73293A20C0
:1006F000000A00257500313A2064656C6179282A6A
:1007000031306D73293A20000A092D2056616C752D
:100710006573202D0A004D3E004D25643E20003FAC
:10072000007365742064656661756C740A00433EED
:10073000200077686572652064656C74613A206397
:100740007572736F723D25642C20776865656C3D0A
:1007500025640A53656520687474703A2F2F656E9E
:100760002E77696B6970656469612E6F72672F7788
:10077000696B692F4D6F7573655F6B6579730A00DF
:100780000A092D204D6F7573656B6579202D0A451B
:1007900053432F713A09717569740A313A096465D6
:1007A0006C6179282A31306D73290A323A09696EF1
:1007B00074657276616C286D73290A333A096D612C
:1007C000785F73706565640A343A0974696D655FB2
:1007D000746F5F6D61780A353A09776865656C5F9B
:1007E0006D61785F73706565640A363A097768658C
:1007F000656C5F74696D655F746F5F6D61780A0A1F
:10080000703A097072696E742076616C7565730A4E
:10081000643A097365742064656661756C74730A63
:1008200075703A092B310A646F776E3A092D310AD7
:10083000706775703A092B31300A7067646F776E94
:100840003A092D31300A0A7370656564203D2064D1
:10085000656C7461202A206D61785F7370656564D2
:10086000202A2028726570656174202F2074696DBC
:10087000655F746F5F6D6178290A003F004D3E200F
:1008800000433E20004C25640A000A092D20436FD6
:100890006E736F6C65202D0A4553432F713A0971B1
:1008A0007569740A6D3A096D6F7573656B65790AC0
:1008B000000A092D204D61676963202D0A643A09F9
:1008C00064656275670A783A096465627567206DC8
:1008D00061747269780A6B3A096465627567206BA6
:1008E0006579626F6172640A6D3A09646562756761
:1008F000206D6F7573650A763A0976657273696F54
:100900006E0A733A097374617475730A633A096302
:100910006F6E736F6C65206D6F64650A302D343AAD
:10092000096C61796572302D34284631302D46349A
:10093000290A506175733A09626F6F746C6F616454
:1009400065720A003F0074696D65725F726561646B
:10095000333228293A202530346C580A006B6579E7
:10096000626F6172645F69646C653A2025580A00A1
:100970006B6579626F6172645F70726F746F636FC1
:100980006C3A2025580A00686F73745F6B65796252
:100990006F6172645F6C65647328293A2025580A78
:1009A000000A092D20537461747573202D0A0047C5
:1009B00043433A20342E382E31204156522D4C4993
:1009C00042433A20312E382E3073766E20415652F3
:1009D0005F415243483A20617672350A004F5054C5
:1009E000494F4E533A204C554641204D4F555345A3
:1009F0004B45592045585452414B455920434F4E81
:100A0000534F4C4520434F4D4D414E4420343039D7
:100A1000360A004255494C443A20346265666338D0
:100A200037202830303A30353A3233204170722046
:100A300020362032303137290A005649443A2030D6
:100A4000784645454428742E6D2E6B2E292050493A
:100A5000443A2030783041444228414442206B657A
:100A600079626F61726420636F6E7665727465720D
:100A700029205645523A203078303130310A00442E
:100A80004553433A20636F6E766572742041444249
:100A9000206B6579626F61726420746F20555342D8
:100AA0000A000A092D2056657273696F6E202D0A9F
:100AB000000A6D6F7573653A206F66660A000A6DED
:100AC0006F7573653A206F6E0A000A6B6579626F05
:100AD0006172643A206F66660A000A6B6579626F1C
:100AE0006172643A206F6E0A000A6D6174726978EF
:100AF0003A206F66660A000A6D61747269783A205E
:100B00006F6E0A000A64656275673A206F6E0A00AC
:100B10000A64656275673A206F66660A000A0A62AF
:100B20006F6F746C6F616465722E2E2E2000433ED1
:100B3000200011241FBECFEFDAE0DEBFCDBF04B628
:100B400003FE24C08091DC019091DD01A091DE01C3
:100B5000B091DF018730904BA740B04BB9F41092B1
:100B6000DC011092DD011092DE011092DF0114BE53
:100B700084B7877F84BF88E10FB6F89480936000C4
:100B8000109260000FBEE0E0F8E3099511E0A0E0EC
:100B9000B1E0E2EAF0E502C005900D92A433B1079E
:100BA000D9F721E0A4E3B1E001C01D92AC3DB2074A
:100BB000E1F70E94C50C0C944F280C940000FF93A1
:100BC000EF93E0913401F0913501309709F00995E8
:100BD000EF91FF910895FC018591803011F0EFDFD6
:100BE000FBCF0895FF27E0E230E247FF0CC04195BC
:100BF00097FF09C0EDE26095709580959095611D15
:100C0000711D811D911D27FF02C0219530E350E227
:100C1000AA27660F771F881F991FAA1FA41710F015
:100C2000A41B63955A95A9F7AA3008F0A95FA05DA7
:100C3000AF93F395611571058105910541F7ED328B
:100C400011F4EF93F395F21718F43F93F395FBCF5C
:100C50008F91B5DFFA95E1F70895E991F9918591C2
:100C6000803021F0853219F0AADFF9CF089520E015
:100C7000E89455915532C1F3503311F4689455916D
:100C80005A3348F4505390F3220F022E220F220FB2
:100C9000200D250FF4CF0EF42195899199915336AB
:100CA00019F3533729F1533559F1BC018827992796
:100CB000E8945C3621F48991999168945591543661
:100CC00039F446EF7EF077FF0DC08FEF9FEF0AC03B
:100CD00055374AE039F0583540E121F0523642E0CC
:100CE00009F00895FF93EF937DDFEF91FF91B7CF68
:100CF000FF93EF93FC0181918030B9F360DFFBCF6C
:100D0000FF93EF9368DFF1CFDF93CF93CDB7DEB7DB
:100D10002596A3DFCF91DF910895282F2770E82F24
:100D2000E695E695E695EF70F0E0E95CFE4F87FF0B
:100D30000CC081E090E0022E01C0880F0A94EAF70F
:100D40008095908189238083089581E090E0022E30
:100D500001C0880F0A94EAF79081982B9083089538
:100D60000F931F93CF93DF93569A5E9A0E949E092A
:100D70002FEF87EA91E6215080409040E1F700C0D4
:100D800000008FEE92E09F938F930E9484060F9055
:100D90000F90C1E0D0E005ED12E063E08C2F0E94DF
:100DA000A209009771F09F938F93DF93CF931F93C6
:100DB0000F930E9484060F900F900F900F900F904A
:100DC0000F909FEF29EF80E0915020408040E1F7A5
:100DD00000C000002196C031D105F9F663E082E041
:100DE0000E94A20999278131910511F174F487308D
:100DF0009105F1F024F404970297F0F419C08930BA
:100E00009105B1F00D97C1F413C08D31910581F0BA
:100E100034F48431910561F0499771F409C0843C40
:100E2000910531F0873C910519F0813C910521F441
:100E300081E080934C0102C010924C0163E087E096
:100E40000E94A20991E0823009F090E090934D0158
:100E5000992341F082EC92E09F938F930E94840645
:100E60000F900F9023E042E063E082E00E94270AA7
:100E700085EB92E09F938F930E9484060F900F90D2
:100E8000C1E0D0E00BE912E063E08C2F0E94A209E0
:100E9000009771F09F938F93DF93CF931F930F93DE
:100EA0000E9484060F900F900F900F900F900F905C
:100EB0008FEF99EF20E0815090402040E1F700C093
:100EC00000002196C031D105F9F6E7E3F1E0119277
:100ED00081E0E734F807D9F70E94F3110E94440932
:100EE0008091BE0181608093BE018BE892E00E94F8
:100EF000EB05569A5E98DF91CF911F910F9108955F
:100F0000CF93DF938FE79BEB0197F1F700C00000D1
:100F10000E94230AEC01009711F481E0C4C097FD00
:100F200005C080914701816080934701D7FF05C0CC
:100F3000809147018E7F809347018D2F99278F7372
:100F40009927AE014F735527C6FF02C0405451097F
:100F5000D6FF02C08054910960913601772767FD62
:100F60007095469F9001479F300D569F300D11247C
:100F700021384FEF340714F421E83FEF31952195E4
:100F8000310921384FEF340714F421E83FEF219560
:100F900020934801869F9001879F300D969F300DCA
:100FA000112421388FEF380714F421E83FEF882708
:100FB0009927821B930B81382FEF920714F481E855
:100FC0009FEF8195809349018091BE0183FF60C0AE
:100FD00085E792E00E94EB05DF93CF938FE692E0E6
:100FE0009F938F930E9484068DE692E00E94EB050A
:100FF0008CE592E00E94EB0520913601822F992723
:1010000087FD90959F932F9387E592E09F938F9311
:101010000E94840685E592E00E94EB0580914701DD
:101020001F928F9380E592E09F938F930E94840696
:101030008EE492E00E94EB0520914801822F9927CF
:1010400087FD90959F932F938BE492E09F938F93CE
:101050000E94840689E492E00E94EB0520914901F8
:10106000822F992787FD90959F932F9386E492E096
:101070009F938F930E94840683E492E00E94EB0585
:101080008DB79EB744960FB6F8949EBF0FBE8DBF26
:1010900087E491E00E9444128091360191E088300B
:1010A0000CF090E0890F80933601DF91CF91089585
:1010B0001F93CF93DF93C0910001D09101018FEF77
:1010C0009FEF9093010180930001CF3F8FEFD807EE
:1010D00009F06AC08FE79BEB0197F1F700C00000B1
:1010E00082E00E94200AEC01009709F05DC0809127
:1010F0004D01882309F458C087E00E94200A009718
:1011000009F452C09C012F77332722303105A1F01A
:1011100048F42115310569F02130310599F48078C2
:101120008A641AC02330310551F02F373105A1F000
:1011300009C08078826410C0807889640DC080788E
:1011400088640AC080E392E09F938F930E94840694
:101150000F900F9081E18EC0292F33272F773327EF
:101160002130310579F050F02230310579F023300B
:10117000310581F4EC01D078D86416C0EC01D07848
:10118000D26412C0EC01D078DA640EC0EC01D078E1
:10119000D9640AC08DE192E09F938F930E948406E8
:1011A0000F900F9080E166C08091BE0181FF18C052
:1011B000209709F45CC089E092E00E94EB05DF9380
:1011C000CF9384E092E09F938F930E94840682E005
:1011D00092E00E94EB050F900F900F900F9003C0CC
:1011E000209709F444C0CF379FE7D90711F48FE760
:1011F00005C0CF3F8FEFD80721F48FEF0E948D06F7
:1012000038C02D2F3327822F1C2F2F3F81F4DF93DF
:10121000CF9384EE91E09F938F930E9484060E9467
:10122000B0060F900F900F900F908C2F23C09091CD
:101230004C01992381F0A9014F775527423351057D
:1012400021F4822F80788A6006C04A30510519F453
:10125000822F807882630E948D061F3F51F0DC2F21
:10126000CC27CF6FD0930101C093000102C080E072
:1012700001C081E0DF91CF911F910895E82FF0E048
:10128000E95CFE4F80810895682F609582E00C94A0
:10129000620A509A83E091E00197F1F700C00000E4
:1012A00050989AEB9A95F1F700C00895509A8AEBFE
:1012B0008A95F1F700C0509883E091E00197F1F72B
:1012C00000C000000895EF92FF920F931F93CF93F9
:1012D000DF93C0E0D0E000E810E0E82EF12C9801A8
:1012E0000C2E02C0359527950A94E2F72E213F2156
:1012F000232B19F00E94560902C00E944909219629
:10130000C830D10561F7DF91CF911F910F91FF9008
:10131000EF900895489B07C023E02A95F1F700005D
:1013200001970097B9F70895489907C023E02A95D7
:10133000F1F7000001970097B9F708955898509871
:1013400008950895CF92DF92EF92FF920F931F932B
:10135000CF93DF931F92CDB7DEB7182FF894509A32
:1013600083EF9BE00197F1F700C0000069830E94C2
:10137000560969816C60E0E11E9FC0011124862B33
:101380000E9463090E94490984EF91E00E94940938
:10139000892B21F4789482EE9FEF48C084EF91E08E
:1013A0000E948A09892B21F4789480E090E03EC065
:1013B00021E1F22EC12CD12C32E8E32E82E890E01C
:1013C0000E9494098C01882359F199270E948A0967
:1013D000882331F1CC0CDD1C9E2D901B081B90172F
:1013E00018F46894C0F807C0F1E1FF1204C07894C3
:1013F0008CEE9FEF1BC0FA9409F78FE591E00E94F5
:101400009409892B21F478948BEE9FEF0FC08BE524
:1014100090E00E948A09892BB1F77894C60106C032
:1014200078948F2D90E09195819591090F90DF919F
:10143000CF911F910F91FF90EF90DF90CF90089583
:1014400060E00C94A20960E083E00C94A2091F9371
:10145000CF93DF9300D01F92CDB7DEB7182FF8944B
:10146000509A83EF9BE00197F1F700C000002B83B7
:101470004A8369830E9456096981862F886090E1BA
:10148000199FF00111248E2B0E9463090E944909C3
:10149000EFE1F3E03197F1F700C000000E94560938
:1014A0004A81842F0E9463092B81822F0E94630945
:1014B0000E94490978940F900F900F90DF91CF917F
:1014C0001F910895262F277040E062E00C94270AB0
:1014D00080915A0108959FB7F894109251019FBFCF
:1014E0009091D301943009F058C09091E9009F7019
:1014F0002091EC0020FF02C020E801C020E0292B51
:1015000094E09093E9009091EB0090FF43C090919C
:10151000EE0097FF3FC090914E01992321F09091EA
:10152000E80095FF37C010924E0196E03091E80038
:1015300035FD15C03091D301343061F53091EB00A9
:1015400035FD28C0915021F481E080934E0122C0E6
:10155000EFE9FFE03197F1F700C00000E7CF80939B
:10156000F1008091E80085FD0AC08091E80080FFCD
:10157000FCCF8091E8008E778093E80006C08FB79B
:10158000F89491E0909351018FBF2F702093E90060
:1015900080E008952F702093E9008FEF0895CF9396
:1015A000DF9300D01F92CDB7DEB72091D301243056
:1015B00019F523E029839B838A832093E9008FEF29
:1015C0009091E800815095FD06C095ED9A95F1F750
:1015D00000008111F5CF8091E80085FF0DC040E04B
:1015E00050E063E070E0CE0101960E94850D80918D
:1015F000E8008E778093E8000F900F900F90DF91B6
:10160000CF910895CF93DF9300D01F92CDB7DEB76F
:101610002091D301243021F522E029839B838A8302
:1016200083E08093E9008FEF9091E800815095FD71
:1016300006C095ED9A95F1F700008111F5CF8091E4
:10164000E80085FF0DC040E050E063E070E0CE01AF
:1016500001960E94850D8091E8008E778093E800C6
:101660000F900F900F90DF91CF9108952091D301AB
:101670002430F1F422E02093E9002FEF3091E800CC
:10168000215035FD06C035ED3A95F1F700002111E6
:10169000F5CF2091E80025FF0BC040E050E065E069
:1016A00070E00E94850D8091E8008E778093E800BD
:1016B0000895CF93DF93EC018091D301843039F505
:1016C00081E08093E9008FEF9091E800815095FDD3
:1016D00006C095ED9A95F1F700008111F5CF809144
:1016E000E80085FF14C040E050E068E070E0CE0103
:1016F0000E94850D8091E8008E778093E80088E055
:10170000FE01A2E5B1E001900D928A95E1F7DF912B
:10171000CF9108958BE293E00E94EB058091D20176
:10172000811109C00E94170F0E94740F8091E2007E
:1017300084608093E200089587E293E00E94EB05C5
:101740001092D2010895089580914F018F5F809388
:101750004F0162E30E941528911135C010924F018C
:1017600080915101882379F18091D301843049F52A
:101770008091E9008F709091EC0090FF02C090E89A
:1017800001C090E0982B84E08093E9008091EB0009
:1017900080FF14C08091EE0087FF10C08091E800A8
:1017A00085FF03C01092F100F9CF8091E80080FF1F
:1017B00005C08091E8008E778093E8009F70909339
:1017C000E90010925101089542E061EC81E00E942D
:1017D000910E42E061EC82E00E94910E42E061ECE9
:1017E00083E00E94910E42E261EC84E00C94910E41
:1017F0008091D501833009F453C030F4813071F009
:10180000823009F48CC008958A3009F478C08B3096
:1018100009F45EC0893009F09AC020C08091D401DB
:10182000813A09F094C08091E800877F8093E800B6
:101830008091D8019091D901892B21F060E080E05E
:1018400090E003C068E082E591E070E00E94CE0D78
:101850008091E8008B778093E80008958091D4010F
:10186000813209F074C08091D8019091D901892BFF
:1018700009F06DC08091E800877F8093E800809137
:10188000E80082FD05C08091D3018111F8CF5FC0CF
:101890008091F10080935A018091E8008B7753C0CA
:1018A0008091D401813A09F052C08091D801909181
:1018B000D901892B09F04BC08091E800877F809384
:1018C000E8008091E80080FFFCCF80910C0136C0D9
:1018D0008091D4018132D9F58091D8019091D901BC
:1018E000892BA9F58091E800877F8093E8000E940A
:1018F000C60E8091D60180930C010C94A1188091A2
:10190000D401813221F58091E800877F8093E8003F
:101910000E94C60E8091D70180935B01089580914B
:10192000D401813AA1F48091E800877F8093E80098
:101930008091E80080FFFCCF80915B018093F100F3
:101940008091E8008E778093E8000C94C60E08958D
:101950000895089580915A018093500110925A0180
:1019600080E00E9444090E9474130C94A1180C9406
:10197000AA0C0E94CE1E8091D101882329F00E94DA
:10198000F41E81110C946F0D089584B7877F84BF76
:1019900088E10FB6F89480936000109260000FBE4B
:1019A00090E080E80FB6F894809361009093610016
:1019B0000FBE8BE69AE00E94A31E8FE193E00E9487
:1019C000EB050E94A80C0E94AB120E94170F0E9408
:1019D000740F8091E20084608093E200789480919B
:1019E000D3018430E1F78EE093E00E94EB050E9482
:1019F000AD1282E091E00E94EE118DEF92E00E9424
:101A0000EB050E94A90C8091D301853019F40E9446
:101A1000B90CF9CF0E94B312F6CF0E94091F809132
:101A2000500180935A0108950C940D0D292F3327EE
:101A300023303105A9F06CF42130310509F442C09E
:101A40002230310509F043C084E790E023E733E01A
:101A500042C021323105C9F02232310519F137C0B7
:101A600099278130910541F08230910541F0892B11
:101A700071F5EFE6F3E005C0EFE5F3E002C0EFE259
:101A8000F3E0849190E09F0126C0643000F5E62FDA
:101A9000F0E0EE0FFF1FEF5DFE4F2081318189E006
:101AA00090E019C0643098F4E62FF0E0DF01AA0F4F
:101AB000BB1FA75EBE4F2D913C91EB5EFE4F808118
:101AC00090E009C082E190E027EE33E004C080E0BE
:101AD00090E020E030E0FA0131832083089580E136
:101AE00089BD82E189BD09B400FEFDCF8091D80097
:101AF0008F7D8093D8008091E00082608093E00029
:101B00008091E00081FDFCCF0895CF92DF92EF92AB
:101B1000FF920F931F93CF93DF937C018B01EA0118
:101B20000E94E70E811131C0209731F088819981A0
:101B3000081B190BE80EF91EC12CD12C011511053B
:101B400019F18091E80085FD14C08091E8008E773E
:101B50008093E800209741F0888199818C0D9D1D2C
:101B60009983888385E011C00E94E70E882331F3B2
:101B70000CC0F70181917F018093F10001501109A0
:101B8000FFEFCF1ADF0ADACF80E0DF91CF911F910C
:101B90000F91FF90EF90DF90CF9008952091DA01A0
:101BA0003091DB012617370748F06115710539F4CC
:101BB0002091E8002E772093E80001C0B901FC01D4
:101BC00020E061157105B9F18091D301882309F4F2
:101BD00040C0853009F43FC08091E80083FD3DC0DE
:101BE0008091E80082FF06C08091E80082FF26C055
:101BF00080E008958091E80080FFE3CF2091F3001A
:101C00008091F20090E0922B6115710551F08830BF
:101C1000910538F421912093F100615071090196EA
:101C2000F3CF21E0089709F020E08091E8008E775B
:101C30008093E800C6CF2111C7CFD6CF8091D301C2
:101C4000882339F0853039F08091E80083FFCCCFCC
:101C500004C082E0089583E0089581E00895209112
:101C6000DA013091DB012617370748F0611571055D
:101C700039F42091E8002E772093E80001C0B901E3
:101C8000FC0120E061157105C1F18091D301882329
:101C900009F441C0853009F440C08091E80083FD1B
:101CA0003EC08091E80082FF06C08091E80082FF7C
:101CB00027C080E008958091E80080FFE3CF209165
:101CC000F3008091F20090E0922B6115710559F0BC
:101CD0008830910540F424912093F10031966150B1
:101CE00071090196F2CF21E0089709F020E0809178
:101CF000E8008E778093E800C5CF2111C6CFD5CFFD
:101D00008091D301882339F0853039F08091E80043
:101D100083FFCBCF04C082E0089583E0089581E083
:101D20000895982F973058F59093E900981739F057
:101D30007091EC002091ED005091F00003C0242F31
:101D4000762F50E021FF19C03091EB003E7F309399
:101D5000EB003091ED003D7F3093ED003091EB00D2
:101D600031603093EB007093EC002093ED005093C2
:101D7000F0002091EE0027FF07C09F5FD3CF8F7048
:101D80008093E90081E0089580E008958091D40176
:101D900087FD05C08091E80080FF0EC012C08091D1
:101DA000E80082FD05C08091D3018111F8CF08952C
:101DB0008091E8008B7708C08091D3018111EACF30
:101DC00008958091E8008E778093E80008958091CF
:101DD000E4009091E50045E62091EC0020FF21C051
:101DE0002091E80020FD21C02091D301222389F019
:101DF000253089F02091EB0025FD0FC02091E400F3
:101E00003091E5002817390739F3415041F0C901F5
:101E1000E3CF82E0089583E0089581E0089584E0AF
:101E200008952091E80022FFDFCF80E008950E940E
:101E3000850F0E948D0FE0EEF0E08081816080834D
:101E4000E8EDF0E080818F77808319BCA7EDB0E0EA
:101E50008C918E7F8C9380818F7E80831092D201B3
:101E600008950F931F93CF93DF930E94850F0E94D5
:101E70008D0FC8EDD0E088818F7788838881806856
:101E8000888388818F7D888319BC1092D30110923A
:101E9000CF011092D1011092D00100EE10E0F801B4
:101EA00080818B7F808388818160888342E060E0CD
:101EB00080E00E94910EE1EEF0E080818E7F8083D1
:101EC000E2EEF0E0808181608083808188608083A1
:101ED000F80180818E7F8083888180618883DF9193
:101EE000CF911F910F910895E8EDF0E080818F7EF2
:101EF0008083E7EDF0E080818160808384E082BFB1
:101F000081E08093D2010C94310FE8EDF0E0808104
:101F10008E7F80831092E20008951092DA00109272
:101F2000E10008951F920F920FB60F9211242F9384
:101F30003F934F935F936F937F938F939F93AF9351
:101F4000BF93EF93FF938091E10082FF0BC08091DC
:101F5000E20082FF07C08091E1008B7F8093E10067
:101F60000E94A40B8091DA0080FF1FC08091D800EE
:101F700080FF1BC08091DA008E7F8093DA00809111
:101F8000D90080FF0DC080E189BD82E189BD09B41F
:101F900000FEFDCF81E08093D3010E948A0B05C033
:101FA00019BC1092D3010E949C0B8091E10080FF2C
:101FB00019C08091E20080FF15C08091E2008E7F01
:101FC0008093E2008091E20080618093E200809142
:101FD000D80080628093D80019BC85E08093D3013B
:101FE0000E94B70C8091E10084FF30C08091E20034
:101FF00084FF2CC080E189BD82E189BD09B400FE67
:10200000FDCF8091D8008F7D8093D8008091E10032
:102010008F7E8093E1008091E2008F7E8093E200CA
:102020008091E20081608093E2008091CF0188235B
:1020300011F084E007C08091E30087FF02C083E0D5
:1020400001C081E08093D3010E94140D8091E100D2
:1020500083FF29C08091E20083FF25C08091E100C9
:10206000877F8093E10082E08093D3011092CF01BB
:102070008091E1008E7F8093E1008091E2008E7F6D
:102080008093E2008091E20080618093E20042E070
:1020900060E080E00E94910E8091F0008860809363
:1020A000F0000E94A30BFF91EF91BF91AF919F9120
:1020B0008F917F916F915F914F913F912F910F90F1
:1020C0000FBE0F901F9018951F920F920FB60F9290
:1020D00011242F933F934F935F936F937F938F932D
:1020E0009F93AF93BF93CF93EF93FF93C091E9007A
:1020F000CF708091EC001092E9008091F000877F12
:102100008093F00078940E94A0101092E9008091D2
:10211000F00088608093F000C093E900FF91EF9198
:10212000CF91BF91AF919F918F917F916F915F916F
:102130004F913F912F910F900FBE0F901F901895C8
:102140001F93CF93DF93CDB7DEB7AA970FB6F8945E
:10215000DEBF0FBECDBFE4EDF1E08091F1008193D1
:1021600021E0EC3DF207C9F70E94F80B8091E800EE
:1021700083FF1CC12091D4013091D501832F90E0C1
:102180008A30910508F012C1FC01EA5AFF4F0C9405
:102190003528203881F0223809F008C18091D80113
:1021A0008F708093E9008091EB0085FB882780F990
:1021B0001092E90006C08091D0019091D101911157
:1021C00082609091E800977F9093E8008093F100FF
:1021D0001092F100C5C0822F8D7F09F0E7C0222345
:1021E00019F0223061F0E2C08091D601813009F00F
:1021F000DDC0333009F080E08093D10128C08091A8
:10220000D601811124C02091D8012F7009F4CEC0CD
:102210002093E9008091EB0080FF19C08091EB00D2
:10222000333011F4806211C080618093EB0081E053
:1022300090E0022E01C0880F0A94EAF78093EA002A
:102240001092EA008091EB0088608093EB0010927E
:10225000E9008091E800877F86C02111A7C0109116
:10226000D6011F778091E3008078812B8093E30073
:102270008091E800877F8093E8000E94C60E8091DD
:10228000E80080FFFCCF8091E30080688093E3004A
:10229000112311F083E001C082E08093D30186C056
:1022A0002058223008F082C08091D6019091D70149
:1022B0008C3D23E0920779F583E08A838AE2898363
:1022C0004FB7F894DE01139620E03EE051E2E32F91
:1022D000F0E050935700E49120FF03C0E295EF70C7
:1022E0003F5FEF708E2F90E0EA3010F0C79601C08C
:1022F000C0968D939D932F5F243149F74FBF8091F6
:10230000E800877F8093E8006AE270E0CE010196E2
:102310000E94CE0D14C0AE014F5F5F4F6091D80197
:102320000E94160D009709F441C02091E800277F14
:102330002093E800BC0189819A810E942F0E809130
:10234000E8008B778093E80031C0203879F58091E0
:10235000E800877F8093E8008091CF018093F100AF
:102360008091E8008E778093E8000E94C60E1EC020
:1023700021111CC09091D6019230C0F48091E800E8
:10238000877F8093E8009093CF010E94C60E8091D2
:10239000CF01811104C08091E30087FF02C084E077
:1023A00001C081E08093D3010E94E40B8091E8009A
:1023B00083FF0AC08091E800877F8093E8008091C6
:1023C000EB0080628093EB00AA960FB6F894DEBF14
:1023D0000FBECDBFDF91CF911F9108959093610102
:1023E000809360010895E0916001F0916101309760
:1023F00021F00190F081E02D099480E00895FF9292
:102400000F931F93CF93DF938C01E0916001F091C4
:102410006101309799F10280F381E02D0995809157
:10242000BE0182FF2BC080FF04C084E095E00E94C3
:10243000EB05E80188E0F82E0EEF14E08091BE0174
:1024400080FF0BC088811F928F931F930F930E9470
:1024500084060F900F900F900F90FA942196F11030
:10246000EDCF8091BE0180FF09C08CEF94E0DF9139
:10247000CF911F910F91FF900C94EB05DF91CF91BD
:102480001F910F91FF900895E0916001F09161011B
:10249000309721F00480F581E02D09940895CF93C1
:1024A000DF93EC0180915E0190915F01C817D9071D
:1024B00009F1D0935F01C0935E01E0916001F0915A
:1024C00061013097B9F00680F781E02DCE010995C2
:1024D0008091BE0182FF0EC080FF0CC0DF93CF93BE
:1024E0008EEE94E09F938F930E9484060F900F903E
:1024F0000F900F90DF91CF910895CF93DF93EC0170
:1025000080915C0190915D01C817D90709F1D093C2
:102510005D01C0935C01E0916001F0916101309731
:10252000B9F00084F185E02DCE0109958091BE01BE
:1025300082FF0EC080FF0CC0DF93CF938EED94E03E
:102540009F938F930E9484060F900F900F900F908F
:10255000DF91CF9108950C9475130E94361F0E944D
:10256000B0060C94A109CF92DF92EF92FF920F93E5
:102570001F93CF93DF9300D000D000D0CDB7DEB74C
:102580000E94580833E6E32E31E0F32E00E010E01D
:10259000C02E802F0E943E09F701D1907F01D826DE
:1025A000B1F40F5F1F4F0031110591F78FEF898351
:1025B0008A831B820E943F1F8160782F9D838C83BA
:1025C00049815A816B818D810E94C81348C09091C6
:1025D000BE0191FF04C08E830E9492138E8120E081
:1025E00030E04D2D50E0922FBA01022E02C07595B9
:1025F00067950A94E2F760FF2CC02983CA82EE2413
:10260000E394F12C02C0EE0CFF1C9A95E2F790E0E7
:102610008E219F2121E0892B09F420E02B830E9449
:102620003F1F8160782F9D838C8349815A816B8104
:102630008D810E94C81349815A816B817C818D8173
:102640000E94BB1EF801ED59FE4F80818E258083CC
:1026500006C02F5F3F4F2830310529F6A2CF0E94D8
:10266000BA1E0E9482220E948007109162010E947D
:10267000F311181741F10E94F311809362019091B8
:10268000BE0192FF0EC090FF0CC01F928F938FE08F
:1026900095E09F938F930E9484060F900F900F9068
:1026A0000F908091620126960FB6F894DEBF0FBEA0
:1026B000CDBFDF91CF911F910F91FF90EF90DF90F1
:1026C000CF900C94CC1E26960FB6F894DEBF0FBEAA
:1026D000CDBFDF91CF911F910F91FF90EF90DF90D1
:1026E000CF9008950C94440908950895CF93DF93F3
:1026F0001F92CDB7DEB769830E943E09282F30E0D4
:1027000081E090E0698102C0880F991F6A95E2F725
:102710002823392381E0232B09F480E00F90DF91F7
:10272000CF910895EF92FF920F931F93CF93DF9372
:1027300088E295E00E94EB05C0E0D0E089E2E82E57
:1027400081E0F82E0AE115E08C2F0E943E090E94DC
:10275000A81EFF92EF921F928F93DF93CF931F9348
:102760000F930E94840621968DB79EB708960FB6E8
:10277000F8949EBF0FBE8DBFC031D10529F7DF9100
:10278000CF911F910F91FF90EF90089508950895B4
:10279000CF93DF93CDB7DEB72B970FB6F894DEBF9C
:1027A0000FBECDBF4F83588769877A878B878A850D
:1027B0009B85892B31F05F3F11F080E003C04F3FD4
:1027C000E1F781E0811107C04F81588569857A85DD
:1027D0008B850E94BB1EDE01119686E0FD011192E1
:1027E0008A95E9F785E0FE01379601900D928A956A
:1027F000E1F749815A816B817C818D819E810E94A4
:102800007F1B2B960FB6F894DEBF0FBECDBFDF91B6
:10281000CF910895CF93C82F882309F4E7C0823859
:10282000A1F40E94F31181FDE1C089E30E94FC1D27
:102830000E947D1E2FEF81EE94E021508040904059
:10284000E1F700C0000089E315C08338C1F40E949D
:10285000F31180FDCBC083E50E94FC1D0E947D1E0C
:102860002FEF81EE94E0215080409040E1F700C0CE
:10287000000083E50E941D1ECF910C947D1E8438BC
:10288000A1F40E94F31182FDB1C087E40E94FC1DF7
:102890000E947D1E2FEF81EE94E0215080409040F9
:1028A000E1F700C0000087E4E5CF8CEF8C0F813AA0
:1028B00048F48C2F0E94A325811198C08C2F0E9470
:1028C000FC1DDACF80E28C0F883048F4C77081E0BD
:1028D00001C0880FCA95EAF70E94411ECDCF8BE553
:1028E0008C0F833078F4C53A29F0C63A31F482E887
:1028F00090E005C081E890E002C083E890E0CF91CD
:102900000C944F1288E58C0F853108F06FC0C83ADF
:1029100061F1C93A69F1CA3A71F1CB3A79F1CC3A2D
:1029200081F1CD3A89F1CE3A91F1CF3A99F1C13B9B
:10293000A1F1C03BA9F1C23BB1F1C33BB9F1C43B2A
:10294000C1F1C53BC9F1C63BD1F1C73BD9F1C83B89
:10295000E1F1C93BE9F1CA3BF1F1CB3BF9F1CC3BE9
:1029600009F03FC08AE292E03EC082EE90E03BC0B8
:1029700089EE90E038C08AEE90E035C085EB90E0BB
:1029800032C086EB90E02FC083EB90E02CC084EB4C
:1029900090E029C087EB90E026C08CEC90E023C04B
:1029A0008DEC90E020C083E891E01DC08AE891E0C2
:1029B0001AC082E991E017C084E991E014C081E275
:1029C00092E011C083E292E00EC084E292E00BC07C
:1029D00085E292E008C086E292E005C087E292E0DC
:1029E00002C080E090E0CF910C947D12CF910895C9
:1029F000882309F466C08238A1F40E94F31181FF94
:102A000060C089E30E94FC1D0E947D1E2FEF81EEB5
:102A100094E0215080409040E1F700C0000089E33D
:102A200015C08338B9F40E94F31180FF4AC083E5D2
:102A30000E94FC1D0E947D1E2FEF81EE94E021502C
:102A400080409040E1F700C0000083E50E941D1E19
:102A50000C947D1E8438A1F40E94F31182FF31C0D2
:102A600087E40E94FC1D0E947D1E2FEF81EE94E002
:102A7000215080409040E1F700C0000087E4E6CF9D
:102A80009CEF980F913A10F390E2980F983050F421
:102A9000877091E001C0990F8A95EAF7892F0E940B
:102AA000471ED6CF9BE5980F933020F480E090E04E
:102AB0000C944F12885A853120F480E090E00C94F9
:102AC0007D120895882321F00E94411E0C947D1EE2
:102AD0000895882321F00E94471E0C947D1E0895BE
:102AE000CF92DF92EF92FF920F931F93CF93DF93DA
:102AF000CDB7DEB728970FB6F894DEBF0FBECDBFB7
:102B00008C0185E0F801DE01119601900D928A9505
:102B1000E1F7F80140813181F280258122952F7003
:102B200083819481892B31F03F3F31F481E04F3F25
:102B300019F403C081E001C080E080FDE1C2498357
:102B40003A8389819A812F830E94BA1D9E83888748
:102B50000E94B91D0E94E11C4E81E42FE295EF70A6
:102B6000F0E0E05AFF4F2F8168850C943528842FC0
:102B7000807F142F1F70882311F01295107FFF2083
:102B800059F0112309F471C2812F68870E94541EE5
:102B90000E947D1E688569C2862F0E94F814112349
:102BA00009F4AEC2812F0E945A1E28960FB6F894DF
:102BB000DEBF0FBECDBFDF91CF911F910F91FF9070
:102BC000EF90DF90CF900C947D1E842F807F942F08
:102BD0009F70E92E803219F0E29480EFE82266239C
:102BE00019F0613001F129C0FF20A9F08E2D2223B8
:102BF00049F1213039F528960FB6F894DEBF0FBEA3
:102C0000CDBFDF91CF911F910F91FF90EF90DF909B
:102C1000CF900C94641E222319F0213009F470C265
:102C20000E94671E2CC0FF20E9F0263008F068C221
:102C30000E943E1E8E2129F022C0FF20F1F02111BA
:102C400015C08E2D28960FB6F894DEBF0FBECDBFEF
:102C5000DF91CF911F910F91FF90EF90DF90CF9078
:102C60000C946215253008F04BC209C0F80185812B
:102C700080FFFBC18F708583E4CF21110AC28E2DA6
:102C800078C1242F26952695237030E02115310533
:102C900021F021303105C9F033C2FF2021F0862F09
:102CA000942F937002C080E090E028960FB6F894BD
:102CB000DEBF0FBECDBFDF91CF911F910F91FF906F
:102CC000EF90DF90CF900C944F12FF2021F0862FD1
:102CD000942F937002C080E090E028960FB6F8948D
:102CE000DEBF0FBECDBFDF91CF911F910F91FF903F
:102CF000EF90DF90CF900C947D12862FFF2019F07B
:102D00000E94082102C00E94702128960FB6F894F4
:102D1000DEBF0FBECDBFDF91CF911F910F91FF900E
:102D2000EF90DF90CF900C94F521842F837009F001
:102D300076C0F110E5C1262F229526952770220F27
:102D4000220F862F8F70C82ED12CE12CF12C022E51
:102D500004C0CC0CDD1CEE1CFF1C0A94D2F764FFEF
:102D600010C06FE070E080E090E004C0660F771F55
:102D7000881F991F2A95D2F7609570958095909538
:102D800003C060E070E0CB01242F269526952370C8
:102D9000422F50E042305105D1F04330510559F1F6
:102DA0006C297D298E299F294130510541F12896B2
:102DB0000FB6F894DEBF0FBECDBFDF91CF911F914C
:102DC0000F91FF90EF90DF90CF900C94F61C6C2940
:102DD0007D298E299F2928960FB6F894DEBF0FBE55
:102DE000CDBFDF91CF911F910F91FF90EF90DF90BA
:102DF000CF900C94081D0E94F61CC701B6012896BE
:102E00000FB6F894DEBF0FBECDBFDF91CF911F91FB
:102E10000F91FF90EF90DF90CF900C94E41CFF2077
:102E200019F0842F817001C08695882309F468C148
:102E3000262F229526952770220F220F862F8F701E
:102E4000C82ED12CE12CF12C022E04C0CC0CDD1CA0
:102E5000EE1CFF1C0A94D2F764FF10C06FE070E014
:102E600080E090E004C0660F771F881F991F2A95A5
:102E7000D2F7609570958095909503C060E070E002
:102E8000CB01242F269526952370422F50E0423007
:102E90005105D1F04330510559F16C297D298E2916
:102EA0009F294130510541F128960FB6F894DEBFB5
:102EB0000FBECDBFDF91CF911F910F91FF90EF908B
:102EC000DF90CF900C94951D6C297D298E299F2928
:102ED00028960FB6F894DEBF0FBECDBFDF91CF911D
:102EE0001F910F91FF90EF90DF90CF900C94A71D52
:102EF0000E94951DC701B60128960FB6F894DEBF53
:102F00000FBECDBFDF91CF911F910F91FF90EF903A
:102F1000DF90CF900C94831D603FD9F128F480E4BA
:102F2000860F803250F09CC0623F09F461C008F403
:102F30004BC0633F09F470C093C0162F1071842FEB
:102F40008F716887FF2059F00E942E1D6885862F9B
:102F5000112319F08295807F75CE8F7073CE0E94F9
:102F6000491D6885862F112319F08295807F01C045
:102F70008F7028960FB6F894DEBF0FBECDBFDF91DD
:102F8000CF911F910F91FF90EF90DF90CF900C9415
:102F90006915FF20A9F0253008F0B2C0842F8F7189
:102FA00028960FB6F894DEBF0FBECDBFDF91CF914C
:102FB0001F910F91FF90EF90DF90CF900C94681DC0
:102FC000263008F09DC0EACFFF20A1F0842F8F713A
:102FD00028960FB6F894DEBF0FBECDBFDF91CF911C
:102FE0001F910F91FF90EF90DF90CF900C942E1DCA
:102FF000FF2061F3842F8F7128960FB6F894DEBFFF
:103000000FBECDBFDF91CF911F910F91FF90EF9039
:10301000DF90CF900C94491DFF2091F0842F8F7189
:1030200028960FB6F894DEBF0FBECDBFDF91CF91CB
:103030001F910F91FF90EF90DF90CF900C941F1D88
:1030400028960FB6F894DEBF0FBECDBFDF91CF91AB
:103050001F910F91FF90EF90DF90CF900C941A1D6D
:10306000FF20A1F0222309F4B1CF862F28960FB6B6
:10307000F894DEBF0FBECDBFDF91CF911F910F91AE
:10308000FF90EF90DF90CF900C940A14222309F464
:10309000B1CF862F28960FB6F894DEBF0FBECDBFF6
:1030A000DF91CF911F910F91FF90EF90DF90CF9024
:1030B0000C94F8144F70C8010E94C81F28960FB6D0
:1030C000F894DEBF0FBECDBFDF91CF911F910F915E
:1030D000FF90EF90DF90CF900C942C1C4F70C801A4
:1030E00028960FB6F894DEBF0FBECDBFDF91CF910B
:1030F0001F910F91FF90EF90DF90CF900C94CB1F1A
:1031000028960FB6F894DEBF0FBECDBFDF91CF91EA
:103110001F910F91FF90EF90DF90CF9008950E9444
:10312000611E0E94301E0E947D1E0E9423230E9469
:10313000F52180E090E00E944F1280E090E00C9436
:103140007D120E94511E0C948F180E94BA1D292FC7
:1031500022952F7030E02C3031054CF42A303105A7
:10316000C4F4225031092230310540F021C02C3006
:103170003105D1F02F303105B9F01AC0853A28F465
:103180008430C0F4823028F415C090E2980F983053
:1031900088F0883E30F4803E68F48450813A40F4F0
:1031A00009C0803F29F406C093FB882780F9089561
:1031B00080E0089581E00895CF93DF9300D000D0A0
:1031C0001F92CDB7DEB70F900F900F900F900F901A
:1031D000DF91CF910895CF93DF9300D000D000D03E
:1031E000CDB7DEB726960FB6F894DEBF0FBECDBFC3
:1031F000DF91CF9108951F93CF93DF93C091730117
:1032000016E080917401C81799F0D0E01C9FF0017E
:103210001D9FF00D1124EB58FE4F408151816281BA
:103220007381848195810E94EB182196C770E9CF44
:10323000DF91CF911F9108954091A5015091A60172
:103240006091A7017091A8018091A9019091AA01B4
:103250000C94EB18CF938091AA0182958F7009F09E
:103260005FC08091A701882309F45AC0209173019F
:10327000A09174016091A5017091A6018091A801AF
:103280009091A90131E06F3F09F030E0B32FC6E023
:103290002A1709F445C0009721F07F3F21F44B2FF6
:1032A00003C041E001C040E030E040FD35C0C29FB6
:1032B000F001C39FF00D1124EB58FE4F41817413B0
:1032C0002BC04081641328C04281411125C0438135
:1032D00054814817590710F441505109481B590BA4
:1032E000483C5105C8F48091AA018F708061809399
:1032F000AA0186E0829FF001839FF00D1124E65819
:10330000FE4F80818F708061808385EA91E00E940A
:103310007015CF910C94FB182F5F3F4F2770B8CFDB
:10332000CF910895CF92DF92EF92FF920F931F9368
:10333000CF93DF93CDB7DEB762970FB6F894DEBFB9
:103340000FBECDBF8C0185E0F801DE011D96019016
:103350000D928A95E1F7D8014C9111965C911197E5
:1033600012966C9112971396ED90FC9014977091B1
:10337000A501E091A6012091A8013091A901211594
:10338000310531F0EF3F31F481E07F3F19F403C0A4
:1033900081E001C080E0B82FB170CB2E80FD6CC100
:1033A000D090A701DD2009F4F5C0F091AA01E21642
:1033B000F30638F0C701821B930B883C910548F057
:1033C0009BC0209530952E0D3F1D283C310508F0FF
:1033D00093C08F2F807F09F052C0E51314C074137F
:1033E00012C0D62E61110FC0FF70F061F093AA01D8
:1033F0000E941C1985EA91E00E9470158091AA0133
:10340000F80185836CC1EF2831F05F3F31F481E032
:103410004F3F19F403C081E001C080E080FD03C08C
:1034200081E0862701C080E0F82FF170FF2E80FF39
:103430001CC0809173012091740136E0821709F459
:1034400028C190E0389FF001399FF00D1124EB580E
:10345000FE4F7181571306C07081471303C07281FC
:10346000671303C001968770E9CFD62E662309F44F
:1034700036C18091AA0181608093AA0153C0E513EF
:1034800008C0741306C0611104C0D8011596FC93DE
:10349000AEC04D875E878D859E856A8B0E94A5187C
:1034A0006A89882329F1D62E662311F12091AA0179
:1034B000822F82958F7090E002970CF460C080910B
:1034C000A5019091A60198878F831986FB86EA86CD
:1034D0002C87CE01079651C0E51731F14D875E87E5
:1034E0008D859E856A8B0E94A5186A8981112EC0E0
:1034F000C8010E947015A4C08F2F807F69F77E2DB0
:10350000F98AE88A89890E94DC1885EA91E00E949C
:103510007015E5EAF1E086E0DF011D928A95E9F792
:103520000E941C19D12CDBC07413D8CF6111D6CFE7
:10353000D8011596FC93C8010E947015E5EAF1E0E8
:1035400086E0DF011D928A95E9F7C9C0D62E662371
:1035500079F22091AA01822F82958F7090E00297D4
:1035600074F08091A5019091A6019A8389831B82B2
:10357000FD82EC822E83CE0101960E94701586E0BA
:10358000F801A5EAB1E001900D928A95E1F70E9459
:103590002A196FC0E216F30628F0C701821B930BAD
:1035A0009C0104C0209530952E0D3F1D283C31050F
:1035B00008F052C0D62E662309F49ACFE5132CC02A
:1035C00074132AC08091AA0180FD1DC0982F929586
:1035D0009F70C9F0D80115968C9315979F3039F0DC
:1035E0009F5F9295907F8F70892B15968C93C80161
:1035F0000E94701586E0F801A5EAB1E001900D92F5
:103600008A95E1F736C086E0F801A5EAB1E00190BD
:103610000D928A95E1F763C04D875E878D859E8503
:103620000E94A518882379F086E0F801A5EAB1E0A8
:1036300001900D928A95E1F70E942A190E941C19A7
:10364000DD24D3944CC08091AA0181608093AA01AB
:10365000C8010E94701543C07E2DF98AE88A8989C5
:103660000E94DC18E5EAF1E086E0DF011D928A9510
:10367000E9F70E941C1933C0662309F439CF4D873E
:103680005E878D859E850E94A518882309F430CF1A
:10369000CBCF4D875E878D859E850E94BA1D292FD1
:1036A00022952F7030E0223031052CF49F7041F0CC
:1036B000811106C00CC0243031052CF49F7049F4F0
:1036C000805E883020F0C8010E947015CF2CDC2C61
:1036D00006C0D80115969C91907F91F7F8CF8D2D5B
:1036E00062960FB6F894DEBF0FBECDBFDF91CF91CB
:1036F0001F910F91FF90EF90DF90CF9008951F934F
:10370000CF93DF93CDB7DEB72C970FB6F894DEBF1B
:103710000FBECDBF4F83588769877A878B879C8779
:10372000CE0107960E9492198823C1F02F81388517
:103730008A859B85892B31F03F3F11F080E003C0E3
:103740002F3FE1F781E0811147C04F81588569859E
:103750007A858B859C850E94EB183EC086E0FE0131
:103760003796DE01119601900D928A95E1F7FF815F
:10377000E8854A855B854115510531F0EF3F31F40D
:1037800081E0FF3F19F403C081E001C080E080FDCB
:1037900023C02091740130E0C901019687709927F8
:1037A0006091730170E086179707F1F1F983EA835E
:1037B0005D834C8396E0929FD001939FB00D1124BE
:1037C000AB58BE4FFE01319601900D929A95E1F7EC
:1037D000809374010E94FB1816E080917301909110
:1037E0007401891779F1189FC00111248B589E4FDD
:1037F0000E949219882331F1E09173011E9FF0011C
:103800001124EB58FE4F4081518162817381848184
:1038100095810E94EB188091730190E0019687706A
:10382000992780937301D9CF0E94A1181092740137
:1038300010927301E5EAF1E086E0DF011D928A95BE
:10384000E9F7CACF2C960FB6F894DEBF0FBECDBFF6
:10385000DF91CF911F910895DF92EF92FF920F9326
:103860001F93CF93DF93FC01009709F48AC0E12CEA
:10387000F12CDD24D394EF0121968491853709F44E
:1038800061C058F4843708F04EC0843008F06AC034
:103890008130D1F0823071F174C0883709F45DC095
:1038A00050F4863709F455C0873709F06AC08E2D69
:1038B0000E944E1E54C09CE7980F903708F061C0DC
:1038C0008F770E94F81450C08F010E5F1F4FFE01CA
:1038D000849190E2980F983050F48770FD2D01C0CC
:1038E000FF0F8A95EAF78F2F0E94541E15C00E9481
:1038F0000A1414C08F010E5F1F4FFE01849190E2E5
:10390000980F983068F48770FD2D01C0FF0F8A95DD
:10391000EAF78F2F0E945A1E0E947D1EE80124C0E4
:103920000E94F814FBCF9F012E5F3F4FFE01C49110
:10393000CC2369F08FE99FE00197F1F700C0000008
:10394000C150F6CF9F012E5F3F4FFE01F490E90179
:103950000BC00E943E1EE82E07C00E94511E0E940E
:103960007D1E02C00E940A149F2D992341F0EFE9A9
:10397000FFE03197F1F700C000009150F6CFFE0153
:103980007ACFDF91CF911F910F91FF90EF90DF9051
:1039900008956093AF017093B0018093B10190934B
:1039A000B2010E94CA1E0C948F186093AB017093F1
:1039B000AC018093AD019093AE010E94CB1E0C949C
:1039C0008F1808950C94C91C0F931F930091AF0199
:1039D0001091B0012091B1013091B201602B712B97
:1039E000822B932B1F910F910C94C91C0F931F9343
:1039F0000091AF011091B0012091B1013091B2015D
:103A000060237123822393231F910F910C94C91C6F
:103A10000F931F930091AF011091B0012091B1015C
:103A20003091B20160277127822793271F910F9150
:103A30000C94C91C60E070E0CB010C94D51C41E0F3
:103A400050E060E070E004C0440F551F661F771F10
:103A50008A95D2F7CB01BA010C94D51C41E050E015
:103A600060E070E004C0440F551F661F771F8A9501
:103A7000D2F78091AB019091AC01A091AD01B091D2
:103A8000AE01482B592B6A2B7B2BCB01BA010C942E
:103A9000D51C41E050E060E070E004C0440F551FC9
:103AA000661F771F8A95D2F740955095609570955F
:103AB0008091AB019091AC01A091AD01B091AE01AC
:103AC000482359236A237B23CB01BA010C94D51CCC
:103AD00041E050E060E070E004C0440F551F661FF5
:103AE000771F8A95D2F78091AB019091AC01A0919C
:103AF000AD01B091AE01482759276A277B27CB013A
:103B0000BA010C94D51C0F931F930091AB01109137
:103B1000AC012091AD013091AE01602B712B822B55
:103B2000932B1F910F910C94D51C0F931F93009111
:103B3000AB011091AC012091AD013091AE01602339
:103B40007123822393231F910F910C94D51C0F9303
:103B50001F930091AB011091AC012091AD01309108
:103B6000AE0160277127822793271F910F910C9434
:103B7000D51C0895CF92DF92EF92FF920F931F937F
:103B8000CF93DF93EC01C090AF01D090B001E090F3
:103B9000B101F090B2018091AB019091AC01A09184
:103BA000AD01B091AE01C82AD92AEA2AFB2A0FE159
:103BB00010E0B701A601002E04C0769567955795D1
:103BC00047950A94D2F740FF07C0BE01802F0E949C
:103BD000E71F8130910539F40150110950F7BE01FA
:103BE00080E00E94E71FDF91CF911F910F91FF901E
:103BF000EF90DF90CF90089540910D0150910E010C
:103C000020E030E09FEFFA01E20FF31F62816817B6
:103C100099F09F3F19F4611101C0922F2F5F3F4F20
:103C20002630310581F79F3F39F0FA01E90FF11D88
:103C300097FDFA9582830895089540910D01509162
:103C40000E0120E030E0FA01E20FF31F9281981399
:103C500001C012822F5F3F4F26303105A1F7089532
:103C600081E090E0E0910D01F0910E01E80FF91F65
:103C70001082019688309105A9F708958091BD01C1
:103C800008959091BD01982B9093BD010895809562
:103C90009091BD0198239093BD0108958093BD013B
:103CA00008951092BD0108959091BC01982B9093B6
:103CB000BC01089580959091BC0198239093BC011C
:103CC00008951092BC0108958093B3010895109255
:103CD000B301089540910D0150910E0120E030E0B4
:103CE00080E0FA01E20FF31F918191118F5F2F5F46
:103CF0003F4F27303105A9F70895E0910D01F0916C
:103D00000E018091BD018083E0910D01F0910E01C3
:103D100080819091BC01892B80839091B30199237C
:103D200061F0E0910D01F0910E018081892B80837B
:103D30000E946A1E81111092B30180910D01909131
:103D40000E010C94FF119093350180933401089576
:103D50008295982F9C7C96959695837344E0849FDA
:103D600090011124922B892F8A7A86959575990F47
:103D7000892B08950895CF93DF9300D000D01F9230
:103D8000CDB7DEB70F900F900F900F900F90DF918F
:103D9000CF910895089508950C9472138091D301E2
:103DA000843009F11092BF0120E488E190E00FB661
:103DB000F894A895809360000FBE2093600083B7AD
:103DC000817F846083BF83B7816083BF7894889547
:103DD00083B78E7F83BF88E10FB6F894809360002D
:103DE000109260000FBE0895CF930E94C6130E94E8
:103DF00058080E94C713C0E08C2F0E943E09811111
:103E000005C0CF5FC031C1F780E001C081E0CF9134
:103E100008950E9474130C94A1181F920F920FB66C
:103E20000F9211248F939F93AF93BF938091BF0103
:103E3000811113C08091C0019091C101A091C20174
:103E4000B091C3014196A11DB11D8093C001909313
:103E5000C101A093C201B093C301BF91AF919F91E3
:103E60008F910F900FBE0F901F90189582E084BD28
:103E700093E095BD9AEF97BD80936E0008952FB79C
:103E8000F8948091C0019091C101A091C201B091BC
:103E9000C3012FBF08952FB7F8946091C0017091AE
:103EA000C1018091C2019091C3012FBF0895CF92AB
:103EB000DF92EF92FF920F931F932FB7F8944091E8
:103EC000C0015091C1016091C2017091C3012FBF27
:103ED0006A017B01EE24FF248C0120E030E0C01653
:103EE000D106E206F30610F441505109481B590B64
:103EF000CA011F910F91FF90EF90DF90CF9008952E
:103F00001F920F920FB60F9211248F939F93AF932E
:103F1000BF938091C0019091C101A091C201B09165
:103F2000C3010196A11DB11D8093C0019093C101F1
:103F3000A093C201B093C301BF91AF919F918F91A4
:103F40000F900FBE0F901F9018950E94170FF894B6
:103F50002FEF87EA91E6215080409040E1F700C0C2
:103F6000000087E090EBDC018093DC019093DD01A1
:103F7000A093DE01B093DF012CE088E190E00FB662
:103F8000F894A895809360000FBE20936000FFCF47
:103F900080E090E008950895E72FF0E090E1899F98
:103FA000E00DF11D112483E0EE0FFF1F8A95E1F76C
:103FB000E60FF11DEC51FF4F84910895E82FF0E0DA
:103FC000EE0FFF1FE05AF0408591949108950E94F2
:103FD000CC1F90E4980F903218F40E94DE1F0895D1
:103FE0008D3B60F4883AA0F5853A38F5843010F5B9
:103FF000813009F088C021E030E087C0883E98F425
:10400000803EC0F48F3B09F07EC00E94A1182FEFC4
:1040100080E792E0215080409040E1F700C000002E
:104020000E94A51F70C0803F08F46DC0282F30E0AB
:1040300030656BC0282F30E068C0853A21F0863AA1
:1040400021F492E803C091E801C093E880E458C0ED
:10405000883A51F1893A51F18A3A51F18B3A51F14A
:104060008C3A51F18D3A51F18E3A51F18F3A51F12A
:10407000813B51F1803B51F1823B51F1833B51F146
:10408000843B51F1853B51F1863B59F1873B59F116
:10409000883B59F1893B59F18A3B59F18B3B59F1E6
:1040A0008C3B61F59AE228C092EE29C099EE27C0B8
:1040B0009AEE25C095EB23C096EB21C093EB1FC071
:1040C00094EB1DC097EB1BC09CEC19C09DEC17C076
:1040D00093E805C09AE803C092E901C094E985E439
:1040E0000FC091E209C093E207C094E205C095E2D7
:1040F00003C096E201C097E286E402C090E084E447
:10410000292F382F02C020E030E0C90108958091A6
:10411000C60180FF0BC06091120185E0689FB0016D
:10412000112475956795759567952AC081FF09C01B
:104130006091120185E0689FB00111247595679523
:104140001FC082FF07C06091120185E0689FB00127
:10415000112416C04091C7014423C9F06091110198
:10416000461788F72091120185E0289F90011124BD
:10417000429FC001439F900D112470E00E942128AE
:104180006038710540F46115710539F002C065E0D1
:1041900070E0862F08958FE7089581E0089580915B
:1041A000C60180FF08C06091100170E075956795A9
:1041B0007595679521C081FF06C06091100170E080
:1041C0007595679519C082FF04C06091100170E079
:1041D00010C08091C7018823C1F060910F0186173C
:1041E000A0F790911001989FC001112470E00E94E7
:1041F00021286038710528F46115710521F0862F9A
:1042000008958FE7089581E0089561E070E0F4CFAC
:10421000803F21F40E948720819504C0813F29F4CA
:104220000E9487208093CA010895823F21F40E9452
:104230008720819504C0833F29F40E9487208093C2
:10424000C9010895893F19F40E94CF2005C08A3F13
:1042500031F40E94CF2081958093CB0108958B3F4C
:1042600021F40E94CF20819504C08C3F29F40E9444
:10427000CF208093CC010895843F21F48091C80120
:10428000816017C0853F21F48091C801826011C010
:10429000863F21F48091C80184600BC0873F21F4E0
:1042A0008091C801886005C0883F31F48091C801C1
:1042B00080618093C80108958D3F21F48091C601EB
:1042C00081600BC08E3F21F48091C601826005C0E1
:1042D0008F3F29F48091C60184608093C6010895C0
:1042E000803F39F48091CA0187FF6CC01092CA01E7
:1042F00069C0813F29F48091CA011816BCF362C0DD
:104300009091C901823F29F497FF5CC01092C901C6
:1043100059C0833F19F41916CCF354C0893F41F4B6
:104320008091CB0118160CF04DC01092CB014AC001
:104330008A3F29F48091CB0187FF44C0F6CF8B3FA1
:1043400039F48091CC0187FF3DC01092CC013AC076
:104350008C3F29F48091CC011816BCF333C0843F04
:1043600021F48091C8018E7F17C0853F21F4809190
:10437000C8018D7F11C0863F21F48091C8018B7FD9
:104380000BC0873F21F48091C801877F05C0883F1B
:1043900031F48091C8018F7E8093C80113C08D3F96
:1043A00021F48091C6018E7F0BC08E3F21F4809155
:1043B000C6018D7F05C08F3F29F48091C6018B7F98
:1043C0008093C6018091C90181110EC08091CA01FC
:1043D00081110AC08091CB01811106C08091CC016E
:1043E000811102C01092C70108958091BE0183FF20
:1043F0007EC08DE595E00E94EB058091C8011F927B
:104400008F9388E595E09F938F930E94840686E5BD
:1044100095E00E94EB052091C901822F992787FD25
:1044200090959F932F9383E595E09F938F930E94A0
:10443000840681E595E00E94EB052091CA01822F58
:10444000992787FD90959F932F938EE495E09F93F6
:104450008F930E9484068CE495E00E94EB052091E6
:10446000CB01822F992787FD90959F932F9389E405
:1044700095E09F938F930E94840687E495E00E94C5
:10448000EB052091CC01822F992787FD90959F9372
:104490002F9384E495E09F938F930E94840681E498
:1044A00095E00E94EB058091C7011F928F938EE3E8
:1044B00095E09F938F930E9484068CE395E00E9481
:1044C000EB058091C6011F928F9389E395E09F933E
:1044D0008F930E94840686E395E00E94EB058DB7DA
:1044E0009EB74C960FB6F8949EBF0FBE8DBF88EC5A
:1044F00091E00E9444120E943F1F9093C501809357
:10450000C40108951F93CF93DF938091C4019091CC
:10451000C5010E94571F4091C701442321F02091FB
:10452000130130E006C0209114015AE0259F90014C
:1045300011248217930708F482C08091C901109159
:10454000CA01D091CB01C091CC01811107C01111DA
:1045500005C0D11103C0CC2309F471C04F3F19F03D
:104560004F5F4093C701181624F40E948720809360
:10457000C9018091C90187FF05C00E9487208195EC
:104580008093C901111624F40E9487208093CA01E8
:104590008091CA0187FF05C00E9487208195809382
:1045A000CA016091C901662339F11091CA01112332
:1045B00019F1772767FD7095872F972F0E9426277F
:1045C00023E333E343E35FE30E948A270E94F32659
:1045D0006093C901612F772767FD7095872F972F0B
:1045E0000E94262723E333E343E35FE30E948A2705
:1045F0000E94F3266093CA011D1624F40E94CF2066
:104600008093CB018091CB0187FF05C00E94CF2012
:1046100081958093CB011C1624F40E94CF208093B7
:10462000CC018091CC0187FF05C00E94CF208195ED
:104630008093CC01DF91CF911F910C94F521DF91F4
:10464000CF911F910895E8ECF1E085E0DF011D9224
:104650008A95E9F71092C7011092C601089580E883
:1046600097E00E94EB051F9281E08F931F9285E0F7
:104670008F9382E397E09F938F930E9484060F901D
:104680000F900F900F900F900F9008958330E9F1E5
:1046900028F4813061F0823009F10895853009F401
:1046A00062C008F449C0863009F474C008952091AE
:1046B0001401862F90E0820F911D8F3F910520F409
:1046C000620F6093140103C08FEF809314018091F7
:1046D00014011F928F938BE696E072C02091130114
:1046E000862F90E0820F911D8F3F910520F4620F7D
:1046F0006093130103C08FEF809313018091130126
:104700001F928F9389E596E05BC020911201862F5E
:1047100090E0820F911D8F3F910520F4620F60930E
:10472000120103C08FEF80931201809112011F923A
:104730008F9386E496E044C020911101862F90E08B
:10474000820F911D8F3F910520F4620F609311013C
:1047500003C08FEF80931101809111011F928F93FD
:1047600081E396E02DC020911001862F90E0820F0A
:10477000911D8F3F910520F4620F6093100103C0DB
:104780008FEF80931001809110011F928F9388E129
:1047900096E016C020910F01862F90E0820F911DA8
:1047A0008F3F910520F4620F60930F0103C08FEFDC
:1047B00080930F0180910F011F928F938DEF95E0F1
:1047C0009F938F930E9484060F900F900F900F90ED
:1047D0000895833081F128F4813059F08230D1F08E
:1047E0000895853009F449C0B8F1863009F456C0FF
:1047F000089580911401681720F4861B809314019A
:1048000002C010921401809114011F928F938EEEBA
:1048100095E054C080911301681720F4861B8093A3
:10482000130102C010921301809113011F928F9304
:104830008CED95E043C080911201681720F4861B2F
:104840008093120102C010921201809112011F92F6
:104850008F9389EC95E032C080911101681720F4A4
:10486000861B8093110102C01092110180911101E9
:104870001F928F9384EB95E021C0809110016817FF
:1048800020F4861B8093100102C0109210018091C9
:1048900010011F928F938BE995E010C080910F015A
:1048A000681720F4861B80930F0102C010920F013D
:1048B00080910F011F928F9380E895E09F938F93D3
:1048C0000E9484060F900F900F900F900895CF9341
:1048D000C82F1F928F9325E838E03F932F930E94B3
:1048E000840661E070E080E090E004C0660F771F0E
:1048F000881F991FCA95D2F70E94E21C0F900F9053
:104900000F900F90CF910C94A118CF93873288F518
:104910008E3108F008C18E3009F486C0D8F4873093
:1049200009F460C08B3009F44FC0863009F0FFC035
:104930008091BE01817F8E7F8093BE018AE898E0DE
:104940000E94EB058EE29BE00E94EB0581E08093E4
:10495000CE0146C0863109F4ADC020F4803109F49F
:1049600078C0E5C0893109F48EC08B3109F449C0A3
:10497000DEC0883349F150F4893209F4D2C085335E
:1049800009F4CFC0873209F0D2C0CBC0833409F418
:10499000C8C028F48A3308F4CAC08953C5C0883413
:1049A00009F0C5C00E94A1188DE19BE00E94EB05B3
:1049B0002FEF83ED90E3215080409040E1F700C05D
:1049C00000000E94A51F0CC081EB98E03FC084E06E
:1049D0009BE00E94EB058091BE0181608093BE0147
:1049E000C1E0AAC08091BE01C82FC17080FFEFCF87
:1049F00080E19BE00E94EB058091BE01817F8E7F6C
:104A00003CC08091BE0181FBCC27C0F991E0C92751
:104A1000C0FB81F98093BE01CC2319F087EF9AE0A7
:104A200027C089EE9AE012C08091BE0182FBCC279C
:104A3000C0F991E0C927C0FB82F98093BE01CC2365
:104A400019F08AED9AE014C08AEC9AE00E94EB0516
:104A5000C7CF8091BE0183FBCC27C0F991E0C92765
:104A6000C0FB83F98093BE01CC2351F08EEB9AE01A
:104A70000E94EB058091BE0181608093BE015CC005
:104A800081EB9AE0E3CF82EA9AE00E94EB058FE7A0
:104A90009AE00E94EB058AE39AE00E94EB0583E12D
:104AA0009AE00E94EB058DED99E00E94EB058FEAFC
:104AB00099E0CCCF81EA99E00E94EB050E94F311C6
:104AC0001F928F9387E899E09F938F930E948406AB
:104AD00080910C011F928F9380E799E09F938F93B1
:104AE0000E94840680915B011F928F938DE599E06F
:104AF0009F938F930E9484060E944B1F9F938F93D6
:104B00007F936F9386E499E09F938F930E9484062E
:104B10008DB79EB742960FB6F8949EBF0FBE8DBF5D
:104B20005FCF80E001C08D510E94672459CF84E49B
:104B300099E00E94EB05C0E08C2FCF91089580E0B2
:104B4000089580E00895CF93C82F8091CE018130E1
:104B500069F020F0823009F446C03DC167E08FE083
:104B60000E947613882309F43CC106C067E08FE0F9
:104B70000E947613882349F08C2F0E949F25811173
:104B80002FC08C2F0E9485242CC08C2F0E94A12521
:104B9000811126C0C431E1F070F4CB3081F0C03116
:104BA000D1F40E942F238DE798E00E94EB0582E06C
:104BB0008093CE0115C0C93259F0C83361F48AE838
:104BC00098E00E94EB0581E898E00E94EB0508C0A0
:104BD0001092CE0104C18BE798E00E94EB05FFC064
:104BE00081E08170FEC0C43228F5CE3108F0C1C02A
:104BF000CB30A1F1D0F4C73009F0D3C08EE180935F
:104C0000140182E3809313018AE08093120184E10E
:104C10008093110188E08093100188E280930F0156
:104C200081E297E00E94EB05BFC0C33149F1C43176
:104C3000C1F0B7C0CB3409F4A9C028F4C93289F057
:104C4000C83361F0AEC0C13509F49EC0C23509F465
:104C500099C0CE3409F0A5C06AE09EC00E942F23FF
:104C6000A3C08091CD01882319F01092CD019CC082
:104C70008EE297E00E94EB0581E08093CE01B1C007
:104C800088E097E00E94EB0586EF96E00E94EB0536
:104C9000809114011F928F9383EF96E09F938F93DF
:104CA0000E94840681EF96E00E94EB058FED96E06E
:104CB0000E94EB05809113011F928F938CED96E07B
:104CC0009F938F930E9484068AED96E00E94EB05E5
:104CD0008BEC96E00E94EB05809112011F928F935E
:104CE00088EC96E09F938F930E94840686EC96E072
:104CF0000E94EB0585EB96E00E94EB058091110187
:104D00001F928F9382EB96E09F938F930E9484066D
:104D100080EB96E00E94EB058BE996E00E94EB05A4
:104D2000809110011F928F9388E996E09F938F9353
:104D30000E94840686E996E00E94EB058FE796E0E4
:104D40000E94EB0580910F011F928F938CE796E0F4
:104D50009F938F930E9484068AE796E00E94EB055A
:104D60008DB79EB748960FB6F8949EBF0FBE8DBF05
:104D70001BC0CE51EC2FF0E0E65DFE4F80818093AA
:104D8000CD0112C061E003C061E006C06AE080911D
:104D9000CD010E94462308C08091CD010E94E923E5
:104DA00003C08FE197E013C08091CD01882369F0A3
:104DB0001F928F9389E197E09F938F930E948406BF
:104DC0000F900F900F900F9004C086E197E00E9423
:104DD000EB0581E006C01092CE0180E002C080E0C9
:104DE00000CFCF91089504D06894B1118DC008957B
:104DF00070D088F09F5790F0B92F9927B751A0F045
:104E0000D1F0660F771F881F991F1AF0BA95C9F75E
:104E100012C0B13081F077D0B1E0089574C0672F2F
:104E2000782F8827B85F39F0B93FCCF3869577950E
:104E30006795B395D9F73EF49095809570956195F7
:104E40007F4F8F4F9F4F0895E89409C097FB3EF422
:104E500090958095709561957F4F8F4F9F4F9923C7
:104E6000A9F0F92F96E9BB279395F6958795779545
:104E70006795B795F111F8CFFAF4BB0F11F460FF05
:104E80001BC06F5F7F4F8F4F9F4F16C0882311F05D
:104E900096E911C0772321F09EE8872F762F05C071
:104EA000662371F096E8862F70E060E02AF09A950C
:104EB000660F771F881FDAF7880F9695879597F901
:104EC000089557FD9058440F551F59F05F3F71F0FA
:104ED0004795880F97FB991F61F09F3F79F0879561
:104EE0000895121613061406551FF2CF4695F1DFEA
:104EF00008C0161617061806991FF1CF869571057A
:104F0000610508940895E894BB2766277727CB01AD
:104F100097F908950BD078C069D028F06ED018F0BA
:104F2000952309F05AC05FC01124EECFCADFA0F369
:104F3000959FD1F3950F50E0551F629FF001729F2E
:104F4000BB27F00DB11D639FAA27F00DB11DAA1F4D
:104F5000649F6627B00DA11D661F829F2227B00D9A
:104F6000A11D621F739FB00DA11D621F839FA00D25
:104F7000611D221F749F3327A00D611D231F849F75
:104F8000600D211D822F762F6A2F11249F575040CC
:104F90008AF0E1F088234AF0EE0FFF1FBB1F661F67
:104FA000771F881F91505040A9F79E3F510570F020
:104FB00014C0AACF5F3FECF3983EDCF3869577955B
:104FC0006795B795F795E7959F5FC1F7FE2B880F1B
:104FD000911D9695879597F9089597F99F6780E8B1
:104FE00070E060E008959FEF80EC089500240A943B
:104FF0001616170618060906089500240A941216B4
:105000001306140605060895092E0394000C11F4E6
:10501000882352F0BB0F40F4BF2B11F460FF04C093
:105020006F5F7F4F8F4F9F4F0895991B79E004C0AA
:10503000991F961708F0961B881F7A95C9F78095D7
:10504000089597FB072E16F4009407D077FD09D03A
:105050000E943B2807FC05D03EF4909581959F4F18
:105060000895709561957F4F0895EE0FFF1F05908D
:10507000F491E02D0994AA1BBB1B51E107C0AA1FA4
:10508000BB1FA617B70710F0A61BB70B881F991FE9
:105090005A95A9F780959095BC01CD010895F89493
:0250A000FFCF40
:1050A200FFFF680A590B360B020BCF0A01B4012825
:1050B20008140A321E404D36229E0451041B04F984
:1050C2000385039E03B703D0030001020304050610
:0450D20007080900C2
:00000001FF
Title: Re: ADB to USB keyboard converter
Post by: Tactile on Thu, 06 April 2017, 13:10:17
Hi All,

I'm following this handy little guide to convert the Apple Extended Keyboard II to USB:
http://ifixit.org/blog/4468/hack-it-better-apple-extended-keyboard-ii/ (http://ifixit.org/blog/4468/hack-it-better-apple-extended-keyboard-ii/)

I followed all of the instructions to the letter but I have a problem. The Teensy 2 powers on when plugged as does the Keyboard Num Lock, Caps Lock and Scroll Lock LEDs. The Teensy' LED is on constantly but flashes every 10 seconds. When it flashes the mouse pointer on the screen moves about an inch to the right.

I'm still a bit new to micro controllers and Hex Code so I can't debug the issue myself, to my eyes it seems all good. I've included the code used and my wiring.

Any advice is much appreciated!

Thanks!

http://imgur.com/a/omVjP (http://imgur.com/a/omVjP)

Code: [Select]
:100000000C9499050C94DD050C94DD050C94DD052C
:100010000C94DD050C94DD050C94DD050C94DD05D8
:100020000C94DD050C94DD050C94920F0C94641077
:100030000C940D1F0C94DD050C94DD050C94DD056E
:100040000C94DD050C94DD050C94DD050C94DD05A8
:100050000C94DD050C94801F0C94DD050C94DD05DB
:100060000C94DD050C94DD050C94DD050C94DD0588
:100070000C94DD050C94DD050C94DD050C94DD0578
:100080000C94DD050C94DD050C94DD050C94DD0568
:100090000C94DD050C94DD050C94DD050C94DD0558
:1000A0000C94DD050C94DD050C94DD05C910EB10F6
:1000B000D611EB10D6112D115011D611A511B81172
:1000C000B715B715E515E51541167D16801880188A
:1000D000951680188C178C175A18801880186E186F
:1000E00035A131A1041607090B0A1D1B0619640569
:1000F000141A08151C171E1F202123222E26242D1A
:1001000025273012182F0C13280F0D340E33C1364B
:10011000381110372B2CC02A5829E0E3E182E25035
:100120004F5152006C6365556D570053A9AAA854EE
:100130005800566D6E2E62595A5B5C5D5E5F6F6053
:10014000618987853E3F403C4142914490466B47E0
:10015000004365450048494A4B4C3D4D3B4E3AE50E
:10016000E6E40000AAA9A8090B0A1D1B06196405EC
:10017000141A08151C173A3B3C3D3F3E454240448B
:100180004143494718524648284B0D4F4A50C14DEC
:100190005111104E2B2CC04C5835E0E3E182E24A5D
:1001A0004D4E4B006CF565F66DF90053A9AAA8F504
:1001B000F600FA6D6EF4F4FBF1FCF2F1F3FA6FF075
:1001C000F98987853E3F403C4142914490466B47C8
:1001D000004365450048494A4B4C3D4D3B4E3AE58E
:1001E000E6E400006164625F686F73745F6B626471
:1001F0005F726563763A204552524F522825642932
:100200000A000A0025303458006164625F686F7329
:10021000745F6B62645F726563763A200045525288
:100220004F523A206D65646961206B6579300A0030
:100230004552524F523A206D65646961206B657971
:10024000310A005D0A0025640020002564007C005E
:100250002530325800200025303258006164625F3A
:100260006D6F757365207261773A205B000A002517
:1002700030313662006164625F686F73745F6D6F06
:100280007573655F726563763A20006465627567B1
:1002900020656E61626C65642E0A005363616E3A7C
:1002A00020616464723A25642C20726567333A25B4
:1002B0003034580A00416674657220696E69743A78
:1002C0000A00466F756E643A206D65646961206B43
:1002D0006579730A005363616E3A20616464723A0F
:1002E00025642C20726567333A253034580A004261
:1002F00065666F726520696E69743A0A004B6579AC
:10030000626F6172642073746172742E0A005553B7
:100310004220636F6E666967757265642E0A000D10
:100320000A696E69740A005B445D005B435D002EE0
:100330000341004400420020006B00650079006228
:10034000006F00610072006400200063006F006EA7
:100350000076006500720074006500720000000EF7
:100360000374002E006D002E006B002E00000004B0
:1003700003090409027400040100A032090400000A
:1003800001030101000921110100012240000705BC
:10039000810308000A090401000103010200092188
:1003A00011010001224D000705820308000A09041B
:1003B00002000103000000092111010001223600A2
:1003C0000705830308000A09040300020300000074
:1003D00009211101000122220007058403200001E8
:1003E000070504032000011201100100000008EDC0
:1003F000FEDB0A0101010200010631FF0974A101BF
:100400000975150026FF00952075088102097615EB
:100410000026FF00952075089102C005010980A102
:1004200001850216810026B7001A81002AB70075DF
:100430001095018100C0050C0901A1018503160179
:1004400000269C021A01002A9C0275109501810069
:10045000C005010902A1010901A10005091901292D
:10046000051500250195057501810295017503812A
:10047000010501093009311581257F950275088133
:100480000609381581257F950175088106050C0A36
:1004900038021581257F950175088106C0C00501C8
:1004A0000906A101050719E029E7150025019508AE
:1004B0007501810295017508810105081901290559
:1004C00095057501910295017503910105071900C4
:1004D00029FF150026FF00950675088100C0636F8F
:1004E0006E73756D65723A20253034580A00737941
:1004F0007374656D3A20253034580A000A0025309F
:10050000325820006B6579626F6172643A20004C4A
:1005100045443A20253032580A00253032583A20D6
:100520002530386225730A00722F63203031323350
:10053000343536370A00290A002575002F00257545
:10054000005D28002564002000256400200025644B
:100550000020002564007C0025303258006D6F7546
:1005600073656B6579205B62746E7C782079207688
:1005700020685D287265702F61636C293A205B00EA
:100580006D6B5F776865656C5F74696D655F746FCF
:100590005F6D6178203D2025640A006D6B5F776890
:1005A00065656C5F6D61785F7370656564203D2083
:1005B00025640A006D6B5F74696D655F746F5F6DB4
:1005C0006178203D2025640A006D6B5F6D61785F66
:1005D0007370656564203D2025640A006D6B5F695A
:1005E0006E74657276616C203D2025640A006D6B27
:1005F0005F64656C6179203D2025640A006D6B5F46
:10060000776865656C5F74696D655F746F5F6D6158
:1006100078203D2025640A006D6B5F776865656C06
:100620005F6D61785F7370656564203D2025640AA5
:10063000006D6B5F74696D655F746F5F6D617820CD
:100640003D2025640A006D6B5F6D61785F73706596
:100650006564203D2025640A006D6B5F696E7465DA
:100660007276616C203D2025640A006D6B5F6465C5
:100670006C6179203D2025640A000A00257500364A
:100680003A20776865656C5F74696D655F746F5F4C
:100690006D61783A20000A00257500353A207768A8
:1006A00065656C5F6D61785F73706565643A2000A5
:1006B0000A00257500343A2074696D655F746F5FB8
:1006C0006D61783A20000A00257500333A206D618B
:1006D000785F73706565643A20000A002575003202
:1006E0003A20696E74657276616C286D73293A20C0
:1006F000000A00257500313A2064656C6179282A6A
:1007000031306D73293A20000A092D2056616C752D
:100710006573202D0A004D3E004D25643E20003FAC
:10072000007365742064656661756C740A00433EED
:10073000200077686572652064656C74613A206397
:100740007572736F723D25642C20776865656C3D0A
:1007500025640A53656520687474703A2F2F656E9E
:100760002E77696B6970656469612E6F72672F7788
:10077000696B692F4D6F7573655F6B6579730A00DF
:100780000A092D204D6F7573656B6579202D0A451B
:1007900053432F713A09717569740A313A096465D6
:1007A0006C6179282A31306D73290A323A09696EF1
:1007B00074657276616C286D73290A333A096D612C
:1007C000785F73706565640A343A0974696D655FB2
:1007D000746F5F6D61780A353A09776865656C5F9B
:1007E0006D61785F73706565640A363A097768658C
:1007F000656C5F74696D655F746F5F6D61780A0A1F
:10080000703A097072696E742076616C7565730A4E
:10081000643A097365742064656661756C74730A63
:1008200075703A092B310A646F776E3A092D310AD7
:10083000706775703A092B31300A7067646F776E94
:100840003A092D31300A0A7370656564203D2064D1
:10085000656C7461202A206D61785F7370656564D2
:10086000202A2028726570656174202F2074696DBC
:10087000655F746F5F6D6178290A003F004D3E200F
:1008800000433E20004C25640A000A092D20436FD6
:100890006E736F6C65202D0A4553432F713A0971B1
:1008A0007569740A6D3A096D6F7573656B65790AC0
:1008B000000A092D204D61676963202D0A643A09F9
:1008C00064656275670A783A096465627567206DC8
:1008D00061747269780A6B3A096465627567206BA6
:1008E0006579626F6172640A6D3A09646562756761
:1008F000206D6F7573650A763A0976657273696F54
:100900006E0A733A097374617475730A633A096302
:100910006F6E736F6C65206D6F64650A302D343AAD
:10092000096C61796572302D34284631302D46349A
:10093000290A506175733A09626F6F746C6F616454
:1009400065720A003F0074696D65725F726561646B
:10095000333228293A202530346C580A006B6579E7
:10096000626F6172645F69646C653A2025580A00A1
:100970006B6579626F6172645F70726F746F636FC1
:100980006C3A2025580A00686F73745F6B65796252
:100990006F6172645F6C65647328293A2025580A78
:1009A000000A092D20537461747573202D0A0047C5
:1009B00043433A20342E382E31204156522D4C4993
:1009C00042433A20312E382E3073766E20415652F3
:1009D0005F415243483A20617672350A004F5054C5
:1009E000494F4E533A204C554641204D4F555345A3
:1009F0004B45592045585452414B455920434F4E81
:100A0000534F4C4520434F4D4D414E4420343039D7
:100A1000360A004255494C443A20346265666338D0
:100A200037202830303A30353A3233204170722046
:100A300020362032303137290A005649443A2030D6
:100A4000784645454428742E6D2E6B2E292050493A
:100A5000443A2030783041444228414442206B657A
:100A600079626F61726420636F6E7665727465720D
:100A700029205645523A203078303130310A00442E
:100A80004553433A20636F6E766572742041444249
:100A9000206B6579626F61726420746F20555342D8
:100AA0000A000A092D2056657273696F6E202D0A9F
:100AB000000A6D6F7573653A206F66660A000A6DED
:100AC0006F7573653A206F6E0A000A6B6579626F05
:100AD0006172643A206F66660A000A6B6579626F1C
:100AE0006172643A206F6E0A000A6D6174726978EF
:100AF0003A206F66660A000A6D61747269783A205E
:100B00006F6E0A000A64656275673A206F6E0A00AC
:100B10000A64656275673A206F66660A000A0A62AF
:100B20006F6F746C6F616465722E2E2E2000433ED1
:100B3000200011241FBECFEFDAE0DEBFCDBF04B628
:100B400003FE24C08091DC019091DD01A091DE01C3
:100B5000B091DF018730904BA740B04BB9F41092B1
:100B6000DC011092DD011092DE011092DF0114BE53
:100B700084B7877F84BF88E10FB6F89480936000C4
:100B8000109260000FBEE0E0F8E3099511E0A0E0EC
:100B9000B1E0E2EAF0E502C005900D92A433B1079E
:100BA000D9F721E0A4E3B1E001C01D92AC3DB2074A
:100BB000E1F70E94C50C0C944F280C940000FF93A1
:100BC000EF93E0913401F0913501309709F00995E8
:100BD000EF91FF910895FC018591803011F0EFDFD6
:100BE000FBCF0895FF27E0E230E247FF0CC04195BC
:100BF00097FF09C0EDE26095709580959095611D15
:100C0000711D811D911D27FF02C0219530E350E227
:100C1000AA27660F771F881F991FAA1FA41710F015
:100C2000A41B63955A95A9F7AA3008F0A95FA05DA7
:100C3000AF93F395611571058105910541F7ED328B
:100C400011F4EF93F395F21718F43F93F395FBCF5C
:100C50008F91B5DFFA95E1F70895E991F9918591C2
:100C6000803021F0853219F0AADFF9CF089520E015
:100C7000E89455915532C1F3503311F4689455916D
:100C80005A3348F4505390F3220F022E220F220FB2
:100C9000200D250FF4CF0EF42195899199915336AB
:100CA00019F3533729F1533559F1BC018827992796
:100CB000E8945C3621F48991999168945591543661
:100CC00039F446EF7EF077FF0DC08FEF9FEF0AC03B
:100CD00055374AE039F0583540E121F0523642E0CC
:100CE00009F00895FF93EF937DDFEF91FF91B7CF68
:100CF000FF93EF93FC0181918030B9F360DFFBCF6C
:100D0000FF93EF9368DFF1CFDF93CF93CDB7DEB7DB
:100D10002596A3DFCF91DF910895282F2770E82F24
:100D2000E695E695E695EF70F0E0E95CFE4F87FF0B
:100D30000CC081E090E0022E01C0880F0A94EAF70F
:100D40008095908189238083089581E090E0022E30
:100D500001C0880F0A94EAF79081982B9083089538
:100D60000F931F93CF93DF93569A5E9A0E949E092A
:100D70002FEF87EA91E6215080409040E1F700C0D4
:100D800000008FEE92E09F938F930E9484060F9055
:100D90000F90C1E0D0E005ED12E063E08C2F0E94DF
:100DA000A209009771F09F938F93DF93CF931F93C6
:100DB0000F930E9484060F900F900F900F900F904A
:100DC0000F909FEF29EF80E0915020408040E1F7A5
:100DD00000C000002196C031D105F9F663E082E041
:100DE0000E94A20999278131910511F174F487308D
:100DF0009105F1F024F404970297F0F419C08930BA
:100E00009105B1F00D97C1F413C08D31910581F0BA
:100E100034F48431910561F0499771F409C0843C40
:100E2000910531F0873C910519F0813C910521F441
:100E300081E080934C0102C010924C0163E087E096
:100E40000E94A20991E0823009F090E090934D0158
:100E5000992341F082EC92E09F938F930E94840645
:100E60000F900F9023E042E063E082E00E94270AA7
:100E700085EB92E09F938F930E9484060F900F90D2
:100E8000C1E0D0E00BE912E063E08C2F0E94A209E0
:100E9000009771F09F938F93DF93CF931F930F93DE
:100EA0000E9484060F900F900F900F900F900F905C
:100EB0008FEF99EF20E0815090402040E1F700C093
:100EC00000002196C031D105F9F6E7E3F1E0119277
:100ED00081E0E734F807D9F70E94F3110E94440932
:100EE0008091BE0181608093BE018BE892E00E94F8
:100EF000EB05569A5E98DF91CF911F910F9108955F
:100F0000CF93DF938FE79BEB0197F1F700C00000D1
:100F10000E94230AEC01009711F481E0C4C097FD00
:100F200005C080914701816080934701D7FF05C0CC
:100F3000809147018E7F809347018D2F99278F7372
:100F40009927AE014F735527C6FF02C0405451097F
:100F5000D6FF02C08054910960913601772767FD62
:100F60007095469F9001479F300D569F300D11247C
:100F700021384FEF340714F421E83FEF31952195E4
:100F8000310921384FEF340714F421E83FEF219560
:100F900020934801869F9001879F300D969F300DCA
:100FA000112421388FEF380714F421E83FEF882708
:100FB0009927821B930B81382FEF920714F481E855
:100FC0009FEF8195809349018091BE0183FF60C0AE
:100FD00085E792E00E94EB05DF93CF938FE692E0E6
:100FE0009F938F930E9484068DE692E00E94EB050A
:100FF0008CE592E00E94EB0520913601822F992723
:1010000087FD90959F932F9387E592E09F938F9311
:101010000E94840685E592E00E94EB0580914701DD
:101020001F928F9380E592E09F938F930E94840696
:101030008EE492E00E94EB0520914801822F9927CF
:1010400087FD90959F932F938BE492E09F938F93CE
:101050000E94840689E492E00E94EB0520914901F8
:10106000822F992787FD90959F932F9386E492E096
:101070009F938F930E94840683E492E00E94EB0585
:101080008DB79EB744960FB6F8949EBF0FBE8DBF26
:1010900087E491E00E9444128091360191E088300B
:1010A0000CF090E0890F80933601DF91CF91089585
:1010B0001F93CF93DF93C0910001D09101018FEF77
:1010C0009FEF9093010180930001CF3F8FEFD807EE
:1010D00009F06AC08FE79BEB0197F1F700C00000B1
:1010E00082E00E94200AEC01009709F05DC0809127
:1010F0004D01882309F458C087E00E94200A009718
:1011000009F452C09C012F77332722303105A1F01A
:1011100048F42115310569F02130310599F48078C2
:101120008A641AC02330310551F02F373105A1F000
:1011300009C08078826410C0807889640DC080788E
:1011400088640AC080E392E09F938F930E94840694
:101150000F900F9081E18EC0292F33272F773327EF
:101160002130310579F050F02230310579F023300B
:10117000310581F4EC01D078D86416C0EC01D07848
:10118000D26412C0EC01D078DA640EC0EC01D078E1
:10119000D9640AC08DE192E09F938F930E948406E8
:1011A0000F900F9080E166C08091BE0181FF18C052
:1011B000209709F45CC089E092E00E94EB05DF9380
:1011C000CF9384E092E09F938F930E94840682E005
:1011D00092E00E94EB050F900F900F900F9003C0CC
:1011E000209709F444C0CF379FE7D90711F48FE760
:1011F00005C0CF3F8FEFD80721F48FEF0E948D06F7
:1012000038C02D2F3327822F1C2F2F3F81F4DF93DF
:10121000CF9384EE91E09F938F930E9484060E9467
:10122000B0060F900F900F900F908C2F23C09091CD
:101230004C01992381F0A9014F775527423351057D
:1012400021F4822F80788A6006C04A30510519F453
:10125000822F807882630E948D061F3F51F0DC2F21
:10126000CC27CF6FD0930101C093000102C080E072
:1012700001C081E0DF91CF911F910895E82FF0E048
:10128000E95CFE4F80810895682F609582E00C94A0
:10129000620A509A83E091E00197F1F700C00000E4
:1012A00050989AEB9A95F1F700C00895509A8AEBFE
:1012B0008A95F1F700C0509883E091E00197F1F72B
:1012C00000C000000895EF92FF920F931F93CF93F9
:1012D000DF93C0E0D0E000E810E0E82EF12C9801A8
:1012E0000C2E02C0359527950A94E2F72E213F2156
:1012F000232B19F00E94560902C00E944909219629
:10130000C830D10561F7DF91CF911F910F91FF9008
:10131000EF900895489B07C023E02A95F1F700005D
:1013200001970097B9F70895489907C023E02A95D7
:10133000F1F7000001970097B9F708955898509871
:1013400008950895CF92DF92EF92FF920F931F932B
:10135000CF93DF931F92CDB7DEB7182FF894509A32
:1013600083EF9BE00197F1F700C0000069830E94C2
:10137000560969816C60E0E11E9FC0011124862B33
:101380000E9463090E94490984EF91E00E94940938
:10139000892B21F4789482EE9FEF48C084EF91E08E
:1013A0000E948A09892B21F4789480E090E03EC065
:1013B00021E1F22EC12CD12C32E8E32E82E890E01C
:1013C0000E9494098C01882359F199270E948A0967
:1013D000882331F1CC0CDD1C9E2D901B081B90172F
:1013E00018F46894C0F807C0F1E1FF1204C07894C3
:1013F0008CEE9FEF1BC0FA9409F78FE591E00E94F5
:101400009409892B21F478948BEE9FEF0FC08BE524
:1014100090E00E948A09892BB1F77894C60106C032
:1014200078948F2D90E09195819591090F90DF919F
:10143000CF911F910F91FF90EF90DF90CF90089583
:1014400060E00C94A20960E083E00C94A2091F9371
:10145000CF93DF9300D01F92CDB7DEB7182FF8944B
:10146000509A83EF9BE00197F1F700C000002B83B7
:101470004A8369830E9456096981862F886090E1BA
:10148000199FF00111248E2B0E9463090E944909C3
:10149000EFE1F3E03197F1F700C000000E94560938
:1014A0004A81842F0E9463092B81822F0E94630945
:1014B0000E94490978940F900F900F90DF91CF917F
:1014C0001F910895262F277040E062E00C94270AB0
:1014D00080915A0108959FB7F894109251019FBFCF
:1014E0009091D301943009F058C09091E9009F7019
:1014F0002091EC0020FF02C020E801C020E0292B51
:1015000094E09093E9009091EB0090FF43C090919C
:10151000EE0097FF3FC090914E01992321F09091EA
:10152000E80095FF37C010924E0196E03091E80038
:1015300035FD15C03091D301343061F53091EB00A9
:1015400035FD28C0915021F481E080934E0122C0E6
:10155000EFE9FFE03197F1F700C00000E7CF80939B
:10156000F1008091E80085FD0AC08091E80080FFCD
:10157000FCCF8091E8008E778093E80006C08FB79B
:10158000F89491E0909351018FBF2F702093E90060
:1015900080E008952F702093E9008FEF0895CF9396
:1015A000DF9300D01F92CDB7DEB72091D301243056
:1015B00019F523E029839B838A832093E9008FEF29
:1015C0009091E800815095FD06C095ED9A95F1F750
:1015D00000008111F5CF8091E80085FF0DC040E04B
:1015E00050E063E070E0CE0101960E94850D80918D
:1015F000E8008E778093E8000F900F900F90DF91B6
:10160000CF910895CF93DF9300D01F92CDB7DEB76F
:101610002091D301243021F522E029839B838A8302
:1016200083E08093E9008FEF9091E800815095FD71
:1016300006C095ED9A95F1F700008111F5CF8091E4
:10164000E80085FF0DC040E050E063E070E0CE01AF
:1016500001960E94850D8091E8008E778093E800C6
:101660000F900F900F90DF91CF9108952091D301AB
:101670002430F1F422E02093E9002FEF3091E800CC
:10168000215035FD06C035ED3A95F1F700002111E6
:10169000F5CF2091E80025FF0BC040E050E065E069
:1016A00070E00E94850D8091E8008E778093E800BD
:1016B0000895CF93DF93EC018091D301843039F505
:1016C00081E08093E9008FEF9091E800815095FDD3
:1016D00006C095ED9A95F1F700008111F5CF809144
:1016E000E80085FF14C040E050E068E070E0CE0103
:1016F0000E94850D8091E8008E778093E80088E055
:10170000FE01A2E5B1E001900D928A95E1F7DF912B
:10171000CF9108958BE293E00E94EB058091D20176
:10172000811109C00E94170F0E94740F8091E2007E
:1017300084608093E200089587E293E00E94EB05C5
:101740001092D2010895089580914F018F5F809388
:101750004F0162E30E941528911135C010924F018C
:1017600080915101882379F18091D301843049F52A
:101770008091E9008F709091EC0090FF02C090E89A
:1017800001C090E0982B84E08093E9008091EB0009
:1017900080FF14C08091EE0087FF10C08091E800A8
:1017A00085FF03C01092F100F9CF8091E80080FF1F
:1017B00005C08091E8008E778093E8009F70909339
:1017C000E90010925101089542E061EC81E00E942D
:1017D000910E42E061EC82E00E94910E42E061ECE9
:1017E00083E00E94910E42E261EC84E00C94910E41
:1017F0008091D501833009F453C030F4813071F009
:10180000823009F48CC008958A3009F478C08B3096
:1018100009F45EC0893009F09AC020C08091D401DB
:10182000813A09F094C08091E800877F8093E800B6
:101830008091D8019091D901892B21F060E080E05E
:1018400090E003C068E082E591E070E00E94CE0D78
:101850008091E8008B778093E80008958091D4010F
:10186000813209F074C08091D8019091D901892BFF
:1018700009F06DC08091E800877F8093E800809137
:10188000E80082FD05C08091D3018111F8CF5FC0CF
:101890008091F10080935A018091E8008B7753C0CA
:1018A0008091D401813A09F052C08091D801909181
:1018B000D901892B09F04BC08091E800877F809384
:1018C000E8008091E80080FFFCCF80910C0136C0D9
:1018D0008091D4018132D9F58091D8019091D901BC
:1018E000892BA9F58091E800877F8093E8000E940A
:1018F000C60E8091D60180930C010C94A1188091A2
:10190000D401813221F58091E800877F8093E8003F
:101910000E94C60E8091D70180935B01089580914B
:10192000D401813AA1F48091E800877F8093E80098
:101930008091E80080FFFCCF80915B018093F100F3
:101940008091E8008E778093E8000C94C60E08958D
:101950000895089580915A018093500110925A0180
:1019600080E00E9444090E9474130C94A1180C9406
:10197000AA0C0E94CE1E8091D101882329F00E94DA
:10198000F41E81110C946F0D089584B7877F84BF76
:1019900088E10FB6F89480936000109260000FBE4B
:1019A00090E080E80FB6F894809361009093610016
:1019B0000FBE8BE69AE00E94A31E8FE193E00E9487
:1019C000EB050E94A80C0E94AB120E94170F0E9408
:1019D000740F8091E20084608093E200789480919B
:1019E000D3018430E1F78EE093E00E94EB050E9482
:1019F000AD1282E091E00E94EE118DEF92E00E9424
:101A0000EB050E94A90C8091D301853019F40E9446
:101A1000B90CF9CF0E94B312F6CF0E94091F809132
:101A2000500180935A0108950C940D0D292F3327EE
:101A300023303105A9F06CF42130310509F442C09E
:101A40002230310509F043C084E790E023E733E01A
:101A500042C021323105C9F02232310519F137C0B7
:101A600099278130910541F08230910541F0892B11
:101A700071F5EFE6F3E005C0EFE5F3E002C0EFE259
:101A8000F3E0849190E09F0126C0643000F5E62FDA
:101A9000F0E0EE0FFF1FEF5DFE4F2081318189E006
:101AA00090E019C0643098F4E62FF0E0DF01AA0F4F
:101AB000BB1FA75EBE4F2D913C91EB5EFE4F808118
:101AC00090E009C082E190E027EE33E004C080E0BE
:101AD00090E020E030E0FA0131832083089580E136
:101AE00089BD82E189BD09B400FEFDCF8091D80097
:101AF0008F7D8093D8008091E00082608093E00029
:101B00008091E00081FDFCCF0895CF92DF92EF92AB
:101B1000FF920F931F93CF93DF937C018B01EA0118
:101B20000E94E70E811131C0209731F088819981A0
:101B3000081B190BE80EF91EC12CD12C011511053B
:101B400019F18091E80085FD14C08091E8008E773E
:101B50008093E800209741F0888199818C0D9D1D2C
:101B60009983888385E011C00E94E70E882331F3B2
:101B70000CC0F70181917F018093F10001501109A0
:101B8000FFEFCF1ADF0ADACF80E0DF91CF911F910C
:101B90000F91FF90EF90DF90CF9008952091DA01A0
:101BA0003091DB012617370748F06115710539F4CC
:101BB0002091E8002E772093E80001C0B901FC01D4
:101BC00020E061157105B9F18091D301882309F4F2
:101BD00040C0853009F43FC08091E80083FD3DC0DE
:101BE0008091E80082FF06C08091E80082FF26C055
:101BF00080E008958091E80080FFE3CF2091F3001A
:101C00008091F20090E0922B6115710551F08830BF
:101C1000910538F421912093F100615071090196EA
:101C2000F3CF21E0089709F020E08091E8008E775B
:101C30008093E800C6CF2111C7CFD6CF8091D301C2
:101C4000882339F0853039F08091E80083FFCCCFCC
:101C500004C082E0089583E0089581E00895209112
:101C6000DA013091DB012617370748F0611571055D
:101C700039F42091E8002E772093E80001C0B901E3
:101C8000FC0120E061157105C1F18091D301882329
:101C900009F441C0853009F440C08091E80083FD1B
:101CA0003EC08091E80082FF06C08091E80082FF7C
:101CB00027C080E008958091E80080FFE3CF209165
:101CC000F3008091F20090E0922B6115710559F0BC
:101CD0008830910540F424912093F10031966150B1
:101CE00071090196F2CF21E0089709F020E0809178
:101CF000E8008E778093E800C5CF2111C6CFD5CFFD
:101D00008091D301882339F0853039F08091E80043
:101D100083FFCBCF04C082E0089583E0089581E083
:101D20000895982F973058F59093E900981739F057
:101D30007091EC002091ED005091F00003C0242F31
:101D4000762F50E021FF19C03091EB003E7F309399
:101D5000EB003091ED003D7F3093ED003091EB00D2
:101D600031603093EB007093EC002093ED005093C2
:101D7000F0002091EE0027FF07C09F5FD3CF8F7048
:101D80008093E90081E0089580E008958091D40176
:101D900087FD05C08091E80080FF0EC012C08091D1
:101DA000E80082FD05C08091D3018111F8CF08952C
:101DB0008091E8008B7708C08091D3018111EACF30
:101DC00008958091E8008E778093E80008958091CF
:101DD000E4009091E50045E62091EC0020FF21C051
:101DE0002091E80020FD21C02091D301222389F019
:101DF000253089F02091EB0025FD0FC02091E400F3
:101E00003091E5002817390739F3415041F0C901F5
:101E1000E3CF82E0089583E0089581E0089584E0AF
:101E200008952091E80022FFDFCF80E008950E940E
:101E3000850F0E948D0FE0EEF0E08081816080834D
:101E4000E8EDF0E080818F77808319BCA7EDB0E0EA
:101E50008C918E7F8C9380818F7E80831092D201B3
:101E600008950F931F93CF93DF930E94850F0E94D5
:101E70008D0FC8EDD0E088818F7788838881806856
:101E8000888388818F7D888319BC1092D30110923A
:101E9000CF011092D1011092D00100EE10E0F801B4
:101EA00080818B7F808388818160888342E060E0CD
:101EB00080E00E94910EE1EEF0E080818E7F8083D1
:101EC000E2EEF0E0808181608083808188608083A1
:101ED000F80180818E7F8083888180618883DF9193
:101EE000CF911F910F910895E8EDF0E080818F7EF2
:101EF0008083E7EDF0E080818160808384E082BFB1
:101F000081E08093D2010C94310FE8EDF0E0808104
:101F10008E7F80831092E20008951092DA00109272
:101F2000E10008951F920F920FB60F9211242F9384
:101F30003F934F935F936F937F938F939F93AF9351
:101F4000BF93EF93FF938091E10082FF0BC08091DC
:101F5000E20082FF07C08091E1008B7F8093E10067
:101F60000E94A40B8091DA0080FF1FC08091D800EE
:101F700080FF1BC08091DA008E7F8093DA00809111
:101F8000D90080FF0DC080E189BD82E189BD09B41F
:101F900000FEFDCF81E08093D3010E948A0B05C033
:101FA00019BC1092D3010E949C0B8091E10080FF2C
:101FB00019C08091E20080FF15C08091E2008E7F01
:101FC0008093E2008091E20080618093E200809142
:101FD000D80080628093D80019BC85E08093D3013B
:101FE0000E94B70C8091E10084FF30C08091E20034
:101FF00084FF2CC080E189BD82E189BD09B400FE67
:10200000FDCF8091D8008F7D8093D8008091E10032
:102010008F7E8093E1008091E2008F7E8093E200CA
:102020008091E20081608093E2008091CF0188235B
:1020300011F084E007C08091E30087FF02C083E0D5
:1020400001C081E08093D3010E94140D8091E100D2
:1020500083FF29C08091E20083FF25C08091E100C9
:10206000877F8093E10082E08093D3011092CF01BB
:102070008091E1008E7F8093E1008091E2008E7F6D
:102080008093E2008091E20080618093E20042E070
:1020900060E080E00E94910E8091F0008860809363
:1020A000F0000E94A30BFF91EF91BF91AF919F9120
:1020B0008F917F916F915F914F913F912F910F90F1
:1020C0000FBE0F901F9018951F920F920FB60F9290
:1020D00011242F933F934F935F936F937F938F932D
:1020E0009F93AF93BF93CF93EF93FF93C091E9007A
:1020F000CF708091EC001092E9008091F000877F12
:102100008093F00078940E94A0101092E9008091D2
:10211000F00088608093F000C093E900FF91EF9198
:10212000CF91BF91AF919F918F917F916F915F916F
:102130004F913F912F910F900FBE0F901F901895C8
:102140001F93CF93DF93CDB7DEB7AA970FB6F8945E
:10215000DEBF0FBECDBFE4EDF1E08091F1008193D1
:1021600021E0EC3DF207C9F70E94F80B8091E800EE
:1021700083FF1CC12091D4013091D501832F90E0C1
:102180008A30910508F012C1FC01EA5AFF4F0C9405
:102190003528203881F0223809F008C18091D80113
:1021A0008F708093E9008091EB0085FB882780F990
:1021B0001092E90006C08091D0019091D101911157
:1021C00082609091E800977F9093E8008093F100FF
:1021D0001092F100C5C0822F8D7F09F0E7C0222345
:1021E00019F0223061F0E2C08091D601813009F00F
:1021F000DDC0333009F080E08093D10128C08091A8
:10220000D601811124C02091D8012F7009F4CEC0CD
:102210002093E9008091EB0080FF19C08091EB00D2
:10222000333011F4806211C080618093EB0081E053
:1022300090E0022E01C0880F0A94EAF78093EA002A
:102240001092EA008091EB0088608093EB0010927E
:10225000E9008091E800877F86C02111A7C0109116
:10226000D6011F778091E3008078812B8093E30073
:102270008091E800877F8093E8000E94C60E8091DD
:10228000E80080FFFCCF8091E30080688093E3004A
:10229000112311F083E001C082E08093D30186C056
:1022A0002058223008F082C08091D6019091D70149
:1022B0008C3D23E0920779F583E08A838AE2898363
:1022C0004FB7F894DE01139620E03EE051E2E32F91
:1022D000F0E050935700E49120FF03C0E295EF70C7
:1022E0003F5FEF708E2F90E0EA3010F0C79601C08C
:1022F000C0968D939D932F5F243149F74FBF8091F6
:10230000E800877F8093E8006AE270E0CE010196E2
:102310000E94CE0D14C0AE014F5F5F4F6091D80197
:102320000E94160D009709F441C02091E800277F14
:102330002093E800BC0189819A810E942F0E809130
:10234000E8008B778093E80031C0203879F58091E0
:10235000E800877F8093E8008091CF018093F100AF
:102360008091E8008E778093E8000E94C60E1EC020
:1023700021111CC09091D6019230C0F48091E800E8
:10238000877F8093E8009093CF010E94C60E8091D2
:10239000CF01811104C08091E30087FF02C084E077
:1023A00001C081E08093D3010E94E40B8091E8009A
:1023B00083FF0AC08091E800877F8093E8008091C6
:1023C000EB0080628093EB00AA960FB6F894DEBF14
:1023D0000FBECDBFDF91CF911F9108959093610102
:1023E000809360010895E0916001F0916101309760
:1023F00021F00190F081E02D099480E00895FF9292
:102400000F931F93CF93DF938C01E0916001F091C4
:102410006101309799F10280F381E02D0995809157
:10242000BE0182FF2BC080FF04C084E095E00E94C3
:10243000EB05E80188E0F82E0EEF14E08091BE0174
:1024400080FF0BC088811F928F931F930F930E9470
:1024500084060F900F900F900F90FA942196F11030
:10246000EDCF8091BE0180FF09C08CEF94E0DF9139
:10247000CF911F910F91FF900C94EB05DF91CF91BD
:102480001F910F91FF900895E0916001F09161011B
:10249000309721F00480F581E02D09940895CF93C1
:1024A000DF93EC0180915E0190915F01C817D9071D
:1024B00009F1D0935F01C0935E01E0916001F0915A
:1024C00061013097B9F00680F781E02DCE010995C2
:1024D0008091BE0182FF0EC080FF0CC0DF93CF93BE
:1024E0008EEE94E09F938F930E9484060F900F903E
:1024F0000F900F90DF91CF910895CF93DF93EC0170
:1025000080915C0190915D01C817D90709F1D093C2
:102510005D01C0935C01E0916001F0916101309731
:10252000B9F00084F185E02DCE0109958091BE01BE
:1025300082FF0EC080FF0CC0DF93CF938EED94E03E
:102540009F938F930E9484060F900F900F900F908F
:10255000DF91CF9108950C9475130E94361F0E944D
:10256000B0060C94A109CF92DF92EF92FF920F93E5
:102570001F93CF93DF9300D000D000D0CDB7DEB74C
:102580000E94580833E6E32E31E0F32E00E010E01D
:10259000C02E802F0E943E09F701D1907F01D826DE
:1025A000B1F40F5F1F4F0031110591F78FEF898351
:1025B0008A831B820E943F1F8160782F9D838C83BA
:1025C00049815A816B818D810E94C81348C09091C6
:1025D000BE0191FF04C08E830E9492138E8120E081
:1025E00030E04D2D50E0922FBA01022E02C07595B9
:1025F00067950A94E2F760FF2CC02983CA82EE2413
:10260000E394F12C02C0EE0CFF1C9A95E2F790E0E7
:102610008E219F2121E0892B09F420E02B830E9449
:102620003F1F8160782F9D838C8349815A816B8104
:102630008D810E94C81349815A816B817C818D8173
:102640000E94BB1EF801ED59FE4F80818E258083CC
:1026500006C02F5F3F4F2830310529F6A2CF0E94D8
:10266000BA1E0E9482220E948007109162010E947D
:10267000F311181741F10E94F311809362019091B8
:10268000BE0192FF0EC090FF0CC01F928F938FE08F
:1026900095E09F938F930E9484060F900F900F9068
:1026A0000F908091620126960FB6F894DEBF0FBEA0
:1026B000CDBFDF91CF911F910F91FF90EF90DF90F1
:1026C000CF900C94CC1E26960FB6F894DEBF0FBEAA
:1026D000CDBFDF91CF911F910F91FF90EF90DF90D1
:1026E000CF9008950C94440908950895CF93DF93F3
:1026F0001F92CDB7DEB769830E943E09282F30E0D4
:1027000081E090E0698102C0880F991F6A95E2F725
:102710002823392381E0232B09F480E00F90DF91F7
:10272000CF910895EF92FF920F931F93CF93DF9372
:1027300088E295E00E94EB05C0E0D0E089E2E82E57
:1027400081E0F82E0AE115E08C2F0E943E090E94DC
:10275000A81EFF92EF921F928F93DF93CF931F9348
:102760000F930E94840621968DB79EB708960FB6E8
:10277000F8949EBF0FBE8DBFC031D10529F7DF9100
:10278000CF911F910F91FF90EF90089508950895B4
:10279000CF93DF93CDB7DEB72B970FB6F894DEBF9C
:1027A0000FBECDBF4F83588769877A878B878A850D
:1027B0009B85892B31F05F3F11F080E003C04F3FD4
:1027C000E1F781E0811107C04F81588569857A85DD
:1027D0008B850E94BB1EDE01119686E0FD011192E1
:1027E0008A95E9F785E0FE01379601900D928A956A
:1027F000E1F749815A816B817C818D819E810E94A4
:102800007F1B2B960FB6F894DEBF0FBECDBFDF91B6
:10281000CF910895CF93C82F882309F4E7C0823859
:10282000A1F40E94F31181FDE1C089E30E94FC1D27
:102830000E947D1E2FEF81EE94E021508040904059
:10284000E1F700C0000089E315C08338C1F40E949D
:10285000F31180FDCBC083E50E94FC1D0E947D1E0C
:102860002FEF81EE94E0215080409040E1F700C0CE
:10287000000083E50E941D1ECF910C947D1E8438BC
:10288000A1F40E94F31182FDB1C087E40E94FC1DF7
:102890000E947D1E2FEF81EE94E0215080409040F9
:1028A000E1F700C0000087E4E5CF8CEF8C0F813AA0
:1028B00048F48C2F0E94A325811198C08C2F0E9470
:1028C000FC1DDACF80E28C0F883048F4C77081E0BD
:1028D00001C0880FCA95EAF70E94411ECDCF8BE553
:1028E0008C0F833078F4C53A29F0C63A31F482E887
:1028F00090E005C081E890E002C083E890E0CF91CD
:102900000C944F1288E58C0F853108F06FC0C83ADF
:1029100061F1C93A69F1CA3A71F1CB3A79F1CC3A2D
:1029200081F1CD3A89F1CE3A91F1CF3A99F1C13B9B
:10293000A1F1C03BA9F1C23BB1F1C33BB9F1C43B2A
:10294000C1F1C53BC9F1C63BD1F1C73BD9F1C83B89
:10295000E1F1C93BE9F1CA3BF1F1CB3BF9F1CC3BE9
:1029600009F03FC08AE292E03EC082EE90E03BC0B8
:1029700089EE90E038C08AEE90E035C085EB90E0BB
:1029800032C086EB90E02FC083EB90E02CC084EB4C
:1029900090E029C087EB90E026C08CEC90E023C04B
:1029A0008DEC90E020C083E891E01DC08AE891E0C2
:1029B0001AC082E991E017C084E991E014C081E275
:1029C00092E011C083E292E00EC084E292E00BC07C
:1029D00085E292E008C086E292E005C087E292E0DC
:1029E00002C080E090E0CF910C947D12CF910895C9
:1029F000882309F466C08238A1F40E94F31181FF94
:102A000060C089E30E94FC1D0E947D1E2FEF81EEB5
:102A100094E0215080409040E1F700C0000089E33D
:102A200015C08338B9F40E94F31180FF4AC083E5D2
:102A30000E94FC1D0E947D1E2FEF81EE94E021502C
:102A400080409040E1F700C0000083E50E941D1E19
:102A50000C947D1E8438A1F40E94F31182FF31C0D2
:102A600087E40E94FC1D0E947D1E2FEF81EE94E002
:102A7000215080409040E1F700C0000087E4E6CF9D
:102A80009CEF980F913A10F390E2980F983050F421
:102A9000877091E001C0990F8A95EAF7892F0E940B
:102AA000471ED6CF9BE5980F933020F480E090E04E
:102AB0000C944F12885A853120F480E090E00C94F9
:102AC0007D120895882321F00E94411E0C947D1EE2
:102AD0000895882321F00E94471E0C947D1E0895BE
:102AE000CF92DF92EF92FF920F931F93CF93DF93DA
:102AF000CDB7DEB728970FB6F894DEBF0FBECDBFB7
:102B00008C0185E0F801DE01119601900D928A9505
:102B1000E1F7F80140813181F280258122952F7003
:102B200083819481892B31F03F3F31F481E04F3F25
:102B300019F403C081E001C080E080FDE1C2498357
:102B40003A8389819A812F830E94BA1D9E83888748
:102B50000E94B91D0E94E11C4E81E42FE295EF70A6
:102B6000F0E0E05AFF4F2F8168850C943528842FC0
:102B7000807F142F1F70882311F01295107FFF2083
:102B800059F0112309F471C2812F68870E94541EE5
:102B90000E947D1E688569C2862F0E94F814112349
:102BA00009F4AEC2812F0E945A1E28960FB6F894DF
:102BB000DEBF0FBECDBFDF91CF911F910F91FF9070
:102BC000EF90DF90CF900C947D1E842F807F942F08
:102BD0009F70E92E803219F0E29480EFE82266239C
:102BE00019F0613001F129C0FF20A9F08E2D2223B8
:102BF00049F1213039F528960FB6F894DEBF0FBEA3
:102C0000CDBFDF91CF911F910F91FF90EF90DF909B
:102C1000CF900C94641E222319F0213009F470C265
:102C20000E94671E2CC0FF20E9F0263008F068C221
:102C30000E943E1E8E2129F022C0FF20F1F02111BA
:102C400015C08E2D28960FB6F894DEBF0FBECDBFEF
:102C5000DF91CF911F910F91FF90EF90DF90CF9078
:102C60000C946215253008F04BC209C0F80185812B
:102C700080FFFBC18F708583E4CF21110AC28E2DA6
:102C800078C1242F26952695237030E02115310533
:102C900021F021303105C9F033C2FF2021F0862F09
:102CA000942F937002C080E090E028960FB6F894BD
:102CB000DEBF0FBECDBFDF91CF911F910F91FF906F
:102CC000EF90DF90CF900C944F12FF2021F0862FD1
:102CD000942F937002C080E090E028960FB6F8948D
:102CE000DEBF0FBECDBFDF91CF911F910F91FF903F
:102CF000EF90DF90CF900C947D12862FFF2019F07B
:102D00000E94082102C00E94702128960FB6F894F4
:102D1000DEBF0FBECDBFDF91CF911F910F91FF900E
:102D2000EF90DF90CF900C94F521842F837009F001
:102D300076C0F110E5C1262F229526952770220F27
:102D4000220F862F8F70C82ED12CE12CF12C022E51
:102D500004C0CC0CDD1CEE1CFF1C0A94D2F764FFEF
:102D600010C06FE070E080E090E004C0660F771F55
:102D7000881F991F2A95D2F7609570958095909538
:102D800003C060E070E0CB01242F269526952370C8
:102D9000422F50E042305105D1F04330510559F1F6
:102DA0006C297D298E299F294130510541F12896B2
:102DB0000FB6F894DEBF0FBECDBFDF91CF911F914C
:102DC0000F91FF90EF90DF90CF900C94F61C6C2940
:102DD0007D298E299F2928960FB6F894DEBF0FBE55
:102DE000CDBFDF91CF911F910F91FF90EF90DF90BA
:102DF000CF900C94081D0E94F61CC701B6012896BE
:102E00000FB6F894DEBF0FBECDBFDF91CF911F91FB
:102E10000F91FF90EF90DF90CF900C94E41CFF2077
:102E200019F0842F817001C08695882309F468C148
:102E3000262F229526952770220F220F862F8F701E
:102E4000C82ED12CE12CF12C022E04C0CC0CDD1CA0
:102E5000EE1CFF1C0A94D2F764FF10C06FE070E014
:102E600080E090E004C0660F771F881F991F2A95A5
:102E7000D2F7609570958095909503C060E070E002
:102E8000CB01242F269526952370422F50E0423007
:102E90005105D1F04330510559F16C297D298E2916
:102EA0009F294130510541F128960FB6F894DEBFB5
:102EB0000FBECDBFDF91CF911F910F91FF90EF908B
:102EC000DF90CF900C94951D6C297D298E299F2928
:102ED00028960FB6F894DEBF0FBECDBFDF91CF911D
:102EE0001F910F91FF90EF90DF90CF900C94A71D52
:102EF0000E94951DC701B60128960FB6F894DEBF53
:102F00000FBECDBFDF91CF911F910F91FF90EF903A
:102F1000DF90CF900C94831D603FD9F128F480E4BA
:102F2000860F803250F09CC0623F09F461C008F403
:102F30004BC0633F09F470C093C0162F1071842FEB
:102F40008F716887FF2059F00E942E1D6885862F9B
:102F5000112319F08295807F75CE8F7073CE0E94F9
:102F6000491D6885862F112319F08295807F01C045
:102F70008F7028960FB6F894DEBF0FBECDBFDF91DD
:102F8000CF911F910F91FF90EF90DF90CF900C9415
:102F90006915FF20A9F0253008F0B2C0842F8F7189
:102FA00028960FB6F894DEBF0FBECDBFDF91CF914C
:102FB0001F910F91FF90EF90DF90CF900C94681DC0
:102FC000263008F09DC0EACFFF20A1F0842F8F713A
:102FD00028960FB6F894DEBF0FBECDBFDF91CF911C
:102FE0001F910F91FF90EF90DF90CF900C942E1DCA
:102FF000FF2061F3842F8F7128960FB6F894DEBFFF
:103000000FBECDBFDF91CF911F910F91FF90EF9039
:10301000DF90CF900C94491DFF2091F0842F8F7189
:1030200028960FB6F894DEBF0FBECDBFDF91CF91CB
:103030001F910F91FF90EF90DF90CF900C941F1D88
:1030400028960FB6F894DEBF0FBECDBFDF91CF91AB
:103050001F910F91FF90EF90DF90CF900C941A1D6D
:10306000FF20A1F0222309F4B1CF862F28960FB6B6
:10307000F894DEBF0FBECDBFDF91CF911F910F91AE
:10308000FF90EF90DF90CF900C940A14222309F464
:10309000B1CF862F28960FB6F894DEBF0FBECDBFF6
:1030A000DF91CF911F910F91FF90EF90DF90CF9024
:1030B0000C94F8144F70C8010E94C81F28960FB6D0
:1030C000F894DEBF0FBECDBFDF91CF911F910F915E
:1030D000FF90EF90DF90CF900C942C1C4F70C801A4
:1030E00028960FB6F894DEBF0FBECDBFDF91CF910B
:1030F0001F910F91FF90EF90DF90CF900C94CB1F1A
:1031000028960FB6F894DEBF0FBECDBFDF91CF91EA
:103110001F910F91FF90EF90DF90CF9008950E9444
:10312000611E0E94301E0E947D1E0E9423230E9469
:10313000F52180E090E00E944F1280E090E00C9436
:103140007D120E94511E0C948F180E94BA1D292FC7
:1031500022952F7030E02C3031054CF42A303105A7
:10316000C4F4225031092230310540F021C02C3006
:103170003105D1F02F303105B9F01AC0853A28F465
:103180008430C0F4823028F415C090E2980F983053
:1031900088F0883E30F4803E68F48450813A40F4F0
:1031A00009C0803F29F406C093FB882780F9089561
:1031B00080E0089581E00895CF93DF9300D000D0A0
:1031C0001F92CDB7DEB70F900F900F900F900F901A
:1031D000DF91CF910895CF93DF9300D000D000D03E
:1031E000CDB7DEB726960FB6F894DEBF0FBECDBFC3
:1031F000DF91CF9108951F93CF93DF93C091730117
:1032000016E080917401C81799F0D0E01C9FF0017E
:103210001D9FF00D1124EB58FE4F408151816281BA
:103220007381848195810E94EB182196C770E9CF44
:10323000DF91CF911F9108954091A5015091A60172
:103240006091A7017091A8018091A9019091AA01B4
:103250000C94EB18CF938091AA0182958F7009F09E
:103260005FC08091A701882309F45AC0209173019F
:10327000A09174016091A5017091A6018091A801AF
:103280009091A90131E06F3F09F030E0B32FC6E023
:103290002A1709F445C0009721F07F3F21F44B2FF6
:1032A00003C041E001C040E030E040FD35C0C29FB6
:1032B000F001C39FF00D1124EB58FE4F41817413B0
:1032C0002BC04081641328C04281411125C0438135
:1032D00054814817590710F441505109481B590BA4
:1032E000483C5105C8F48091AA018F708061809399
:1032F000AA0186E0829FF001839FF00D1124E65819
:10330000FE4F80818F708061808385EA91E00E940A
:103310007015CF910C94FB182F5F3F4F2770B8CFDB
:10332000CF910895CF92DF92EF92FF920F931F9368
:10333000CF93DF93CDB7DEB762970FB6F894DEBFB9
:103340000FBECDBF8C0185E0F801DE011D96019016
:103350000D928A95E1F7D8014C9111965C911197E5
:1033600012966C9112971396ED90FC9014977091B1
:10337000A501E091A6012091A8013091A901211594
:10338000310531F0EF3F31F481E07F3F19F403C0A4
:1033900081E001C080E0B82FB170CB2E80FD6CC100
:1033A000D090A701DD2009F4F5C0F091AA01E21642
:1033B000F30638F0C701821B930B883C910548F057
:1033C0009BC0209530952E0D3F1D283C310508F0FF
:1033D00093C08F2F807F09F052C0E51314C074137F
:1033E00012C0D62E61110FC0FF70F061F093AA01D8
:1033F0000E941C1985EA91E00E9470158091AA0133
:10340000F80185836CC1EF2831F05F3F31F481E032
:103410004F3F19F403C081E001C080E080FD03C08C
:1034200081E0862701C080E0F82FF170FF2E80FF39
:103430001CC0809173012091740136E0821709F459
:1034400028C190E0389FF001399FF00D1124EB580E
:10345000FE4F7181571306C07081471303C07281FC
:10346000671303C001968770E9CFD62E662309F44F
:1034700036C18091AA0181608093AA0153C0E513EF
:1034800008C0741306C0611104C0D8011596FC93DE
:10349000AEC04D875E878D859E856A8B0E94A5187C
:1034A0006A89882329F1D62E662311F12091AA0179
:1034B000822F82958F7090E002970CF460C080910B
:1034C000A5019091A60198878F831986FB86EA86CD
:1034D0002C87CE01079651C0E51731F14D875E87E5
:1034E0008D859E856A8B0E94A5186A8981112EC0E0
:1034F000C8010E947015A4C08F2F807F69F77E2DB0
:10350000F98AE88A89890E94DC1885EA91E00E949C
:103510007015E5EAF1E086E0DF011D928A95E9F792
:103520000E941C19D12CDBC07413D8CF6111D6CFE7
:10353000D8011596FC93C8010E947015E5EAF1E0E8
:1035400086E0DF011D928A95E9F7C9C0D62E662371
:1035500079F22091AA01822F82958F7090E00297D4
:1035600074F08091A5019091A6019A8389831B82B2
:10357000FD82EC822E83CE0101960E94701586E0BA
:10358000F801A5EAB1E001900D928A95E1F70E9459
:103590002A196FC0E216F30628F0C701821B930BAD
:1035A0009C0104C0209530952E0D3F1D283C31050F
:1035B00008F052C0D62E662309F49ACFE5132CC02A
:1035C00074132AC08091AA0180FD1DC0982F929586
:1035D0009F70C9F0D80115968C9315979F3039F0DC
:1035E0009F5F9295907F8F70892B15968C93C80161
:1035F0000E94701586E0F801A5EAB1E001900D92F5
:103600008A95E1F736C086E0F801A5EAB1E00190BD
:103610000D928A95E1F763C04D875E878D859E8503
:103620000E94A518882379F086E0F801A5EAB1E0A8
:1036300001900D928A95E1F70E942A190E941C19A7
:10364000DD24D3944CC08091AA0181608093AA01AB
:10365000C8010E94701543C07E2DF98AE88A8989C5
:103660000E94DC18E5EAF1E086E0DF011D928A9510
:10367000E9F70E941C1933C0662309F439CF4D873E
:103680005E878D859E850E94A518882309F430CF1A
:10369000CBCF4D875E878D859E850E94BA1D292FD1
:1036A00022952F7030E0223031052CF49F7041F0CC
:1036B000811106C00CC0243031052CF49F7049F4F0
:1036C000805E883020F0C8010E947015CF2CDC2C61
:1036D00006C0D80115969C91907F91F7F8CF8D2D5B
:1036E00062960FB6F894DEBF0FBECDBFDF91CF91CB
:1036F0001F910F91FF90EF90DF90CF9008951F934F
:10370000CF93DF93CDB7DEB72C970FB6F894DEBF1B
:103710000FBECDBF4F83588769877A878B879C8779
:10372000CE0107960E9492198823C1F02F81388517
:103730008A859B85892B31F03F3F11F080E003C0E3
:103740002F3FE1F781E0811147C04F81588569859E
:103750007A858B859C850E94EB183EC086E0FE0131
:103760003796DE01119601900D928A95E1F7FF815F
:10377000E8854A855B854115510531F0EF3F31F40D
:1037800081E0FF3F19F403C081E001C080E080FDCB
:1037900023C02091740130E0C901019687709927F8
:1037A0006091730170E086179707F1F1F983EA835E
:1037B0005D834C8396E0929FD001939FB00D1124BE
:1037C000AB58BE4FFE01319601900D929A95E1F7EC
:1037D000809374010E94FB1816E080917301909110
:1037E0007401891779F1189FC00111248B589E4FDD
:1037F0000E949219882331F1E09173011E9FF0011C
:103800001124EB58FE4F4081518162817381848184
:1038100095810E94EB188091730190E0019687706A
:10382000992780937301D9CF0E94A1181092740137
:1038300010927301E5EAF1E086E0DF011D928A95BE
:10384000E9F7CACF2C960FB6F894DEBF0FBECDBFF6
:10385000DF91CF911F910895DF92EF92FF920F9326
:103860001F93CF93DF93FC01009709F48AC0E12CEA
:10387000F12CDD24D394EF0121968491853709F44E
:1038800061C058F4843708F04EC0843008F06AC034
:103890008130D1F0823071F174C0883709F45DC095
:1038A00050F4863709F455C0873709F06AC08E2D69
:1038B0000E944E1E54C09CE7980F903708F061C0DC
:1038C0008F770E94F81450C08F010E5F1F4FFE01CA
:1038D000849190E2980F983050F48770FD2D01C0CC
:1038E000FF0F8A95EAF78F2F0E94541E15C00E9481
:1038F0000A1414C08F010E5F1F4FFE01849190E2E5
:10390000980F983068F48770FD2D01C0FF0F8A95DD
:10391000EAF78F2F0E945A1E0E947D1EE80124C0E4
:103920000E94F814FBCF9F012E5F3F4FFE01C49110
:10393000CC2369F08FE99FE00197F1F700C0000008
:10394000C150F6CF9F012E5F3F4FFE01F490E90179
:103950000BC00E943E1EE82E07C00E94511E0E940E
:103960007D1E02C00E940A149F2D992341F0EFE9A9
:10397000FFE03197F1F700C000009150F6CFFE0153
:103980007ACFDF91CF911F910F91FF90EF90DF9051
:1039900008956093AF017093B0018093B10190934B
:1039A000B2010E94CA1E0C948F186093AB017093F1
:1039B000AC018093AD019093AE010E94CB1E0C949C
:1039C0008F1808950C94C91C0F931F930091AF0199
:1039D0001091B0012091B1013091B201602B712B97
:1039E000822B932B1F910F910C94C91C0F931F9343
:1039F0000091AF011091B0012091B1013091B2015D
:103A000060237123822393231F910F910C94C91C6F
:103A10000F931F930091AF011091B0012091B1015C
:103A20003091B20160277127822793271F910F9150
:103A30000C94C91C60E070E0CB010C94D51C41E0F3
:103A400050E060E070E004C0440F551F661F771F10
:103A50008A95D2F7CB01BA010C94D51C41E050E015
:103A600060E070E004C0440F551F661F771F8A9501
:103A7000D2F78091AB019091AC01A091AD01B091D2
:103A8000AE01482B592B6A2B7B2BCB01BA010C942E
:103A9000D51C41E050E060E070E004C0440F551FC9
:103AA000661F771F8A95D2F740955095609570955F
:103AB0008091AB019091AC01A091AD01B091AE01AC
:103AC000482359236A237B23CB01BA010C94D51CCC
:103AD00041E050E060E070E004C0440F551F661FF5
:103AE000771F8A95D2F78091AB019091AC01A0919C
:103AF000AD01B091AE01482759276A277B27CB013A
:103B0000BA010C94D51C0F931F930091AB01109137
:103B1000AC012091AD013091AE01602B712B822B55
:103B2000932B1F910F910C94D51C0F931F93009111
:103B3000AB011091AC012091AD013091AE01602339
:103B40007123822393231F910F910C94D51C0F9303
:103B50001F930091AB011091AC012091AD01309108
:103B6000AE0160277127822793271F910F910C9434
:103B7000D51C0895CF92DF92EF92FF920F931F937F
:103B8000CF93DF93EC01C090AF01D090B001E090F3
:103B9000B101F090B2018091AB019091AC01A09184
:103BA000AD01B091AE01C82AD92AEA2AFB2A0FE159
:103BB00010E0B701A601002E04C0769567955795D1
:103BC00047950A94D2F740FF07C0BE01802F0E949C
:103BD000E71F8130910539F40150110950F7BE01FA
:103BE00080E00E94E71FDF91CF911F910F91FF901E
:103BF000EF90DF90CF90089540910D0150910E010C
:103C000020E030E09FEFFA01E20FF31F62816817B6
:103C100099F09F3F19F4611101C0922F2F5F3F4F20
:103C20002630310581F79F3F39F0FA01E90FF11D88
:103C300097FDFA9582830895089540910D01509162
:103C40000E0120E030E0FA01E20FF31F9281981399
:103C500001C012822F5F3F4F26303105A1F7089532
:103C600081E090E0E0910D01F0910E01E80FF91F65
:103C70001082019688309105A9F708958091BD01C1
:103C800008959091BD01982B9093BD010895809562
:103C90009091BD0198239093BD0108958093BD013B
:103CA00008951092BD0108959091BC01982B9093B6
:103CB000BC01089580959091BC0198239093BC011C
:103CC00008951092BC0108958093B3010895109255
:103CD000B301089540910D0150910E0120E030E0B4
:103CE00080E0FA01E20FF31F918191118F5F2F5F46
:103CF0003F4F27303105A9F70895E0910D01F0916C
:103D00000E018091BD018083E0910D01F0910E01C3
:103D100080819091BC01892B80839091B30199237C
:103D200061F0E0910D01F0910E018081892B80837B
:103D30000E946A1E81111092B30180910D01909131
:103D40000E010C94FF119093350180933401089576
:103D50008295982F9C7C96959695837344E0849FDA
:103D600090011124922B892F8A7A86959575990F47
:103D7000892B08950895CF93DF9300D000D01F9230
:103D8000CDB7DEB70F900F900F900F900F90DF918F
:103D9000CF910895089508950C9472138091D301E2
:103DA000843009F11092BF0120E488E190E00FB661
:103DB000F894A895809360000FBE2093600083B7AD
:103DC000817F846083BF83B7816083BF7894889547
:103DD00083B78E7F83BF88E10FB6F894809360002D
:103DE000109260000FBE0895CF930E94C6130E94E8
:103DF00058080E94C713C0E08C2F0E943E09811111
:103E000005C0CF5FC031C1F780E001C081E0CF9134
:103E100008950E9474130C94A1181F920F920FB66C
:103E20000F9211248F939F93AF93BF938091BF0103
:103E3000811113C08091C0019091C101A091C20174
:103E4000B091C3014196A11DB11D8093C001909313
:103E5000C101A093C201B093C301B