Author Topic: Macintosh M0110 USB converter  (Read 140934 times)

0 Members and 1 Guest are viewing this topic.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« on: Wed, 14 December 2011, 00:43:53 »

This firmware converts the protocol of Apple Macintosh 128K/512K/Plus Keyboards like M0110, M0110A(with keypad) and M0120(keypad) into USB. The retro keyboard can be revived connecting to mordern compter with this converter.




Preassembled TMK converter is available here! https://geekhack.org/index.php?topic=72052

Rev.2.5 Micro USB/ATMega32u2 with detachable cable




YOUR HELP NEEDED for International(ISO) keyboard support
To add international-layout M0110 support some help is needed.
If you have international-layout M0110 read this post.

https://geekhack.org/index.php?topic=24965.msg3152999#msg3152999



Supported Models
M0110


M0110A


More
M0110 + M0120


M0120







M0110 Protocol - Technical resources
https://github.com/tmk/tmk_keyboard/tree/master/converter/m0110_usb
https://github.com/tmk/tmk_keyboard/wiki/Apple-M0110-Keyboard-Protocol





Changes:
2012/05/26: M0110A is now supported. Thanks for your contribution, skagon!
2013/08: Change port for signals PF to PD
2013/09: Change port again, it uses inversely PD0 for data and PD1 for clock line now.
2015/03: Add support for "International"(ISO) keyboard(keymap_intl.c)
2015/07: Update keymap editor(for Rev.1)
2016/01: Updated keymap editor(for Rev.2)
2019/01: Reorgarnized first post a bit.  This thread is not dead :)
2020/09: Add NEED HELP section in this post
2024/01: Add Keymap Editor support for International layout  See Issue #771.





Build Hardware yourself
You need 4P4C cable and ATMega32U4 or ATMega32U2 dev board. Port of the MCU PD1 is assigned to CLOCK line and PD0 to DATA by default, you can change pin configuration with editing config.h.


4P4C Plug:
You can find 4P4C plug as phone handset cable if you don't have Mac keyboard cable.
http://en.wikipedia.org/wiki/Modular_connector#4P4C

NOTE: Original cable used with Mac is straight while phone handset cable is crossover. Close-up pics of handset cable. You can see one end of plug has reverse color codes against the other. Click to enlarge.
More




Socket pinout:
Quote

