TMK keyboard firmware collection

User avatar
idollar
i$

02 Nov 2014, 13:37

Hi,

Thanks once more !

I relation with the questions before:

1) TMK converter doesn't support external LEDs

OK. If I write some code, would you consider including it ?

2) hid_listen

it was a matter of permissions. sudo hid_listen solved the issue.
I wonder why it works with Soarer's firmware. This is why I did not think of this option.
Strange that I have not found this problem in any entry in the forum ...

Regards

i$

--------------------------------
UPDATE
--------------------------------

Done :-)

The code is written and working for the ps2-usb converter.

I have also ported to the terminal-usb converter, but I cannot tested (still :-))
I have used git. Integrating the code should be simple.

In converter/ps2_usb/config.h
Spoiler:
/*
* PHYSICAL LEDs PINOUT
*/
#ifdef PHYSICAL_LEDS_ENABLE

#define LED_INIT_LOOPS 2
#define LED_INIT_DELAY 40

#ifdef CAPS_LOCK_LED_ENABLE
#define CAPS_LOCK_LED_PORT PORTF
#define CAPS_LOCK_LED_PIN PINF
#define CAPS_LOCK_LED_DDR DDRF
#define CAPS_LOCK_LED_BIT 6
#endif

#ifdef NUM_LOCK_LED_ENABLE
#define NUM_LOCK_LED_PORT PORTF
#define NUM_LOCK_LED_PIN PINF
#define NUM_LOCK_LED_DDR DDRF
#define NUM_LOCK_LED_BIT 7
#endif

#ifdef SCROLL_LOCK_LED_ENABLE
#define SCROLL_LOCK_LED_PORT PORTF
#define SCROLL_LOCK_LED_PIN PINF
#define SCROLL_LOCK_LED_DDR DDRF
#define SCROLL_LOCK_LED_BIT 5
#endif

#endif


In converter/ps2_usb/Makefile
Spoiler:
# External LEDs Options
#
PHYSICAL_LEDS_ENABLE = yes # text
CAPS_LOCK_LED_ENABLE = yes # text
NUM_LOCK_LED_ENABLE = yes # text
SCROLL_LOCK_LED_ENABLE = yes # text


In converter/ps2_usb/led.c
void led_set(uint8_t usb_led)
{
uint8_t ps2_led = 0;
if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
SCROLL_LOCK_LED_ON; }
else SCROLL_LOCK_LED_OFF;
if (usb_led & (1<<USB_LED_NUM_LOCK)) {
ps2_led |= (1<<PS2_LED_NUM_LOCK);
NUM_LOCK_LED_ON; }
else NUM_LOCK_LED_OFF;
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
ps2_led |= (1<<PS2_LED_CAPS_LOCK);
CAPS_LOCK_LED_ON; }
else CAPS_LOCK_LED_OFF;
ps2_host_set_led(ps2_led);
}


#ifdef PHYSICAL_LEDS_ENABLE

void physical_led_init()
{

uint8_t counter;

for (counter=0; counter<LED_INIT_LOOPS; counter++) {
#ifdef NUM_LOCK_LED_ENABLE
NUM_LOCK_LED_INIT;
NUM_LOCK_LED_ON;
_delay_ms(LED_INIT_DELAY);
NUM_LOCK_LED_OFF;
#endif

#ifdef CAPS_LOCK_LED_ENABLE
CAPS_LOCK_LED_INIT;
CAPS_LOCK_LED_ON;
_delay_ms(LED_INIT_DELAY);
CAPS_LOCK_LED_OFF;
#endif

#ifdef SCROLL_LOCK_LED_ENABLE
SCROLL_LOCK_LED_INIT;
SCROLL_LOCK_LED_ON;
_delay_ms(LED_INIT_DELAY);
SCROLL_LOCK_LED_OFF;
#endif
}

}

#endif


In common/led.h
Spoiler:
#ifdef PHYSICAL_LEDS

/* CAPS_LOCK_LED_ENABLE */
#ifdef CAPS_LOCK_LED_ENABLE

