Page 1 of 1

keycodes SDL manquants pour nspire CX-II

Unread postPosted: 07 Feb 2021, 18:20
by SlyVTT
Hello again,

c'est la soirée des questions.

Je cherche à avoir un mapping des touches de la CX-II. En utilisant la SDL, via un SDL_event, j'arrive à obtenir un code pour la majorité des touches, mais certaines ne retournent rien (par exemple :nssc: :nsdo: :nsho: :nsbi: :nsfl: ...).

Comment faire pour obtenir le keycode correspondant ? On peut toujours attaquer via le mapping mémoire (explicité ici), mais c'est un peu bancal car les 3/4 fonctionnent avec la SDL, et les "trous" seraient comblés via le mapping mémoire : bref pas très "homogène".

Merci d'avance.

Sly

Re: keycodes SDL manquants pour nspire CX-II

Unread postPosted: 07 Feb 2021, 22:27
by Vogtinator
The best way is probably to somehow implement support for SDLK_UNKNOWN keys in a way that applications can use them properly:

https://github.com/Vogtinator/nSDL/blob ... nts.c#L222

Re: keycodes SDL manquants pour nspire CX-II

Unread postPosted: 20 Mar 2021, 09:02
by SlyVTT
Hi,

As a follow up, I developed a Keyboard handler class for my GUI Toolkit.

I am now able to detect and manage keypressed and keyreleased events as well as status of all individual keys except one single key that seems not to work : the ON/HOME :nsho: key.

As per Hachskpire Wiki, it should be addressed by looking at bit 9 of register 900E0010 but it does not seen to work.
All the other keys are ok.

I developed a small routine that scan all the registers from 900E0010 to 900E001F to check where it can be mapped, but I am not able to find any bit representing that key (of course if works for all the other keys). So I do not understand how this key is working.

the Key handler code is here https://github.com/SlyVTT/Widget-for-TI-NSpire/blob/main/Toolkit/KeyboardTask.cpp, and key ON/HOME code is at line 61. I need to optimise the code, but first would like it to work in a dirty mode :p

It is a bit frustrating to have a handler able to manage all the keys (touchpad arrows and click are managed by the "Mouse" handler not in this scope) except one. It is like falling at kilometre 42 in a marathon !!!

If someone has an idea.

Cheers

Sly

Re: keycodes SDL manquants pour nspire CX-II

Unread postPosted: 21 Mar 2021, 18:48
by Vogtinator
As per Hachskpire Wiki, it should be addressed by looking at bit 9 of register 900E0010 but it does not seen to work.

On the CX and CX II, the bit in the keypad registers doesn't seem to be set anymore and only the bit from a PMU register works. I added some text to the wiki page for that now.

The fix is to use the on_key_pressed() function from libndls instead, which works on all models.

Re: keycodes SDL manquants pour nspire CX-II

Unread postPosted: 21 Mar 2021, 18:56
by SlyVTT
Thanks Vogtinator,
so I am not completely mad ;-) I turned into my code so many times to understand what's was going wrong that I finished to have some doubts ...
Thanks for your feedback.
Sly

Re: keycodes SDL manquants pour nspire CX-II

Unread postPosted: 22 Mar 2021, 09:11
by SlyVTT
Hi Vogtinator,

Works fine while using the on_key_pressed() function of libndls but seems that the any_key_pressed() and isKeyPressed() haven't been updated yet. They just seem to scrutinize the bits of the memory address from 0x900E0010 to 0x900E001E.
This means that is we just look if a key is pressed with any_key_pressed() and just press On/HOME, it won't be detected (I tested this and confirm it does not work)
Same if we have a loop with on_key_pressed() branching to key detection, isKeyPressed( NSP_KEY_HOME ) should not return true cause the memory address does not seem to be mapped for that specific key. (I haven't tested it right now, but reading the libndls code, it should not work).

I will push an issue on Ndless git.

FYI, i used the updated information from the "new" memory mapping of ON/HOME key and it works very well now. Thanks for your very good job.

Ciao

Sly