Mac 128k/512k/Plus Keyboard pinout
.---------,
| 1 2 3 4 | 1 GND
|         | 2 Clock
|         | 3 Data
`---___---' 4 5V
from front of socket on keyboard

This image displays pinouts on Mac side socket but same on keyboard side.
http://www.kbdbabel.org/conn/kbd_connector_macplus.png
http://old.pinouts.ru/Inputs/MacKeyboard_pinout.shtml



Pull-up resistor:
You are strongly recommended to have pull-up resistors on two signal lines though it might work well without them. In particular when you use long or coiled cable you probably need them.





Keymap Editor
You can use Keymap Editor to define your keymap and download firmware using web browser(Chrome is recommended).
http://www.tmk-kbd.com/tmk_keyboard/editor/



For preassembled TMK M0110 Converter(ATmega32u2):
- M0110 US layout: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?m0110_usb
- M0110 International layout: Use this link
- M0110A layout: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?m0110_usb_m0110a

For DIY converter with ATmega32u4:
- M0110 US layout: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?m0110_usb_rev1
- M0110 International layout: Use this link
- M0110A layout: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?m0110_usb_rev1_m0110a


Flash firmware
Refer this wiki page for how to flash firmware onto the converter.

https://github.com/tmk/tmk_keyboard/wiki#flash-firmware



Build Frimware
When Keyamp Editor is not enough for your need you can build firmware from source codes.

$ git clone git://github.com/tmk/tmk_keyboard.git
$ cd converter/m0110_usb
$ make
and program your controller with compiled firmware.

Firmware Source: https://github.com/tmk/tmk_keyboard/tree/master
See also:https://github.com/tmk/tmk_keyboard/tree/master/converter/m0110_usb





Locking CapsLock key support
See this entry. Use keycode 'LCAP' instead of 'CAPS' for the key in short. You can find it as 'Locking Caps Lock' in 'Function and Keypad' tab on Keymap Editor.
https://github.com/tmk/tmk_keyboard/#mechanical-locking-support


Turn locking CapsLock key into normal momentary
For M0110 and M0110A(Alps model): You need to get a descrete SKCC 'short stem' switch for locking switch replacement.

For M0110A(MITSUMI model): You can just remove locking mechanism of the switch easily instead of replacement. It still requires desoldering though.








TROUBLE WITH YOUR DIY CONVERTER?
You are using Pro Micro?
Confirm it is a 5V version with 16MHz crystal. Make solder bridge on J1 and use VCC for 5V power, not RAW.  MUST check this page also.

I'm never willing to recommend you to use Pro Micro unless you are already familiar to it and have skill to solve problems yourself. Pro Micro is bad choice especially if this is your first time project. Alternatives are PJRC Teensy2.0 and TMK converter, of course!

Please don't ask help for problem specific to Pro Micro here.

Don't ask help before placing pull-up resistors and trying solder on J1!

More
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]
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]
« Last Edit: Mon, 29 January 2024, 02:13:40 by hasu »

Offline JMK

  • Posts: 31
pinout and connection
« Reply #1 on: Sat, 10 March 2012, 15:50:42 »
Hello.
I am jmk, a complete newbie here.
It is odd that I used to see many comments and discussions here, but suddenly they are all gone.
Anyway, inspired by hasu's mod of m0110, I also tried to do the mod in a slightly different but fundamentally the same way.
But I encountered a problem with figuring out pinout and connection between the keyboard and teensy.
I sent hasu a message, and he thinks it is better to discuss it publicly. So here is my question and hasu's answer.

I asked about the arrangement of the color of 4p4c because 4p4c is usually crossover-wired. So, for example, yellow can be either +5V or GND (to put is another way, it can be either #4, or #1)

Images below are the messages that I traded with hasu

[ Attachment Invalid Or Does Not Exist ] 43488[/ATTACH]
[ Attachment Invalid Or Does Not Exist ] 43489[/ATTACH]
[ Attachment Invalid Or Does Not Exist ] 43490[/ATTACH]

I hope this helps someone who has the same issue like me.

As I do the mod, I will post my questions and solutions.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #2 on: Sat, 10 March 2012, 16:26:48 »
I have tried to hand-wire the keyboard and teensy without using handset cable.
Based on the information of kbdbabel, I connected keyboard and teensy (directly from keyboard pcb to teensy).
The result was not very good.
Here is the result:
[ Attachment Invalid Or Does Not Exist ] 43491[/ATTACH]

As I strike each key, each letter is typed twice as shown above. After "\" key stroke, the keyboard stopped working, and I disassemble what I did today so far and reverted the keyboard to its original condition.
As soon as I retrieve an handset cable next week, I will try the mod in the exactly the same way that hasu did and post the result.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #3 on: Sat, 10 March 2012, 17:44:14 »
JMK, thanks for posting here again to share.

I tried the converter to test just now and it didn't register any keys at all without pull-up resistors.
Though I think it worked well without them last time, but it doesn't work today.

You might need to add two pull-up resistors on DATA and CLOCK lines in Teensy side in particular when you used long cable or coiled cable.
I used 1.5K Ohm resistors but 1K-10K will be OK.

Now I'm typing my M0110 through the converter with pull-up resistors. No problem.
My pull-up resistors is like this:

Offline JMK

  • Posts: 31
thanks
« Reply #4 on: Sat, 10 March 2012, 22:37:45 »
Thank you hasu
It seems like you plugged both ends of the resistors to clock/data and +5V. So clock and data ports have lines from the 4p4c connector cables and a leg of resistor, and +5V port has two legs of registers from data and clock as well as a line from the 4p4c connector cables.
I don't have resistors. So I think I will have to purchase a bunch of them on ebay or utilize some of the tiny little load resistors on an unused keyboard controller (mx8000, the switches and keycaps of which I used for another project.)
I will keep you updated on this thread.


Quote from: hasu;541592
JMK, thanks for posting here again to share.

I tried the converter to test just now and it didn't register any keys at all without pull-up resistors.
Though I think it worked well without them last time, but it doesn't work today.

You might need to add two pull-up resistors on DATA and CLOCK lines in Teensy side in particular when you used long cable or coiled cable.
I used 1.5K Ohm resistors but 1K-10K will be OK.

Now I'm typing my M0110 through the converter with pull-up resistors. No problem.
My pull-up resistors is like this:
Show Image

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #5 on: Fri, 23 March 2012, 10:09:54 »
Hello.
I finally received a bunch of resistors, and add two to teensy.
[ Attachment Invalid Or Does Not Exist ] 45395[/ATTACH]
[ Attachment Invalid Or Does Not Exist ] 45396[/ATTACH]


I tried two different ways, but it still doesn't work. Maybe, the cord that I use is too long?
Can you identify what problem I have?
It is more difficult that I thought. Thanks though. It is a fun process.
« Last Edit: Fri, 23 March 2012, 10:12:21 by JMK »

Offline JMK

  • Posts: 31
images
« Reply #6 on: Fri, 23 March 2012, 10:20:24 »
I don't know why the images that I uploaded do not appear properly.
Here are the images again. I hope this works.

[ Attachment Invalid Or Does Not Exist ] 45399[/ATTACH]
[ Attachment Invalid Or Does Not Exist ] 45398[/ATTACH]
« Last Edit: Fri, 23 March 2012, 10:31:33 by JMK »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #7 on: Fri, 23 March 2012, 10:43:25 »
It looks OK.  Hmm, I can't see your problem.
Your RJ plug has same color order as this?  From left yellow, green, red and black.


And you can use PJRC's 'hid_listen' tool to see debug print. This may help you if Teensy already can receive any signal from M0110.
« Last Edit: Sat, 21 September 2013, 01:44:08 by hasu »

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #8 on: Fri, 23 March 2012, 10:48:23 »
Hi, thanks for the prompt response.
The connection is correct. I tested if the electricity flows to the keyboard's connection part.
I guess I need to see the debug print. Everything is new to me, and I don't know what exactly the "debug print" is, but I will just try.
Thanks again.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #9 on: Fri, 23 March 2012, 11:46:47 »
I guess its over midnight in Japan.
Here is the screen shot of what I got from debug print.
I first did not get any result, and I checked out the connection again. Obviously, the connection was not stable.
Now I got the result that I got when I did not have pull up resistors. Multiple entires are typed at one key stroke.
[ Attachment Invalid Or Does Not Exist ] 45410[/ATTACH]

Any idea?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #10 on: Fri, 23 March 2012, 11:51:31 »
Congrat!
It seems to be working well and sending keys to PC.
Did you try to just type on editor or other apps?

EDIT: Ah you mean you get two chars per one key press? It is Odd.
« Last Edit: Fri, 23 March 2012, 11:56:38 by hasu »

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #11 on: Fri, 23 March 2012, 15:00:20 »
It does not work properly yet. One of the problems that I had in the process was that the handset cable lines were very weak. They get cut off just too easily. So I had to remove the coat of each line several times. I will try to find a better way to connect the cord/resistor and teensy.

Offline JMK

  • Posts: 31
config.h
« Reply #12 on: Fri, 23 March 2012, 22:45:06 »
hello.
As I was working on teensy, I almost ruined the connecting holes. I tested them and confirmed that they are, strangely, still working, but I think I need a backup plan just in case.
[ Attachment Invalid Or Does Not Exist ] 45492[/ATTACH]

If I want to use the portion that marked in yellow rectangle to connect it with the cables, how should I modify your config.h?
The following is the original configuration:
#define M0110_CLOCK_PORT PORTF
#define M0110_CLOCK_PIN PINF
#define M0110_CLOCK_DDR DDRF
#define M0110_CLOCK_BIT 0
#define M0110_DATA_PORT PORTF
#define M0110_DATA_PIN PINF
#define M0110_DATA_DDR DDRF
#define M0110_DATA_BIT 1


IF I want to use D4 and D5 port along with GND and VCC on the same row, I guess...
#define M0110_CLOCK_PORT PORTD
#define M0110_CLOCK_PIN PIND
#define M0110_CLOCK_DDR DDRD
#define M0110_CLOCK_BIT 4
#define M0110_DATA_PORT PORTD
#define M0110_DATA_PIN PIND
#define M0110_DATA_DDR DDRD
#define M0110_DATA_BIT 5

will this be working?

Thank you again.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #13 on: Fri, 23 March 2012, 22:59:53 »
You are  right.
It should work.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #14 on: Sat, 24 March 2012, 15:15:40 »
Thanks.
Let me ask one more question.
Can cables be a problem?

[ Attachment Invalid Or Does Not Exist ] 45546[/ATTACH]

The cord that I use has the type of wire as seen the picture above. However I carefully strip the coat, I failed to strip it perfectly. So the inner fiber-like white thread is always exposed.
When I tried the mod, I just ignore the cable after I check that electric signals flows anyway.
Other than that, I don't know why my mod failed. It is really odd.

Currently, I just ordered 4p4c sockets and stripboards. I will try the mod without cutting the handset cord. Instead, I will solder the 4p4c socket and teensy on the stripboard, and wire them. This way, I can avoid ruining the cable, which I think is the problem of the failure, and probably I can make the mod a little more conveniently and neatly. Maybe I can later make a acrylic case.

Thanks hasu for your support.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #15 on: Mon, 26 March 2012, 10:37:54 »
I don't know exactly your problem but the white thread can cause bad solder.

What did you see when you press keys on M0110? You got characters doubly? or got nothing?

Offline JMK

  • Posts: 31
another way
« Reply #16 on: Mon, 26 March 2012, 13:39:21 »
Hi.
The screenshot that I uploaded on 23 Mar 2012, 16:46, is actually the "debug print" if my understanding is correct.
I see multiple characters.
Here it is again.
[ Attachment Invalid Or Does Not Exist ] 45827[/ATTACH]

I am going to do the mod this way as seen in the sketch below. Parts were ordered, but it's going to take several weeks cause it's delivered from hongkong as economy mail.
[ Attachment Invalid Or Does Not Exist ] 45828[/ATTACH]

If you have any comment please let me know.

Offline JMK

  • Posts: 31
my firmware
« Reply #17 on: Fri, 30 March 2012, 23:42:26 »
[ Attachment Invalid Or Does Not Exist ] 46493[/ATTACH]
Hello hasu
I was wondering if you would test my firmware. I see no hardware problem, so I guess there may be a software problem.
I merely changed the keymap suitable for mac (command, L-Alt, and Fn2) and "make" the hex file.
But it was my first time and I am not sure if it is properly done.

I changed the extension of the file as txt to upload it, otherwise the file cannot be uploaded. So I guess you need to simply remove "txt" to make it hex file.
Thank you.
« Last Edit: Fri, 30 March 2012, 23:44:29 by JMK »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #18 on: Sat, 31 March 2012, 07:23:28 »
JMK,
I tried your binary but it didn't work. Port D4 is for clock and D5 for data in your pin configuration, right?
I can't get any debug print on hid_listen when I pressed a key and don't know why.

You had better not edit codes except for config.h until it works well once.
Try this. This changes pin configuration only.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #19 on: Sat, 31 March 2012, 17:28:45 »
I am sorry that I gave you misconception. I did not change config.h in my firmware yet. So the pinout is the same with your original code: F0 and F1 for clock and data respectively.
The only thing that I changed in the uploaded firmware here is the keymap.
Thank you for the hex file. I will try it with my next try.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #20 on: Sat, 31 March 2012, 18:53:47 »
Ah, sorry.
I tried yours with F0 and F1, it works well and also your keymap seems to be OK.
No problem with my M0110. I think your binary should work on your M0110.

Let me know result when you put some parts together.
« Last Edit: Sat, 31 March 2012, 18:56:10 by hasu »

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #21 on: Sat, 31 March 2012, 21:58:27 »
If my firmware works for your m0110, maybe either my keyboard or teensy is the problem.
The parts arrive about ten days later. I will keep you updated.

Is there anyway that I can test my keyboard without the original Macintosh 128k/512k?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #22 on: Sun, 01 April 2012, 09:16:31 »
Port on your Teensy can become out of order under severe conditions though this will not happen so often.
But still there is possibility of it, if you have suspect of it you can try some other ports by editing config.h.

I can't come up with  a way to test keyboard without Mac.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #23 on: Sun, 01 April 2012, 15:58:48 »
When my parts arrive, I will just try one last time with the same port. If the same thing happens or the keyboard doesn't work at all, I will try other ports like D4 and D5.
Thank you.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #24 on: Sun, 15 April 2012, 19:26:57 »
Looks like posts are removed with server incident so I re-post mine here:

JMK,
I found there are two different version of M0110 and they have different signal timing. Let's call them 'old' and 'new', this picture from lowpoly's mod article shows 'old' one at top and 'new' one at bottom.


At this time my firmware  seems to support only 'new' one and can't host 'old' one. Mine is 'new' one.
See this Github issue page for the detail: https://github.com/tmk/tmk_keyboard/issues/6
Github user skagon is working on support of 'old' M0110 and M0110A. It will be done before too long.

I guess your M0110 is 'old' and is not supported in my firmware. In fact which is yours?
I should let you know this before this, sorry. I think my code is problematic and not your M0110 probably.

I will check my M0110 PCB and look into your pic later.

Quote from: JMK
I tried the mod once more using your hex file, and it didn't work at all.
And I did "make" after modifying the config.h file once again and tried the mod again. Nothing happened.
So I opened the keyboard and tested the controller. Please see the image.

(Attachment Link)

As shown in the image, I tested the connection between "1" and the controller part, and I found its direct connection.
But the bx in yellow rectangle are all connected, probably short-circuit. Is it normal? If it's not, I think this is definitely the problem.
I checked some other pins of the controller, and there are more short-circuit.

I think I just need a new controller rather than a converter. Lowpoly's mod will my last option then.
Please let me know your thoughts.
Thanks.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #25 on: Mon, 16 April 2012, 00:42:29 »
Oh! I see.
Mine is the old one.
Well, there seems to be a problem with geekhack, and I find that my last post was erased.

After I posted my last reply, I have been studying humble hacker's keyboard firmware to use it for my m0110 (old).
If "skagon" comes up with a solution sooner or later, I will just wait and see. But humble hacker's source code is very helpful to make a keyboard controller for other projects.
And don't be sorry for anything. I enjoyed the whole process, though sometimes was frustrated.
Thank you.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #26 on: Mon, 23 April 2012, 15:18:24 »
The most recent three posts have bee erased again. It is weird.

Anyway, I tried Skagon's code this time without changing anything. My computer recognizes my m0110 but two characters are typed at one key stroke.
First I did not use resistors and second I added resistors, but the result is the same.

Maybe my keyboard is defective.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #27 on: Mon, 23 April 2012, 17:09:18 »
Here is what I did today.
Instead of cutting an end of the handset cable, I used a socket and a stripboard

[ Attachment Invalid Or Does Not Exist ] 48756[/ATTACH]

As I mentioned in the previous post, I tried both your and Skagon's firmwares. In the case of your firmware, I simply changed the port to use B0 and B1 (which is the default setting of skagon's)
My computer recognizes the keyboard (without resistors with your firmware as well), but two characters are typed at one key stroke.

I ordered m0110a and it is on its way to my place. I will try skagon's firmware with m0110a. If it works, it maybe a proof that my m0110 is defective.

************************
update:
I just received m0110a, installed skagon's firmware (original/no change), plugged in.
The result is the same, two characters at one key stroke.
I assume that it may have something to do with my computer or OS.
« Last Edit: Mon, 23 April 2012, 18:53:56 by JMK »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #28 on: Mon, 23 April 2012, 19:00:29 »
Thanks for reporting.

Hmm, it is too bad...
Did you try OS key repetition setting or other OS than OSX?
I've never tried this converter on OSX.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #29 on: Mon, 23 April 2012, 22:22:42 »
I don't have windows machine. I did try on windows but as a virtual machine, and the result was the same.
What is interesting is that your firmware actually worked without pull up resistors.

Did you not say that you actually updated your code? If you come up with a solution please let me know. Thank you.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #30 on: Tue, 24 April 2012, 09:39:51 »
Ah, it seems to be problematic only on OSX.  I just remembered this bug which fixed one year ago.
http://geekhack.org/showwiki.php?title=Island:14290&viewfull=1&page=4&do=comments#post307392
Looks like the bug come back again at some point. Unfortunately I have no usable Mac to fix and verify now.

This tentative patch might cure the bug.
Code: [Select]

diff --git a/pjrc/usb.c b/pjrc/usb.c
index 2b69b6a..3e18144 100644
--- a/pjrc/usb.c
+++ b/pjrc/usb.c
@@ -657,6 +657,7 @@ ISR(USB_GEN_vect)
                        }
                }
                 /* TODO: should keep IDLE rate on each keyboard interface */
+/*
 #ifdef NKRO_ENABLE
                if (!keyboard_nkro && usb_keyboard_idle_config && (++div4 & 3) == 0) {
 #else
@@ -677,6 +678,7 @@ ISR(USB_GEN_vect)
                                }
                        }
                }
+*/
        }
 }


Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #31 on: Tue, 24 April 2012, 13:52:48 »
Thank you for the patch. I follow the link and noticed that I knew this thread. It was about "vendor id" right?
But I am not sure where I use your patch. Is it config.h? I did find "vendor id (0xfeed)" on line 25 in config.h.
Sorry. Please let me know how to use your patch. Thanks.


*******************
Hey!
Good news!
I just changed the vendor id to 0x05AC, and it works now. I will try to remap the code and re-make my hex file and try to type again.
Thank you so much. I will update this post after I update my code. Thank you again.


*******************
Now I am typing on my m0110. Everything works fine. I did not add pull up resistor, but it works just fine. But it once stopped working. I unplugged and replugged. It started working again. If stability is an issue without pull up resistors, I will add them later.

Well, I noticed that I have a couple of bad keys that needs to be repaired.

Another thing that I noticed is that compared to m0110a, m0110 is much heavier.

I have a question hasu. How do I toggle or enter other layers? If I hold fn2 key, I can use a wasd layer, but I don't know how to enter other layers.

Again, thank you for sharing your mod and code.
« Last Edit: Tue, 24 April 2012, 15:21:12 by JMK »

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #32 on: Tue, 24 April 2012, 20:28:50 »
Great!
I'll fix the bug of my firmware on Mac SET_IDLE behaviour at some point of near future.

My firmware has no 'software' layer toggle feature currently, you need to keep Fn key down to use a layer.
M0110 has a locking switch for CapsLock so you can assign Fn key into the key to get 'mechanical' toggle feature.

To use other layers you can hold ;(Fn0) for mouse key layer and hold /(Fn1) for cursor key layer.
These layers use 'vi editor like' key binding due to my preference.

Code: [Select]
    * HHKB/WASD Layer:
     * You can register Esc by hitting(press&release) Fn0 quickly.
     * ,---------------------------------------------------------.  
     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet|  
     * |---------------------------------------------------------|
     * |Caps |Hom| Up|PgU|   |   |   |   |Psc|Slk|Pau|Up |Ins|  \|
     * |---------------------------------------------------------|
     * |Contro|Lef|Dow|Rig|   |   |   |   |Hom|PgU|Lef|Rig|Return|
     * |---------------------------------------------------------|
     * |Shift   |End|   |PgD|   |VoD|VoU|Mut|End|PgD|Dow|   Shift|
     * `---------------------------------------------------------'  
     *      |xxx|Alt |         Space               |Gui |xxx|        
     *      `-----------------------------------------------'
     * mouse key                                                                                      
     * ,---------------------------------------------------------.
     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet|
     * |---------------------------------------------------------|
     * |Caps |   |   |   |   |   |WwL|MwD|MwU|MwR|   |   |   |   |
     * |---------------------------------------------------------|
     * |Contro|Vod|VoU|Mut|   |   |McL|McD|McU|McR|xxx|   |Return|
     * |---------------------------------------------------------|
     * |Shift   |   |   |   |   |Mb3|Mb2|Mb1|   |   |   |   Shift|
     * `---------------------------------------------------------'
     *      |   |Alt |         Mb1                 |Gui |   |
     *      `-----------------------------------------------'
Mw: Mouse wheel
Mc: Mouse cursor
Mb: Mouse button(1: left, 2: right, 3: middle)
     * cursor key
     * ,---------------------------------------------------------.
     * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet|
     * |---------------------------------------------------------|
     * |Caps |   |   |   |   |   |Hom|PgD|PgU|End|   |   |   |   |
     * |---------------------------------------------------------|
     * |Contro|   |   |   |   |   |Lef|Dow|Up |Lef|   |   |Return|
     * |---------------------------------------------------------|
     * |Shift   |   |   |   |   |   |Hom|PgD|PgU|End|xxx|   Shift|
     * `---------------------------------------------------------'
     *      |   |Alt |         Space               |Gui |   |
     *      `-----------------------------------------------'


Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #33 on: Tue, 24 April 2012, 22:05:39 »
Thank you so much.
So to use "cursor keys" layer, I need to press and hold Fn1 key, right?
I guess on mac osx, "mousekeys" layer is not working.
But "wasd" and "cursorkeys" layers are working very well.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #34 on: Wed, 25 April 2012, 00:02:26 »
I beleive mouse key feature was confirmed also on Mac about year ago.
But the SET_IDLE bug may affect this feature on Mac at this time.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #35 on: Wed, 25 April 2012, 09:44:39 »
Oh, I see. You assigned Fn0 to the ' key. If I press and hold the ' key, it types ''''''''''''''''''''''''''''''''''''''' like this, rather than enters the layer mode.
If Fn1 key, which is assigned to the / key, is pressed and hold, it enters the assigned layer mode.
Well, anyway, I am very satisfied with your converter, hasu. Without wiring and installing a new controller, I can use all the keys that the full size keyboard has.
In fact, except for HHKB, I don't even know if there is any keyboard that only has 58 keys with the capability of full size keyboard.
It's really great.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #36 on: Sat, 28 April 2012, 17:19:36 »
Hi
I just checked out your github repository. Your converter finally supports M0110A as well. It's fantastic! I will try it!

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #37 on: Sat, 28 April 2012, 22:38:26 »
Unfortunately M0110A support has bugs at this time and won't be done until I get the keyboard for development.
But I appreciate if you try my code and report.

Instead you can try skagon's repository which already used without problem for himself for a while.
https://github.com/skagon/tmk_keyboard
But it also has Mac SET_IDLE problem so you sill may need work around for it.
I mean, you will need this patch or use of Apple id(0x05AC) as VENDOR_ID in config.h.
https://github.com/tmk/tmk_keyboard/commit/e6f79b1e5aa083c892e2c077c15a762639c7848d

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #38 on: Sun, 29 April 2012, 00:07:57 »
Hmm, I see.
In the case of skagon's firmware, changing vendor id did not work when I tried.
I will try the patch this time and report how it goes. Thank you for the links.

I wish we live near by so that I can lend my m0110a to you for your code development, which will eventually benefit my keyboard life. :-)

***********
update

Good news!
Your patch is very good. My m0110a has no problem with multiple characters at a stroke. I need to remap several keys. But other than that, it seems your patch solves the problem. Great!!!!


************
bad news
skagon's firmware stopped working after i changed the keymap.
I restored the firmware that worked previously, but it still doesn't work. lol
Maybe i made a mistake when restoring.
« Last Edit: Mon, 30 April 2012, 08:06:45 by JMK »

Offline skagon

  • Posts: 12
    • http://www.skagon.com
Macintosh M0110 USB converter
« Reply #39 on: Thu, 03 May 2012, 09:38:53 »
Hello there!
Yup, I'm the same skagon from GitHub.
I haven't yet understood if my fork works with your M0110A or not. Could you please elaborate on that?
Also, I don't have any Macintoshes around here -- well, I mean *modern* Macs -- so I don't know what's going on with those.
If everything works, after applying the Mac patch on my fork, I'd like you to do some tests for me. You could also read my (long) commentary from GitHub on the problems I ran into with the M0110A and shift keys and keypad and arrow keys. That should provide some insight on what to check. ;)

Thanks, guys!

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #40 on: Thu, 03 May 2012, 13:20:35 »
Quote from: skagon;589009
Hello there!
Yup, I'm the same skagon from GitHub.
I haven't yet understood if my fork works with your M0110A or not. Could you please elaborate on that?
Also, I don't have any Macintoshes around here -- well, I mean *modern* Macs -- so I don't know what's going on with those.
If everything works, after applying the Mac patch on my fork, I'd like you to do some tests for me. You could also read my (long) commentary from GitHub on the problems I ran into with the M0110A and shift keys and keypad and arrow keys. That should provide some insight on what to check. ;)

Thanks, guys!

Hello skagon,
Thank you for your code.
Your code worked for my m0110a. After confirming that, I tried to modify some positions of keys and removed the small device inside Caps Lock key that holds the key when pushed. After then, for some strange reason, my m0110a started not working. So currently it is not working. It's a mystery.
By the way, it's nice to meet you, though we've never actually met. :-)

Offline skagon

  • Posts: 12
    • http://www.skagon.com
Macintosh M0110 USB converter
« Reply #41 on: Thu, 03 May 2012, 14:33:18 »
Hi JMK! Well, that's the beauty of the Internets! :P You can be better friends with someone you met on-line rather than your next-door neighbour.

Anyway... onto the case now. You said you did something with the caps lock key and now the keyboard isn't working? Or was it because you changed the keymap?
I haven't touched the keys of my A, well, apart from cleaning and some TLC and desoldering the controller and soldering an IC socket in its place, and lots and lots of cleaning. And cleaning. I guess the previous owners were pigs and used the keyboard as a plate for pizza, burgers and chips.
Anyway... can you get a multimetre and verify that the Caps Lock isn't shorted? You can test it from the back side of the PCB, by targeting the two solder points of the switch.
Besides, you can always download a fresh copy of my fork and rebuild from there. Then, it should work again. I can say from experience that the keymaps are very touchy pieces of "code". Make sure the compiler is actually compiling and not producing errors, and also you can use the HID_listen and see what debug info it's spitting out.
Somehow, I don't think you 'killed' your A by removing the locking mechanism.
On another note... I just love typing on this little baby. Much better feel than the plain M0110. The difference in cinematic terms is like comparing the "War Games" keyboard with the "Star Trek 4" "hello computer" keyboard. Oh wait, the "hello computer" keyboard actually *is* the M0110A... *shrug* hey ho... :)

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #42 on: Thu, 03 May 2012, 20:08:25 »
Quote from: skagon;589271
Hi JMK! Well, that's the beauty of the Internets! :P You can be better friends with someone you met on-line rather than your next-door neighbour.

Anyway... onto the case now. You said you did something with the caps lock key and now the keyboard isn't working? Or was it because you changed the keymap?
I haven't touched the keys of my A, well, apart from cleaning and some TLC and desoldering the controller and soldering an IC socket in its place, and lots and lots of cleaning. And cleaning. I guess the previous owners were pigs and used the keyboard as a plate for pizza, burgers and chips.
Anyway... can you get a multimetre and verify that the Caps Lock isn't shorted? You can test it from the back side of the PCB, by targeting the two solder points of the switch.
Besides, you can always download a fresh copy of my fork and rebuild from there. Then, it should work again. I can say from experience that the keymaps are very touchy pieces of "code". Make sure the compiler is actually compiling and not producing errors, and also you can use the HID_listen and see what debug info it's spitting out.
Somehow, I don't think you 'killed' your A by removing the locking mechanism.
On another note... I just love typing on this little baby. Much better feel than the plain M0110. The difference in cinematic terms is like comparing the "War Games" keyboard with the "Star Trek 4" "hello computer" keyboard. Oh wait, the "hello computer" keyboard actually *is* the M0110A... *shrug* hey ho... :)

Hey! I am back again with good news!
I noticed when I desoldered Caps Lock switch, I actually ruined a small portion of the pcb pattern which disabled electric circuit.
I fixed the problem by wiring one pin of caps lock and one pin of L-shift. I already had the zip file of your code and started from the beginning to build my firmware.
I modified usb.c according to hasu's patch, and rearranged keymap a little bit. I assigned FN2 to BSLSH and LCTL to the actual Caps Lock key.
And the result is... IT WORKS!!!

The switches of M0110A (made in the US not somewhere else) feel better than M0110. M0110 is much heavier and noisier, though which are the attractiveness of M0110.
I like the arrow keys and DEL key assigned to "clear" key. I think I am going to use it as my primary keyboard for a while. My only complain is its right shift key, which is ridiculously small due to the up-arrow key. Well, anyway, M0110A is one of the most wonderful keyboard that I have ever used so far.

Thank you, skagon. It is really great.
« Last Edit: Thu, 03 May 2012, 21:37:51 by JMK »

Offline skagon

  • Posts: 12
    • http://www.skagon.com
Macintosh M0110 USB converter
« Reply #43 on: Thu, 03 May 2012, 22:14:37 »
I'm glad you got it working, mate. Actually, I did something similar with one of my M0110s. Dislocated the pad off the PCB, that is.

Anyhow... now that you've got it working, I'd like some feedback regarding the combination of shift plus arrow keys, you know, selecting text or something, shift plus keypad keys, etc. If you read my notes, that's the whole issue with the A keyboards: the fact that the arrows and the 'calc' keys are essentially the same keys, only the 'calc' keys are shifted arrow keys. I've really tried to make the code tell them apart, but I'd like to see how well my code works in various usage scenarios. Ok, realistically, there's no reason you should press the calc keys with shift since they don't do anything, but I don't know, someone else might have mapped them as different keys. Also, the arrow keys plus shift, that's not such a far-fetched scenario. Basically what I'm interested in is to see how well the keyboard behaves when the shift and arrow/calc/pad/whatever keys are pressed or released simultaneously. And yeah, I already know that sometimes, pressing shift and one arrow key simultaneously, will produce a calc key event. I'm sorry, that can't be helped. I want to know if it happens too frequently for your typing patterns, if it's noticeable, if anything else weird happens, **** like that.

Incidentally, the keypad numerical keys when combined with shift change to arrow keys (8, 4, 6, 2), page up/down (9, 6), home/end (7, 1) and insert/del (0, dot) BY DEFAULT. So, if you need these keys, you don't really *have* to assign extra layers, if the layout and un-combina-bility with 'shift' doesn't concern you. Personally, I kinda need them, so the only extra layer I'm using is utilising the (unmodified) Caps Lock.

Actually, I too love the feel of the A and even though I can't really use it as a primary, when it comes to just typing text (which is mostly linear), I'm using that. For the rest, I've got an... Apple A1048! Yeah, I guess these guys knew how to make good keyboards... up until they started those chiclet things.

Oh, and... mainly, thank tmk who made the bulk of the code. I just made sure it's working with the A. ;)
[Well, ok, in all fairness, dealing with the keypad and shift codes was a *****... :P]

Offline skagon

  • Posts: 12
    • http://www.skagon.com
Macintosh M0110 USB converter
« Reply #44 on: Sat, 12 May 2012, 08:23:13 »
I seriously don't know what the hell's going on here... it's like groundhog day! You come back and everything's the same, posts missing etc.
...

Anyway, JMK you might want to recheck my code, just to be on the safe side... ;)

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #45 on: Sat, 12 May 2012, 14:53:56 »
Quote from: skagon;590604
I seriously don't know what the hell's going on here... it's like groundhog day! You come back and everything's the same, posts missing etc.
...

Anyway, JMK you might want to recheck my code, just to be on the safe side... ;)

Yeah. most recent posts keep being erased. Well. I just want to let you know that I have not found anything wrong with your code so far.
I will try your new code and post the result here again sometime soon. See you then.

Offline JMK

  • Posts: 31
Macintosh M0110 USB converter
« Reply #46 on: Sat, 12 May 2012, 15:27:46 »
Hey skagon.
I just tried your most recent code and have not notice any problem or mis-behavor whatsoever.
Only problem for mac user is "RALT." Mac users must redesign their keymap for their own convenience. Other than that, there is no problem.

Offline YakMN

  • Posts: 35
Macintosh M0110 USB converter
« Reply #47 on: Mon, 14 May 2012, 22:47:26 »
I just wanted to thank TMK for the adapter mod I have been looking for, for like 5 years. I had hoped KDBabel would work out, but it never quite got there. I couldn't figure out the keyboard hack that the guy with the mac-mini-in-a-mac512 case did (also incredible mod overall). THIS, however, I can do. Especially now that JMK and Skagon and TMK have been so great in ironing out bugs. Can't wait for the Teensy to get here!!.

TMK, if I was going to Tokyo this year, I'd drop off a M0110A for you, but sadly, I'm skipping this year. You'll probably have one by next summer, but if not, let me know.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Macintosh M0110 USB converter
« Reply #48 on: Tue, 15 May 2012, 12:45:14 »
Hi YakMN, welcome to GeekHack!
I finally got my M0110A yesterday so I can do things for this keyboard now.

skagon, thanks for your commentary on the code. I saw your code in action and it works well.
And I could debug and fix some problems of my code due to my M0110A and my code seems to work well too.
I'll look into your code in detail and compare its behaviour with mine later on.

BTW My M0110A(made in Japan/Mitsumi  switch) is very bad shape, it has dirty rust on mounting plate and some faulty switches. And I don't feel better with Mitsumi swtich than M0110 ALPS so far. My M0110 is way better than this lame board though it is just heavier. This comparison is not fair because my m0110 was completely overhauled and lubricated thoroughly. Above all  I love compact and minimalist keyboard :)

Offline snoopy

  • The Flying Ace
  • * Elevated Elder
  • Posts: 1828
  • Location: Industrial Environment
  • Gone with the Wind
Macintosh M0110 USB converter
« Reply #49 on: Wed, 16 May 2012, 16:37:52 »
Now, that I finally got my m0110, I don't know what to do.... Replacing the complete pcb or only usimg a teensy as adapter? What are the advantages/disadvantages?