#if !((defined CAPS_LOCK_LED_PORT) && \
(defined CAPS_LOCK_LED_PIN) && \
(defined CAPS_LOCK_LED_DDR) && \
(defined CAPS_LOCK_LED_BIT))
# error "CAPS_LOCK_LED is ENABLE but ports configuration is not defined in config.h"
#endif

#define CAPS_LOCK_LED_INIT (CAPS_LOCK_LED_DDR |= (1<<CAPS_LOCK_LED_BIT))
#define CAPS_LOCK_LED_ON (CAPS_LOCK_LED_PORT |= (1<<CAPS_LOCK_LED_BIT)) // Set the bit to 1
#define CAPS_LOCK_LED_OFF (CAPS_LOCK_LED_PORT &= ~(1<<CAPS_LOCK_LED_BIT)) // Clears the bit to 0

#else

#define CAPS_LOCK_LED_INIT
#define CAPS_LOCK_LED_ON
#define CAPS_LOCK_LED_OFF

#endif
/* CAPS_LOCK_LED_ENABLE */

/* NUM_LOCK_LED_ENABLE */
#ifdef NUM_LOCK_LED_ENABLE
#if !((defined NUM_LOCK_LED_PORT) && \
(defined NUM_LOCK_LED_PIN) && \
(defined NUM_LOCK_LED_DDR) && \
(defined NUM_LOCK_LED_BIT))
# error "NUM_LOCK_LED is ENABLE but ports configuration is not defined in config.h"
#endif

#define NUM_LOCK_LED_INIT (NUM_LOCK_LED_DDR |= (1<<NUM_LOCK_LED_BIT))
#define NUM_LOCK_LED_ON (NUM_LOCK_LED_PORT |= (1<<NUM_LOCK_LED_BIT)) // Set the bit to 1
#define NUM_LOCK_LED_OFF (NUM_LOCK_LED_PORT &= ~(1<<NUM_LOCK_LED_BIT)) // Clears the bit to 0

#else

#define NUM_LOCK_LED_INIT
#define NUM_LOCK_LED_ON
#define NUM_LOCK_LED_OFF

#endif
/* NUM_LOCK_LED_ENABLE */

/* SCROLL_LOCK_LED_ENABLE */
#ifdef SCROLL_LOCK_LED_ENABLE
#if !((defined SCROLL_LOCK_LED_PORT) && \
(defined SCROLL_LOCK_LED_PIN) && \
(defined SCROLL_LOCK_LED_DDR) && \
(defined SCROLL_LOCK_LED_BIT))
# error "SCROLL_LOCK_LED is ENABLE but ports configuration is not defined in config.h"
#endif

#define SCROLL_LOCK_LED_INIT (SCROLL_LOCK_LED_DDR |= (1<<SCROLL_LOCK_LED_BIT))
#define SCROLL_LOCK_LED_ON (SCROLL_LOCK_LED_PORT |= (1<<SCROLL_LOCK_LED_BIT)) // Set the bit to 1
#define SCROLL_LOCK_LED_OFF (SCROLL_LOCK_LED_PORT &= ~(1<<SCROLL_LOCK_LED_BIT)) // Clears the bit to 0

#else

#define SCROLL_LOCK_LED_INIT
#define SCROLL_LOCK_LED_ON
#define SCROLL_LOCK_LED_OFF

#endif
/* SCROLL_LOCK_LED_ENABLE */

void physical_led_init();

#else

#define CAPS_LOCK_LED_ON false;
#define CAPS_LOCK_LED_OFF false;
#define NUM_LOCK_LED_ON false;
#define NUM_LOCK_LED_OFF false;
#define SCROLL_LOCK_LED_ON false;
#define SCROLL_LOCK_LED_OFF false;

#endif

In common/keyboard.c
Spoiler:
void keyboard_init(void)
{
timer_init();
matrix_init();
#ifdef PS2_MOUSE_ENABLE
ps2_mouse_init();
#endif
#ifdef SERIAL_MOUSE_ENABLE
serial_mouse_init();
#endif


#ifdef BOOTMAGIC_ENABLE
bootmagic();
#endif

#ifdef BACKLIGHT_ENABLE
backlight_init();
#endif

#ifdef PHYSICAL_LEDS_ENABLE
physical_led_init();
#endif
}


