π
<-
Chat plein-écran
[^]

Listen to Key Events while in Background

C, C++, ASM...

Listen to Key Events while in Background

Message non lude the_blaggyS » 15 Avr 2019, 17:29

I'm trying to write a C program which listens for key events while running in background and if a specified key is pressed than it should show a message box.

But I have no idea how to listen for key events while using the calculator normally since if you're testing if a key is pressed (isKeyPressed) in a loop the calculator freezes.
I already tried to forward (sending the key event I got with get_event if its actually a key event), but that didn't worked also.
Dernière édition par the_blaggyS le 16 Avr 2019, 00:26, édité 1 fois.
Avatar de l’utilisateur
the_blaggyS
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 75%
 
Messages: 12
Inscription: 11 Avr 2019, 20:26
Genre: Non spécifié
Calculatrice(s):

Re: Listen to Key Events in while in Background

Message non lude nbenm » 15 Avr 2019, 18:13

I use this kind of loop but in the foreground.
It works fine.
I haven't tried the same in the background.
Maybe taking a look at Levak's nCapture can help you.
He waits for a "Ctrl+." to capture screen.
Avatar de l’utilisateur
nbenmVIP++
Niveau 10: GR (Guide de Référence)
Niveau 10: GR (Guide de Référence)
Prochain niv.: 13%
 
Messages: 157
Inscription: 07 Sep 2018, 09:19
Localisation: 92
Genre: Homme
Calculatrice(s):

Re: Listen to Key Events in while in Background

Message non lude Vogtinator » 15 Avr 2019, 19:22

While the program is running, interrupts are disabled so no other tasks run.

Unfortunately this can't be implemented without any OS specific hooks right now.
Avatar de l’utilisateur
VogtinatorPremium
Niveau 8: ER (Espèce Rare: nerd)
Niveau 8: ER (Espèce Rare: nerd)
Prochain niv.: 38.3%
 
Messages: 135
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):

Re: Listen to Key Events in while in Background

Message non lude the_blaggyS » 15 Avr 2019, 22:21

@nebnm I will have a look at it, hopefully it's open source.
@Vogtinator do you know nHide? I thought I could write something similar in aspect of the 'activation'. If you're pressing :nsegp: and :ns2: it's executing.
Avatar de l’utilisateur
the_blaggyS
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 75%
 
Messages: 12
Inscription: 11 Avr 2019, 20:26
Genre: Non spécifié
Calculatrice(s):

Re: Listen to Key Events while in Background

Message non lude the_blaggyS » 16 Avr 2019, 13:23

I found the thread https://tiplanet.org/forum/viewtopic.php?f=20&t=18348&hilit=hooks+tutorial where you're helping another user.
And you said that the OS's key interrupt handler can be found by printing the PC during reads of the keypad.
Maybe you can explain hot to do this? How do I know when it reads the keypad?
Or maybe you can redirect to some manuals or documentation where I can read aboout it.
Also you said it's quite easy therefore it's maybe easier to find it than explaining to me? xD (Just in case: I'm using an TI nSpire CX with OS 3.6)

I'm really interested in this field and probably can adopt some knowledge of nasm and gdb.
I already programmed x86 netwide assembler for unix and also started learning how to use gdb debugger a few years ago.
Avatar de l’utilisateur
the_blaggyS
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 75%
 
Messages: 12
Inscription: 11 Avr 2019, 20:26
Genre: Non spécifié
Calculatrice(s):

Re: Listen to Key Events while in Background

Message non lude Vogtinator » 16 Avr 2019, 18:53

the_blaggyS a écrit:I found the thread https://tiplanet.org/forum/viewtopic.php?f=20&t=18348&hilit=hooks+tutorial where you're helping another user.
And you said that the OS's key interrupt handler can be found by printing the PC during reads of the keypad.
Maybe you can explain hot to do this? How do I know when it reads the keypad?


You'd have to setup firebird with a custom patch to print the PC value when the keypad is accessed, but that's not enough, see below...

Or maybe you can redirect to some manuals or documentation where I can read aboout it.


Unfortunately not, this is a very specific topic. Even to get started here you'll need good knowledge of the ARM architecture and some reverse engineering.

Also you said it's quite easy therefore it's maybe easier to find it than explaining to me? xD (Just in case: I'm using an TI nSpire CX with OS 3.6)


What you're trying to do it actually not as easy the thread you linked. Message boxes can only be opened while running in the GUI task, so the hook would need to be called from the GUI task itself or a second hook has to do that.

I'm really interested in this field and probably can adopt some knowledge of nasm and gdb.
I already programmed x86 netwide assembler for unix and also started learning how to use gdb debugger a few years ago.


Neither x86 nor NASM can help you here - the Nspire uses ARMv5 instructions.
Avatar de l’utilisateur
VogtinatorPremium
Niveau 8: ER (Espèce Rare: nerd)
Niveau 8: ER (Espèce Rare: nerd)
Prochain niv.: 38.3%
 
Messages: 135
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):

Re: Listen to Key Events while in Background

Message non lude the_blaggyS » 16 Avr 2019, 20:20

Okay, first of all thank you for taking the time.

Unfortunately not, this is a very specific topic. Even to get started here you'll need good knowledge of the ARM architecture and some reverse engineering.


Maybe not that easy as I thought. Probably I have to learn about reverse engineering in general first, but that's not too bad since it's a thing I wanted to dig in and I already bought a book about it, maybe I can just combine both topics.

What you're trying to do it actually not as easy the thread you linked. Message boxes can only be opened while running in the GUI task, so the hook would need to be called from the GUI task itself or a second hook has to do that.


Oh I wasn't knowing that a visual element will make such a difference, the message box was just a kind of proof of concept. Actually I just wanted to write my own nHide which won't set the file browser's root to the file systems root, instead it should set it to a custom directory. For example if I open the file browser with nHide it's showing only a sub folder of my documents.

Neither x86 nor NASM can help you here - the Nspire uses ARMv5 instructions.


All I meant was that I know a bit of assembler in general, therefore the beginning should be easier. For a Java programmer it's probably also easier to read C code then it is for a non programmer.
Avatar de l’utilisateur
the_blaggyS
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 75%
 
Messages: 12
Inscription: 11 Avr 2019, 20:26
Genre: Non spécifié
Calculatrice(s):


Retourner vers Native: Ndless, Linux, ...

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 1 invité

-
Rechercher
Campagne de dons
Pour nous aider à financer nos déplacements sur les salons/congrès qui vous donnent du contenu exclusif

Vous aurez droit aux avantages VIP et des goodies !
49%
-
Sujets à la une
Avantages VIP et goodies pour les donateurs !
Offre TI-Planet/Jarrety pour avoir la TI-83 Premium CE avec son chargeur pour 79,79€ port inclus !
Offre TI-Planet/Jarrety pour avoir la TI-Nspire CX CAS à seulement 130€ TTC port inclus!
Jailbreake ta TI-Nspire avec Ndless et profite des meilleurs jeux et applications !
1234
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...

Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety 
-
Stats.
582 utilisateurs:
>540 invités
>37 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)