In common.mk
# LEDs
ifdef PHYSICAL_LEDS_ENABLE
OPT_DEFS += -DPHYSICAL_LEDS_ENABLE
endif
ifdef CAPS_LOCK_LED_ENABLE
OPT_DEFS += -DCAPS_LOCK_LED_ENABLE
endif
ifdef NUM_LOCK_LED_ENABLE
OPT_DEFS += -DNUM_LOCK_LED_ENABLE
endif
ifdef SCROLL_LOCK_LED_ENABLE
OPT_DEFS += -DSCROLL_LOCK_LED_ENABLE
endif


Let me know ...


-- EDIT - The code is hidden to ease the reading
Last edited by idollar on 10 Nov 2014, 21:22, edited 1 time in total.

User avatar
hasu

03 Nov 2014, 00:21

idollar wrote: Hi,

Thanks once more !

I relation with the questions before:

1) TMK converter doesn't support external LEDs

OK. If I write some code, would you consider including it ?
Great.
I'll look into your code, could you make a pull request on github?

2) hid_listen

it was a matter of permissions. sudo hid_listen solved the issue.
I wonder why it works with Soarer's firmware. This is why I did not think of this option.
Strange that I have not found this problem in any entry in the forum ...
You also need the priviledge for Soarers, but if you have a 'udev rule' for it you can avoid using 'sudo'.
I guess you added an entry of 'udev rule' in /etc/udev/rules.d some point in past and forgot it completely :D

You can add this file in rules.d directory for TMK if you want.
File: /etc/udev/rules.d/52-tmk-keyboard.rules

Code: Select all

# tmk keyboard products     https://github.com/tmk/tmk_keyboard
SUBSYSTEMS=="usb", ATTRS{idVendor}=="feed", MODE:="0666"

User avatar
idollar
i$

03 Nov 2014, 09:15

I will do it.
I just need to figure out how to do it. I am new with git :-)

i$

User avatar
idollar
i$

07 Nov 2014, 15:31

I just wanted to say that I have not forgotten this.
I just need some time. The weekend will help :-)

quantalume

07 Nov 2014, 19:13

idollar wrote: I will do it.
I just need to figure out how to do it. I am new with git :-)

i$
All you need to do is fork, make your changes, then issue the pull request. You can use either the web interface or hub to issue the request.

User avatar
idollar
i$

08 Nov 2014, 15:08

Hello,

Could it be that I do not have access to the repository ?

This is the new branch in my fork:
Spoiler:

Code: Select all

idollar@x201:~/tmk_keyboard$ git branch
* master
  phys_leds
I have created an ssh key and tested it against github:
Spoiler:

Code: Select all

idollark@x201:~/github/tmk_keyboard$ ssh -vT git@github.com
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /home/imascara/.ssh/config
....
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.utf8
[b]Hi idollark! You've successfully authenticated, but GitHub does not provide shell access.[/b]
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3312, received 1768 bytes, in 0.2 seconds
Bytes per second: sent 14442.6, received 7709.7
debug1: Exit status 1
And my fork should be pointing to the correct url:
Spoiler:

Code: Select all

idollark@x201:~/tmk_keyboard$ git remote -v
origin	ssh://git@github.com/tmk/tmk_keyboard.git (fetch)
origin	ssh://git@github.com/tmk/tmk_keyboard.git (push)
upstream	ssh://git@github.com/tmk/tmk_keyboard.git (fetch)
upstream	ssh://git@github.com/tmk/tmk_keyboard.git (push)
But I still do not have access to the repository:
Spoiler:

Code: Select all

idollark@x201:~/tmk_keyboard$ git push origin phys_leds
[b]ERROR: Permission to tmk/tmk_keyboard.git denied to idollark.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights[/b]
and the repository exists.
What am I doing wrong ?
Last edited by idollar on 10 Nov 2014, 21:25, edited 1 time in total.

User avatar
hasu

09 Nov 2014, 06:28

No, you cannot push my repository directly, instead you can send a pull request.
https://help.github.com/articles/creati ... l-request/

But you don't have to lose your time to do this, your previous post already has codes enough for others to reuse. I'll refer to the post in TMK documentation for people interested in adding external LED indicators.

User avatar
idollar
i$

09 Nov 2014, 09:24

Hello Hasu,

I would prefer to add the code, after the required review and if agreed, to the mail branch. In this way I will not have to maintain my own local version.

I attach a picture of the result :-)
Demo.jpg
Demo.jpg (154.85 KiB) Viewed 25711 times
I have tried to create a pull request. The problem is that I cannot do it against my code. My local branch (the one that I have in my computer) is not in the server. I cannot push to it (refer to my previous post). I can pull the code, but I cannot push anything to the repository.

Let me be a little more verbose. We may get there :-) After my reading I came to the following conclusions:

1.- I shall fork the code to my local computer (done)
2.- I shall create a new branch in my local computer (done)
Spoiler:

Code: Select all

git branch phys_leds
git checkout phys_leds
3.- I shall edit the code and test it localy (done)
Spoiler:
I am actually typing with your converter AND THE CAPSLOCK LIGHTS WHEN TYPING THIS :-)
3.- I shall commit the changes to the new local branch in my computer (done)
Spoiler:

Code: Select all

git commit -a -m 'corrected name for PHYSICAL_LEDS_ENABLE (cont)'
4.- Once I am done, I send the code to the github (this is what it does not work)
Spoiler:

Code: Select all

idollark@x201:~/tmk_keyboard$ git push origin phys_leds
[b]ERROR: Permission to tmk/tmk_keyboard.git denied to idollark.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights[/b]
and the repository exists.
I guess that somehow the owner/manager of the code shall give me permissions.
5.- Once the data is in the server I can create a pull request for you to review the code (this is what it does not work)
Spoiler:
I can access the menu in github but only my fork, without my new branch is offered. That's normal, my code is not in the server.
Screenshot1.jpg
Screenshot1.jpg (49.83 KiB) Viewed 25719 times
6.- The next step would be you review my pull request and add the code to the server if agreed. (tbd)

I guess that somehow the owner of the repository shall allow me to work on it. Am I correct ?

As I said, I have only retrieved (forked) git code before. It is the first time that I use it to propose changes. I know that this is not the topic of this thread, but I guess that it is somehow interesting as other people that may want to propose changes may have the same problems.
I must admit that I also had some problems to find "useful" information about github. There is lot of documentation, but there is not simple explanation on how to do the very basic thing that we (I) am trying to do here.

Cheers

User avatar
hasu

10 Nov 2014, 17:41

Nice converter setup :D

at step 4 you should push your commits into your own github repository instead of 'tmk'. Problem is that origin means tmk repository, not yours.

To change repository this will work.

Code: Select all

$ git remote set-url origin git@github.com:idollark/tmk_keyboard.git
Then push your commits into your own repository.

Code: Select all

$ git push
EDIT:
or your may need this to push the branch.

Code: Select all

git push origin phys_leds:
Now you can create pull request with github menu probably...

User avatar
idollar
i$

10 Nov 2014, 20:59

Thank you ! Finally. At last !
I managed to push my code to the server and create the pull request from it.
I will post a correction to my post above to help anyone that may want to propose any code

Regards
Last edited by idollar on 10 Nov 2014, 21:08, edited 1 time in total.

User avatar
idollar
i$

10 Nov 2014, 21:07

The following corrects my post above with the information from hasu he hope that it may help someone in the future.

1.- I shall fork the code to my local computer (done)

2.- I shall create a new branch in my local computer (done)
Spoiler:

Code: Select all

git branch phys_leds
git checkout phys_leds
3.- I shall edit the code and test it localy (done)
Spoiler:
I am actually typing with your converter AND THE CAPSLOCK LIGHTS WHEN TYPING THIS :-)
3.- I shall commit the changes to the new local branch in my computer (done)
Spoiler:

Code: Select all

git commit -a -m 'corrected name for PHYSICAL_LEDS_ENABLE (cont)'
4.- Once I am done, I send the code to my repository in the github server (done)
Spoiler:

Code: Select all

idollark@x201:~/tmk_keyboard$ git remote set-url origin git@github.com:idollark/tmk_keyboard.git
idollark@x201:~/tmk_keyboard$ git push origin phys_leds
5.- Once the data is in the server I can create a pull request for you to review the code (done)

6.- The next step would be you review my pull request and add the code to the server if agreed. (tbd)

User avatar
hasu

11 Nov 2014, 02:17

Thanks, I got your pull request. I'll look into it later.

teuf

11 Nov 2014, 18:19

Hey, just a few additional notes
idollar wrote:
1.- I shall fork the code to my local computer (done)

2.- I shall create a new branch in my local computer (done)

Code: Select all

git branch phys_leds
git checkout phys_leds
This can be shortened as

Code: Select all

git checkout -b phys_leds
idollar wrote: 3.- I shall edit the code and test it localy (done)
Spoiler:
I am actually typing with your converter AND THE CAPSLOCK LIGHTS WHEN TYPING THIS :-)
3.- I shall commit the changes to the new local branch in my computer (done)

Code: Select all

git commit -a -m 'corrected name for PHYSICAL_LEDS_ENABLE (cont)'
I avoid the '-a' option as much as possible, and prefer to first go with

Code: Select all

git add -p
to add the changes one by one, and then use

Code: Select all

git commit
. The '-m' option will encourage you to have very short commit messages, which is also something I try to avoid. In this case, I'd indicate in the longer commit log what issues this wrong name was causing, and what the commit is fixing.
idollar wrote: 4.- Once I am done, I send the code to my repository in the github server (done)

Code: Select all

idollark@x201:~/tmk_keyboard$ git remote set-url origin git@github.com:idollark/tmk_keyboard.git
idollark@x201:~/tmk_keyboard$ git push origin phys_leds
You don't have to do everything on the 'origin' remote. In this case, you probably want to have both a remote for your repository so that you can push changes to it, but also a remote in order to sync up with hasu's changes. You can add a remote URL for your repository with

Code: Select all

git remote add idollark git@github.com:idollark/tmk_keyboard.git
and then push to it with

Code: Select all

git push idollark master
. Or you can decide 'origin' points to your repo, and have a remote for hasu's repository.

User avatar
idollar
i$

20 Nov 2014, 08:29

@teuf - Thank you !

User avatar
idollar
i$

26 Nov 2014, 06:53

Hi,

I am trying to set a keymap for an Spanish layout. And i am somehow confused.
How may I set the symbol "ñ" ?

I managed to define the following FN0 (~ followed by n) and FN1 (~ followed by N) that would work if I set the keyboard in the OS to "US with dead keys". The documentation somehow week for this feature. I had to reverse engineer the code of some of the distributed keyboard codes.

This is the code that I have added in my keymap_XYZ.c. I then used FN0 and FN1 in the keymaps[][MATRIX_ROWS][MATRIX_COLS] matrix:

Code: Select all

/*
 * Macro definition
 */
enum macro_id {
    ENE,
    ENEMAYUSCULA,
};

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
    keyevent_t event = record->event;
    //uint8_t tap_count = record->tap_count;

    switch (id) {
        case ENE:
            return (event.pressed ?
                    MACRO( D(LSHIFT), T(GRV), U(LSHIFT), T(N), END ) :
                    MACRO( END ) );
        case ENEMAYUSCULA:
            return (event.pressed ?
                    MACRO( D(LSHIFT), T(GRV), T(N), U(LSHIFT), END ) :
                    MACRO( END ) );
    }
    return MACRO_NONE;
}


const uint16_t PROGMEM fn_actions[] = {
    [0] = ACTION_MACRO(ENE),
    [1] = ACTION_MACRO(ENEMAYUSCULA),
};
Is there any other way of doing this ?

Many thanks in advance !



@hasu

On a different topic:

Have you find the time to review my 'physical LEDs' code ?
If you are fine with it, I could make a proposal for the remaining converters/keyboards. I would not be able to test the code. I do not have the required hardware to do it.

Cheers

i$k

User avatar
hasu

27 Nov 2014, 02:10

idollar wrote: Is there any other way of doing this ?

Many thanks in advance !
Nice job!
If you are on Windows you will be able to use Alt code to input, but I'm not sure this has advantage to your method.
http://en.wikipedia.org/wiki/Alt_code

I don't think there is an universal method to input special characters over all OS's and you have to use some specific input method to your OS.


@hasu

On a different topic:

Have you find the time to review my 'physical LEDs' code ?
If you are fine with it, I could make a proposal for the remaining converters/keyboards. I would not be able to test the code. I do not have the required hardware to do it.

Cheers

i$k
Thanks for the pull request.
I saw it and was contemplating tmk LED API. I think led.h should be addedled_init() for initialization as you added(and probably other functions for suspend/resume). And I hesitate to add code of LED control to core(under common/), instead I prefer to place the code under project directory(under converter/ps2_usb). I'll fix the API and merge your code some later.

User avatar
idollar
i$

27 Nov 2014, 09:36

hasu wrote:
idollar wrote: Is there any other way of doing this ?

Many thanks in advance !
Nice job!
If you are on Windows you will be able to use Alt code to input, but I'm not sure this has advantage to your method.
http://en.wikipedia.org/wiki/Alt_code

I don't think there is an universal method to input special characters over all OS's and you have to use some specific input method to your OS.
Thank you for your answer.
@hasu

On a different topic:

Have you find the time to review my 'physical LEDs' code ?
If you are fine with it, I could make a proposal for the remaining converters/keyboards. I would not be able to test the code. I do not have the required hardware to do it.

Cheers

i$k
Thanks for the pull request.
I saw it and was contemplating tmk LED API. I think led.h should be addedled_init() for initialization as you added(and probably other functions for suspend/resume). And I hesitate to add code of LED control to core(under common/), instead I prefer to place the code under project directory(under converter/ps2_usb). I'll fix the API and merge your code some later.
I thought that the LED code would also be interesting for other converters/controllers. This is why I added it into under common/. I could imagine that this feature would also be needed by people using something different than a ps2.

I post the ULR just in case that someone else wants to read the proposal.
https://github.com/tmk/tmk_keyboard/pull/141/files

BTW: I have been using the converter with LEDs for more than two weeks now without any problem.

Cheers

i$k

User avatar
hasu

10 Dec 2014, 17:19

USB-USB converter was updated and now supports USB Hub, I confirmed HHKB pro2(which has internal hub) works.
https://github.com/tmk/tmk_keyboard/com ... ed0b7b8ed9

This update is first for two years since initial release :D
http://deskthority.net/workshop-f7/is-r ... tml#p74854

Try it if interested.

JBert

10 Dec 2014, 17:27

Ooh, seems nice.

I've been wondering though if an ARM processor would have enough CPU cycles to just bit-bang the USB protocol for the host side (meant to connect a keyboard of course, no hub)... AVR for sure doesn't.

stormbard

10 Dec 2014, 22:59

If I wanted to add a hub option to my current keyboard what kind of hardware would I need to get, because I don't think the host shield would work for that purpose?

User avatar
hasu

11 Dec 2014, 06:13

JBert wrote: Ooh, seems nice.

I've been wondering though if an ARM processor would have enough CPU cycles to just bit-bang the USB protocol for the host side (meant to connect a keyboard of course, no hub)... AVR for sure doesn't.
I could find this projects which host a low speed device like keybaord with AVR. I don't know if there is similar project with ARM.
https://courses.cit.cornell.edu/ee476/F ... index.html

User avatar
hasu

11 Dec 2014, 06:19

stormbard wrote: If I wanted to add a hub option to my current keyboard what kind of hardware would I need to get, because I don't think the host shield would work for that purpose?
Not sure what you want. You want to install USB hub into your keyboard? If so any hub will work for you.
No relation to my firmware there.

stormbard

11 Dec 2014, 19:11

hasu wrote:
stormbard wrote: If I wanted to add a hub option to my current keyboard what kind of hardware would I need to get, because I don't think the host shield would work for that purpose?
Not sure what you want. You want to install USB hub into your keyboard? If so any hub will work for you.
No relation to my firmware there.
I might be overthinking this, but I wanted to add an extra usb port or two and use the same cable that is connecting the keyboard controller to the computer.

Vizir

05 Jan 2015, 06:08

idollar wrote: I post the ULR just in case that someone else wants to read the proposal.
https://github.com/tmk/tmk_keyboard/pull/141/files

BTW: I have been using the converter with LEDs for more than two weeks now without any problem.

Cheers

i$k
i tried using the binary created after your changes but i don't see any activity on the F5,F6,F7 outputs of my teensy++ 2.0. i am using an ibm model f terminal 122 key and it doesn't have built-in LED's.

User avatar
idollar
i$

05 Jan 2015, 15:44

Vizir wrote: i tried using the binary created after your changes but i don't see any activity on the F5,F6,F7 outputs of my teensy++ 2.0. i am using an ibm model f terminal 122 key and it doesn't have built-in LED's.
Are you using the PS2 to USB convertor or the terminal convertor ?

The code that I posted implements physical LEDs to the PS2 convertor only. I offered porting it to other keyboards but Hasu wanted to change my code before.



BTW: I am currently restoring a Model F 122 (terminal). I plan to port the changes to this convertor also.

Vizir

05 Jan 2015, 16:12

i am using the terminal_usb converter and when i saw the pull request with the changes in the terminal_usb folder i thought you had ported to that too.

User avatar
idollar
i$

05 Jan 2015, 16:47

Vizir wrote: i am using the terminal_usb converter and when i saw the pull request with the changes in the terminal_usb folder i thought you had ported to that too.
This confirms my assumption. Let me read the terminal_usb controller code. You may be lucky and get it done soon :-)

User avatar
idollar
i$

05 Jan 2015, 16:52

idollar wrote:
Vizir wrote: i am using the terminal_usb converter and when i saw the pull request with the changes in the terminal_usb folder i thought you had ported to that too.
This confirms my assumption. Let me read the terminal_usb controller code. You may be lucky and get it done soon :-)
Vizir, I am lying (I could not remember the complete history). I wrote the code for the terminal converter also but I have not tested it. I will check it with my new (old) keyboard. Which is your keyboard model do you have ?

Vizir

05 Jan 2015, 16:59

model f (122 keys)

User avatar
idollar
i$

06 Jan 2015, 22:39

@Vizir

OK. I compiled the code as posted in GIT and you are correct. You are right. It does not work.

There are two typos. One in the Makefile in the config.h file. Actually it caused by the change of name in a "define" that I decided while programming. The associated definitions in the terminal_usb Makefile and the config.h "ifdef" was changed in the ps2_usb converter but not in the terminal_usb converter.

In the Makefile change the entry:

Code: Select all

PHYSICAL_LEDS_ENABLE = yes          # Use to compile with external physical LEDs support
With:

Code: Select all

PHYSICAL_LEDS = yes          # Use to compile with external physical LEDs support
In the file config.h change the entry:

Code: Select all

#ifdef PHYSICAL_LEDS
with

Code: Select all

#ifdef PHYSICAL_LEDS_ENABLE
The above changes make the numberlock key to light the led. Tested.

The capslock did not work on my case as I have an ISO layout. I had to modify the keymap.c also (note that I have changed the commented code from ANSI to ISO:

Instead of:

Code: Select all

static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* 0: default
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.
     * |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|  -|  =|  \|BS | |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|  ;|  '|  #|Retu|               |  4|  5|  6|   |
     * |-----------------------------------------------------------|     ,---.     |---------------|
     * |Shif|  \|  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |     |Up |     |  1|  2|  3|   |
     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
     * |Ctrl|    |Alt |          Space              |Alt |    |Ctrl| |Lef|Dow|Rig| |      0|  .|   |
     * `----'    `---------------------------------------'    `----' `-----------' `---------------'
     */

/*
    KEYMAP(
                     F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
                     F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,

    PSCR,ESC,   GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, JYEN,BSPC,  INS, HOME,PGUP,  NLCK,PSLS,PAST,PMNS,
    SLCK,INT4,  TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,     BSLS,  DEL, END, PGDN,  P7,  P8,  P9,  PPLS,
    PAUS,INT5,  CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     NUHS,ENT,        UP,         P4,  P5,  P6,  PCMM,
    APP, INT6,  LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     RO,  RSFT,  LEFT,INT2,RGHT,  P1,  P2,  P3,  PENT,
    RGUI,LGUI,  LCTL,     LALT,               SPC,                          RALT,     RCTL,       DOWN,       NO,  P0,  PDOT,NO
    ),
*/
    // pseudo ANSI
    KEYMAP(
                     F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
                     F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,

    PSCR,ESC,   ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, NO,  BSPC,  INS, HOME,PGUP,  NLCK,PSLS,PAST,PMNS,
    SLCK,INT4,  TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,     NO,    DEL, END, PGDN,  P7,  P8,  P9,  PPLS,
    PAUS,INT5,  LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     BSLS,ENT,        UP,         P4,  P5,  P6,  PCMM,
    APP, INT6,  LSFT,LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     NO,  RSFT,  LEFT,INT2,RGHT,  P1,  P2,  P3,  PENT,
    RGUI,LGUI,  LCTL,     LALT,               SPC,                          LGUI,     GRV,        DOWN,       NO,  P0,  PDOT,NO
    ),
};
I used:

Code: Select all

static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    /* 0: default
     * ,---.   ,---------------. ,---------------. ,---------------. ,-----------.
     * |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|  -|  =|  \|BS | |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|  ;|  '|  #|Retu|               |  4|  5|  6|   |
     * |-----------------------------------------------------------|     ,---.     |---------------|
     * |Shif|  \|  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|Shift     |     |Up |     |  1|  2|  3|   |
     * |-----------------------------------------------------------| ,-----------. |-----------|Ent|
     * |Ctrl|    |Alt |          Space              |Alt |    |Ctrl| |Lef|Dow|Rig| |      0|  .|   |
     * `----'    `---------------------------------------'    `----' `-----------' `---------------'
     */

    KEYMAP(
                     F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
                     F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,

    PSCR,ESC,   GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, JYEN,BSPC,  INS, HOME,PGUP,  NLCK,PSLS,PAST,PMNS,
    SLCK,INT4,  TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,     BSLS,  DEL, END, PGDN,  P7,  P8,  P9,  PPLS,
    PAUS,INT5,  CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     NUHS,ENT,        UP,         P4,  P5,  P6,  PCMM,
    APP, INT6,  LSFT,NUBS,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     RO,  RSFT,  LEFT,INT2,RGHT,  P1,  P2,  P3,  PENT,
    RGUI,LGUI,  LCTL,     LALT,               SPC,                          RALT,     RCTL,       DOWN,       NO,  P0,  PDOT,NO
    ),
/*
    // pseudo ANSI
    KEYMAP(
                     F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24,
                     F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,

    PSCR,ESC,   ESC, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, NO,  BSPC,  INS, HOME,PGUP,  NLCK,PSLS,PAST,PMNS,
    SLCK,INT4,  TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,     NO,    DEL, END, PGDN,  P7,  P8,  P9,  PPLS,
    PAUS,INT5,  LCTL,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     BSLS,ENT,        UP,         P4,  P5,  P6,  PCMM,
    APP, INT6,  LSFT,LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,     NO,  RSFT,  LEFT,INT2,RGHT,  P1,  P2,  P3,  PENT,
    RGUI,LGUI,  LCTL,     LALT,               SPC,                          LGUI,     GRV,        DOWN,       NO,  P0,  PDOT,NO
    ),
*/
};
Tested.

I have attached my "terminal_usb" directory to ease the understanding of the description above. You can also use these new files instead of the ones in GITHUB. I need to check how to update my code proposal in GITHUB (new challenge :-))
EDIT: I think I managed to update github also

The only thing that is left is to check the "a" key of my keyboard. It seems that is not working fine after the bold-mod ;)

Cheers

i$
Attachments
terminal_usb.tar.gz
(7.52 KiB) Downloaded 316 times
Last edited by idollar on 06 Jan 2015, 23:03, edited 1 time in total.

Post Reply

Return to “Workshop”