π
<-
Chat plein-écran
[^]

Ndless KeyListener

C, C++, ASM...

Re: Ndless KeyListener

Message non lude Vogtinator » 07 Mai 2016, 19:25

Yes, the touchpad code is somewhere else. Do you need that too?
Regarding the error, could you post your current code?
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: Ndless KeyListener

Message non lude MishaShapo » 07 Mai 2016, 19:51

Yes, my teacher's program needs the touchpad as well. If you could get that, it would be swell.

Here is my code. Sorry for not thinking to post it earlier:

Code: Tout sélectionner
#include <os.h>
#include "libndls.h"
#include <nspireio/nspireio.h>
char *cmd = "";
bool quit = false;


void testPushButton(){
    uart_puts("key pressed!\n");
}


void pushButton(){
    if (isKeyPressed(KEY_NSPIRE_TAB))
        cmd = "\t";
    if (isKeyPressed(KEY_NSPIRE_ENTER))
        cmd = "\n";
    if (isKeyPressed(KEY_NSPIRE_DEL))
        cmd = "\b";
    if (isKeyPressed(KEY_NSPIRE_A))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "A" : "a";
    if (isKeyPressed(KEY_NSPIRE_B))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "B" : "b";
    if (isKeyPressed(KEY_NSPIRE_C))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "C" : "c";
    if (isKeyPressed(KEY_NSPIRE_D))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "D" : "d";
    if (isKeyPressed(KEY_NSPIRE_E))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "E" : "e";
    if (isKeyPressed(KEY_NSPIRE_F))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "F" : "f";
    if (isKeyPressed(KEY_NSPIRE_G))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "G" : "g";
    if (isKeyPressed(KEY_NSPIRE_H))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "H" : "h";
    if (isKeyPressed(KEY_NSPIRE_I))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "I" : "i";
    if (isKeyPressed(KEY_NSPIRE_J))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "J" : "j";
    if (isKeyPressed(KEY_NSPIRE_K))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "K" : "k";
    if (isKeyPressed(KEY_NSPIRE_L))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "L" : "l";
    if (isKeyPressed(KEY_NSPIRE_M))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "M" : "m";
    if (isKeyPressed(KEY_NSPIRE_N))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "N" : "n";
    if (isKeyPressed(KEY_NSPIRE_O))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "O" : "o";
    if (isKeyPressed(KEY_NSPIRE_P))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "P" : "p";
    if (isKeyPressed(KEY_NSPIRE_Q))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "Q" : "q";
    if (isKeyPressed(KEY_NSPIRE_R))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "R" : "r";
    if (isKeyPressed(KEY_NSPIRE_S))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "S" : "s";
    if (isKeyPressed(KEY_NSPIRE_T))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "T" : "t";
    if (isKeyPressed(KEY_NSPIRE_U))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "U" : "u";
    if (isKeyPressed(KEY_NSPIRE_V))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "V" : "v";
    if (isKeyPressed(KEY_NSPIRE_W))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "W" : "w";
    if (isKeyPressed(KEY_NSPIRE_X))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "X" : "x";
    if (isKeyPressed(KEY_NSPIRE_Y))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "Y" : "y";
    if (isKeyPressed(KEY_NSPIRE_Z))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "Z" : "z";
    if (isKeyPressed(KEY_NSPIRE_1))
        cmd = "1";
    if (isKeyPressed(KEY_NSPIRE_2))
        cmd = "2";
    if (isKeyPressed(KEY_NSPIRE_3))
        cmd = "3";
    if (isKeyPressed(KEY_NSPIRE_4))
        cmd = "4";
    if (isKeyPressed(KEY_NSPIRE_5))
        cmd = "5";
    if (isKeyPressed(KEY_NSPIRE_6))
        cmd = "6";
    if (isKeyPressed(KEY_NSPIRE_7))
        cmd = "7";
    if (isKeyPressed(KEY_NSPIRE_8))
        cmd = "8";
    if (isKeyPressed(KEY_NSPIRE_9))
        cmd = "9";
    if (isKeyPressed(KEY_NSPIRE_0))
        cmd = "0";
    if (isKeyPressed(KEY_NSPIRE_SPACE))
        cmd = " ";
    if (isKeyPressed(KEY_NSPIRE_PERIOD))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? ":" : ".";
    if (isKeyPressed(KEY_NSPIRE_COLON))
        cmd = ":";
    if (isKeyPressed(KEY_NSPIRE_COMMA)){
                if (isKeyPressed(KEY_NSPIRE_SHIFT))
                        cmd = ";";
                if (isKeyPressed(KEY_NSPIRE_CTRL))
                        cmd = "`";
                else
                        cmd = ",";
        }
    if (isKeyPressed(KEY_NSPIRE_QUESEXCL) || isKeyPressed(KEY_NSPIRE_QUES))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "!" : "?";
    if (isKeyPressed(KEY_NSPIRE_PLUS))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "&" : "+";
    if (isKeyPressed(KEY_NSPIRE_NEGATIVE) || isKeyPressed(KEY_NSPIRE_MINUS)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "_";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "~";
        else
            cmd = "-";
    }
    if (isKeyPressed(KEY_NSPIRE_MULTIPLY))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "#" : "*";
    if (isKeyPressed(KEY_NSPIRE_DIVIDE)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "\\";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "|";
        else
            cmd = "/";
    }
    if (isKeyPressed(KEY_NSPIRE_BAR))
        cmd = "|";
    if (isKeyPressed(KEY_NSPIRE_QUOTE))
        cmd = "\"";
    if (isKeyPressed(KEY_NSPIRE_APOSTROPHE))
        cmd = "'";
    if (isKeyPressed(KEY_NSPIRE_EXP)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "'";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "\"";
        else
            cmd = "^";
    }
    if (isKeyPressed(KEY_NSPIRE_EQU)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = ">";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "<";
        else
            cmd = "= ";
    }
    if (isKeyPressed(KEY_NSPIRE_LTHAN))
        cmd = "<";
    if (isKeyPressed(KEY_NSPIRE_GTHAN))
        cmd = ">";
    if (isKeyPressed(KEY_NSPIRE_LP)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "[";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "{";
        else
            cmd = "(";
    }
    if (isKeyPressed(KEY_NSPIRE_RP)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "]";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "}";
        else
            cmd = ")";
    }
    if (isKeyPressed(KEY_NSPIRE_FLAG)) {
                if (isKeyPressed(KEY_NSPIRE_SHIFT))
                        cmd = "$";
                if (isKeyPressed(KEY_NSPIRE_CTRL))
                        cmd = "@";
        cmd = "%";
    }
    if(isKeyPressed(KEY_NSPIRE_ESC)) cmd = "ESC";
    if(isKeyPressed(KEY_NSPIRE_DEL)) cmd = "DEL";
    if(isKeyPressed(KEY_NSPIRE_ENTER)) cmd = "ENT";
    if(isKeyPressed(KEY_NSPIRE_RET)) cmd = "RET";
    if(isKeyPressed(KEY_NSPIRE_THETA)) cmd = "THETA";
    if(isKeyPressed(KEY_NSPIRE_eEXP)) cmd = "eEXP";
    if(isKeyPressed(KEY_NSPIRE_PI)) cmd = "PI";
    if(isKeyPressed(KEY_NSPIRE_TENX)) cmd = "TENX";
    if(isKeyPressed(KEY_NSPIRE_EE)) cmd = "EE";
    if(isKeyPressed(KEY_NSPIRE_SQU)) cmd = "SQU";
    if(isKeyPressed(KEY_NSPIRE_II)) cmd = "II";
    if(isKeyPressed(KEY_NSPIRE_TAN)) cmd = "TAN";
    if(isKeyPressed(KEY_NSPIRE_COS)) cmd = "COS";
    if(isKeyPressed(KEY_NSPIRE_SIN)) cmd = "SIN";
    if(isKeyPressed(KEY_NSPIRE_EXP)) cmd = "EXP";
    if(isKeyPressed(KEY_NSPIRE_CAT)) cmd = "CAT";
    if(isKeyPressed(KEY_NSPIRE_FRAC)) cmd = "FRAC";
    if(isKeyPressed(KEY_NSPIRE_VAR)) cmd = "VAR";
    if(isKeyPressed(KEY_NSPIRE_DEL)) cmd = "DEL";
    if(isKeyPressed(KEY_NSPIRE_FLAG)){ cmd = "FLAG";quit=true;}
    if(isKeyPressed(KEY_NSPIRE_CLICK)) cmd = "CLICK";
    if(isKeyPressed(KEY_NSPIRE_HOME)) cmd = "HOME";
    if(isKeyPressed(KEY_NSPIRE_MENU)) cmd = "MENU";
    if(isKeyPressed(KEY_NSPIRE_UP)) cmd = "UP";
    if(isKeyPressed(KEY_NSPIRE_UPRIGHT)) cmd = "UPRIGHT";
    if(isKeyPressed(KEY_NSPIRE_RIGHT)) cmd = "RIGHT";
    if(isKeyPressed(KEY_NSPIRE_RIGHTDOWN)) cmd = "RIGHTDOWN";
    if(isKeyPressed(KEY_NSPIRE_DOWN)) cmd = "DOWN";
    if(isKeyPressed(KEY_NSPIRE_DOWNLEFT)) cmd = "DOWNLEFT";
    if(isKeyPressed(KEY_NSPIRE_LEFT)) cmd = "LEFT";
    if(isKeyPressed(KEY_NSPIRE_LEFTUP)) cmd = "LEFTUP";
    if(isKeyPressed(KEY_NSPIRE_SHIFT)) cmd = "SHIFT";
    if(isKeyPressed(KEY_NSPIRE_CTRL)) cmd = "CTRL";
    if(isKeyPressed(KEY_NSPIRE_DOC)) cmd = "DOC";
    if(isKeyPressed(KEY_NSPIRE_TRIG)) cmd = "TRIG";
    if(isKeyPressed(KEY_NSPIRE_SCRATCHPAD)) cmd = "SCRPAD";

    uart_puts(cmd);
    uart_puts("!\n");
}


static const int hook_addrs[] = {0x100B66C8, 0x100B6988,  // Clickpad / Touchpad 3.1
                                 0x100EAAAC, 0x100EADC4,  // CX 3.1
                                 0x100E72CC, 0x100E75E4,  // CM 3.1
                                 0x101122b8, 0x100eb288,  // Clickpad / Touchpad 3.6
                                 0x10111cfc, 0x1011201C, // CX 3.6
                                                                 0x101184C0, 0, // ClickPad / Touchpad 3.9.0
                                 0, 0, // ClickPad / Touchpad 3.9.1
                                 0, 0, // CX 3.9.0
                                                                 0, 0x101184B0, // CX 3.9.1
                                                                 0, 0, // CX 4.0.0
                                                                 0x1011EF68, 0x1011EDB8, // CX 4.0.3
                                                                0x1006A220, 0x10069ce0, // CX 4.2
                                                                };

HOOK_DEFINE(hook_pushButton){
    pushButton();
//    HOOK_RESTORE_RETURN(hook_pushButton);
}

int main(int argc, char* argv[]){

    if(argc < 1) return 0;
    cmd = "URTX";
    uart_puts(cmd);
    uart_puts("!\n");
    HOOK_INSTALL(nl_osvalue((int*)hook_addrs, sizeof(hook_addrs)/sizeof(hook_addrs[0])), hook_pushButton);
//    HOOK_INSTALL(0x1006A220, hook_pushButton);
    nl_set_resident();
    return 0;
}


Avatar de l’utilisateur
MishaShapo
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Prochain niv.: 68%
 
Messages: 17
Inscription: 06 Mai 2016, 04:58
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Ndless KeyListener

Message non lude Vogtinator » 07 Mai 2016, 20:04

For the touchpad you can use 0x1022f824 on CX CAS and 0x1022F2C0 on CX.

You need to use HOOK_RESTORE_RETURN(hook_pushButton); in your HOOK, otherwise it'll crash sooner or later.
Also, why "if(argc < 1) return 0;"? argv[0] is the current program, so argc is always >= 1.
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: Ndless KeyListener

Message non lude MishaShapo » 07 Mai 2016, 20:21

Thanks for the tip on argv[0]. I just saw it in other programs, but didn't know what it does exactly. I didn't use HOOK_RESTORE_RETURN() because it was giving me this error right when I opened the program:

Code: Tout sélectionner
Warning (e59ff018): Prefetch abort: address=e59ff018 status=05

Warning (1039c978): Data abort: address=00000001 status=01 instruction at 1039c978


Also, unfortunately, the new hooks are crashing. When I comment out HOOK_RESTORE_RETURN(), it at least runs but the new hooks throw this error

Code: Tout sélectionner
Warning (fffffb48): Prefetch abort: address=fffffb48 status=05

Error (100cbbb8): Cannot set T bit with MSR instruction


Here is my current code. :

Code: Tout sélectionner
#include <os.h>
#include "libndls.h"
#include <nspireio/nspireio.h>
char *cmd = "";
bool quit = false;


void testPushButton(){
    uart_puts("key pressed!\n");
}


void keyPushButton(){
    if (isKeyPressed(KEY_NSPIRE_TAB))
        cmd = "\t";
    if (isKeyPressed(KEY_NSPIRE_ENTER))
        cmd = "\n";
    if (isKeyPressed(KEY_NSPIRE_DEL))
        cmd = "\b";
    if (isKeyPressed(KEY_NSPIRE_A))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "A" : "a";
    if (isKeyPressed(KEY_NSPIRE_B))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "B" : "b";
    if (isKeyPressed(KEY_NSPIRE_C))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "C" : "c";
    if (isKeyPressed(KEY_NSPIRE_D))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "D" : "d";
    if (isKeyPressed(KEY_NSPIRE_E))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "E" : "e";
    if (isKeyPressed(KEY_NSPIRE_F))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "F" : "f";
    if (isKeyPressed(KEY_NSPIRE_G))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "G" : "g";
    if (isKeyPressed(KEY_NSPIRE_H))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "H" : "h";
    if (isKeyPressed(KEY_NSPIRE_I))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "I" : "i";
    if (isKeyPressed(KEY_NSPIRE_J))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "J" : "j";
    if (isKeyPressed(KEY_NSPIRE_K))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "K" : "k";
    if (isKeyPressed(KEY_NSPIRE_L))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "L" : "l";
    if (isKeyPressed(KEY_NSPIRE_M))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "M" : "m";
    if (isKeyPressed(KEY_NSPIRE_N))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "N" : "n";
    if (isKeyPressed(KEY_NSPIRE_O))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "O" : "o";
    if (isKeyPressed(KEY_NSPIRE_P))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "P" : "p";
    if (isKeyPressed(KEY_NSPIRE_Q))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "Q" : "q";
    if (isKeyPressed(KEY_NSPIRE_R))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "R" : "r";
    if (isKeyPressed(KEY_NSPIRE_S))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "S" : "s";
    if (isKeyPressed(KEY_NSPIRE_T))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "T" : "t";
    if (isKeyPressed(KEY_NSPIRE_U))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "U" : "u";
    if (isKeyPressed(KEY_NSPIRE_V))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "V" : "v";
    if (isKeyPressed(KEY_NSPIRE_W))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "W" : "w";
    if (isKeyPressed(KEY_NSPIRE_X))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "X" : "x";
    if (isKeyPressed(KEY_NSPIRE_Y))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "Y" : "y";
    if (isKeyPressed(KEY_NSPIRE_Z))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "Z" : "z";
    if (isKeyPressed(KEY_NSPIRE_1))
        cmd = "1";
    if (isKeyPressed(KEY_NSPIRE_2))
        cmd = "2";
    if (isKeyPressed(KEY_NSPIRE_3))
        cmd = "3";
    if (isKeyPressed(KEY_NSPIRE_4))
        cmd = "4";
    if (isKeyPressed(KEY_NSPIRE_5))
        cmd = "5";
    if (isKeyPressed(KEY_NSPIRE_6))
        cmd = "6";
    if (isKeyPressed(KEY_NSPIRE_7))
        cmd = "7";
    if (isKeyPressed(KEY_NSPIRE_8))
        cmd = "8";
    if (isKeyPressed(KEY_NSPIRE_9))
        cmd = "9";
    if (isKeyPressed(KEY_NSPIRE_0))
        cmd = "0";
    if (isKeyPressed(KEY_NSPIRE_SPACE))
        cmd = " ";
    if (isKeyPressed(KEY_NSPIRE_PERIOD))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? ":" : ".";
    if (isKeyPressed(KEY_NSPIRE_COLON))
        cmd = ":";
    if (isKeyPressed(KEY_NSPIRE_COMMA)){
                if (isKeyPressed(KEY_NSPIRE_SHIFT))
                        cmd = ";";
                if (isKeyPressed(KEY_NSPIRE_CTRL))
                        cmd = "`";
                else
                        cmd = ",";
        }
    if (isKeyPressed(KEY_NSPIRE_QUESEXCL) || isKeyPressed(KEY_NSPIRE_QUES))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "!" : "?";
    if (isKeyPressed(KEY_NSPIRE_PLUS))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "&" : "+";
    if (isKeyPressed(KEY_NSPIRE_NEGATIVE) || isKeyPressed(KEY_NSPIRE_MINUS)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "_";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "~";
        else
            cmd = "-";
    }
    if (isKeyPressed(KEY_NSPIRE_MULTIPLY))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "#" : "*";
    if (isKeyPressed(KEY_NSPIRE_DIVIDE)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "\\";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "|";
        else
            cmd = "/";
    }
    if (isKeyPressed(KEY_NSPIRE_BAR))
        cmd = "|";
    if (isKeyPressed(KEY_NSPIRE_QUOTE))
        cmd = "\"";
    if (isKeyPressed(KEY_NSPIRE_APOSTROPHE))
        cmd = "'";
    if (isKeyPressed(KEY_NSPIRE_EXP)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "'";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "\"";
        else
            cmd = "^";
    }
    if (isKeyPressed(KEY_NSPIRE_EQU)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = ">";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "<";
        else
            cmd = "= ";
    }
    if (isKeyPressed(KEY_NSPIRE_LTHAN))
        cmd = "<";
    if (isKeyPressed(KEY_NSPIRE_GTHAN))
        cmd = ">";
    if (isKeyPressed(KEY_NSPIRE_LP)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "[";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "{";
        else
            cmd = "(";
    }
    if (isKeyPressed(KEY_NSPIRE_RP)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "]";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "}";
        else
            cmd = ")";
    }
    if (isKeyPressed(KEY_NSPIRE_FLAG)) {
                if (isKeyPressed(KEY_NSPIRE_SHIFT))
                        cmd = "$";
                if (isKeyPressed(KEY_NSPIRE_CTRL))
                        cmd = "@";
        cmd = "%";
    }
    if(isKeyPressed(KEY_NSPIRE_ESC)) cmd = "ESC";
    if(isKeyPressed(KEY_NSPIRE_DEL)) cmd = "DEL";
    if(isKeyPressed(KEY_NSPIRE_ENTER)) cmd = "ENT";
    if(isKeyPressed(KEY_NSPIRE_RET)) cmd = "RET";
    if(isKeyPressed(KEY_NSPIRE_THETA)) cmd = "THETA";
    if(isKeyPressed(KEY_NSPIRE_eEXP)) cmd = "eEXP";
    if(isKeyPressed(KEY_NSPIRE_PI)) cmd = "PI";
    if(isKeyPressed(KEY_NSPIRE_TENX)) cmd = "TENX";
    if(isKeyPressed(KEY_NSPIRE_EE)) cmd = "EE";
    if(isKeyPressed(KEY_NSPIRE_SQU)) cmd = "SQU";
    if(isKeyPressed(KEY_NSPIRE_II)) cmd = "II";
    if(isKeyPressed(KEY_NSPIRE_TAN)) cmd = "TAN";
    if(isKeyPressed(KEY_NSPIRE_COS)) cmd = "COS";
    if(isKeyPressed(KEY_NSPIRE_SIN)) cmd = "SIN";
    if(isKeyPressed(KEY_NSPIRE_EXP)) cmd = "EXP";
    if(isKeyPressed(KEY_NSPIRE_CAT)) cmd = "CAT";
    if(isKeyPressed(KEY_NSPIRE_FRAC)) cmd = "FRAC";
    if(isKeyPressed(KEY_NSPIRE_VAR)) cmd = "VAR";
    if(isKeyPressed(KEY_NSPIRE_DEL)) cmd = "DEL";
    if(isKeyPressed(KEY_NSPIRE_FLAG)){ cmd = "FLAG";quit=true;}
    if(isKeyPressed(KEY_NSPIRE_CLICK)) cmd = "CLICK";
    if(isKeyPressed(KEY_NSPIRE_HOME)) cmd = "HOME";
    if(isKeyPressed(KEY_NSPIRE_MENU)) cmd = "MENU";
    if(isKeyPressed(KEY_NSPIRE_SHIFT)) cmd = "SHIFT";
    if(isKeyPressed(KEY_NSPIRE_CTRL)) cmd = "CTRL";
    if(isKeyPressed(KEY_NSPIRE_DOC)) cmd = "DOC";
    if(isKeyPressed(KEY_NSPIRE_TRIG)) cmd = "TRIG";
    if(isKeyPressed(KEY_NSPIRE_SCRATCHPAD)) cmd = "SCRPAD";

    uart_puts(cmd);
    uart_puts("!\n");
}

void padPushButton(){
    if(isKeyPressed(KEY_NSPIRE_UP)) cmd = "UP";
    if(isKeyPressed(KEY_NSPIRE_UPRIGHT)) cmd = "UPRIGHT";
    if(isKeyPressed(KEY_NSPIRE_RIGHT)) cmd = "RIGHT";
    if(isKeyPressed(KEY_NSPIRE_RIGHTDOWN)) cmd = "RIGHTDOWN";
    if(isKeyPressed(KEY_NSPIRE_DOWN)) cmd = "DOWN";
    if(isKeyPressed(KEY_NSPIRE_DOWNLEFT)) cmd = "DOWNLEFT";
    if(isKeyPressed(KEY_NSPIRE_LEFT)) cmd = "LEFT";
    if(isKeyPressed(KEY_NSPIRE_LEFTUP)) cmd = "LEFTUP";

    uart_puts(cmd);
    uart_puts("!\n");

}


static const int key_hook_addrs[] = {0x100B66C8, 0x100B6988,  // Clickpad / Touchpad 3.1
                                 0x100EAAAC, 0x100EADC4,  // CX 3.1
                                 0x100E72CC, 0x100E75E4,  // CM 3.1
                                 0x101122b8, 0x100eb288,  // Clickpad / Touchpad 3.6
                                 0x10111cfc, 0x1011201C, // CX 3.6
                                                                 0x101184C0, 0, // ClickPad / Touchpad 3.9.0
                                 0, 0, // ClickPad / Touchpad 3.9.1
                                 0, 0, // CX 3.9.0
                                                                 0, 0x101184B0, // CX 3.9.1
                                                                 0, 0, // CX 4.0.0
                                                                 0x1011EF68, 0x1011EDB8, // CX 4.0.3
                                                                0x1006A220, 0x10069ce0, // CX 4.2
                                                                };

static const int pad_hook_addrs[] = {0x100B66C8, 0x100B6988,  // Clickpad / Touchpad 3.1
                                 0x100EAAAC, 0x100EADC4,  // CX 3.1
                                 0x100E72CC, 0x100E75E4,  // CM 3.1
                                 0x101122b8, 0x100eb288,  // Clickpad / Touchpad 3.6
                                 0x10111cfc, 0x1011201C, // CX 3.6
                                                                 0x101184C0, 0, // ClickPad / Touchpad 3.9.0
                                 0, 0, // ClickPad / Touchpad 3.9.1
                                 0, 0, // CX 3.9.0
                                                                 0, 0x101184B0, // CX 3.9.1
                                                                 0, 0, // CX 4.0.0
                                                                 0x1011EF68, 0x1011EDB8, // CX 4.0.3
                                                                0x1022F2C0, 0x1022f824, // CX 4.2
                                                                };

HOOK_DEFINE(hook_keyPushButton){
    keyPushButton();
//    HOOK_RESTORE_RETURN(hook_keyPushButton);
}
HOOK_DEFINE(hook_padPushButton){
    padPushButton();
//    HOOK_RESTORE_RETURN(hook_padPushButton);
}

int main(int argc, char* argv[]){

    cmd = "URTX";
    uart_puts(cmd);
    uart_puts("!\n");
    HOOK_INSTALL(nl_osvalue((int*)pad_hook_addrs, sizeof(pad_hook_addrs)/sizeof(pad_hook_addrs[0])), hook_padPushButton);
    HOOK_INSTALL(nl_osvalue((int*)key_hook_addrs, sizeof(key_hook_addrs)/sizeof(key_hook_addrs[0])), hook_keyPushButton);
    nl_set_resident();
    return 0;
}



Avatar de l’utilisateur
MishaShapo
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Prochain niv.: 68%
 
Messages: 17
Inscription: 06 Mai 2016, 04:58
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Ndless KeyListener

Message non lude Vogtinator » 07 Mai 2016, 22:58

Looks like that was just bad hook placement, directly overwriting the push on a function prologue.
Just increment all addresses I gave you by 16 (0x10) and it should work.
Don't forget the HOOK_RESTORE_RETURN! That it even worked was undefined behaviour.
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: Ndless KeyListener

Message non lude MishaShapo » 07 Mai 2016, 23:43

Hi, Vogtinator, I incremented the addresses and make sure to include HOOK_RESTORE_RETURN. The keys and touchpad both fire off the event handlers, but for some reason, the touchpad events do not propagate to the OS so it acts in a "blocking" behavior. Also, the HOME button for some reason prints the last character sent rather than the string "HOME".

Do you think you could find a way to eliminate the blocking behavior and the Home button bug? Thank you! =)

Here is a link to a video showing the behavior: https://www.youtube.com/watch?v=8bZMTpRWBAY&feature=youtu.be

And here is my code:

Code: Tout sélectionner
#include <os.h>
#include "libndls.h"
#include <nspireio/nspireio.h>
char *cmd = "";
bool quit = false;


void testPushButton(){
    uart_puts("key pressed!\n");
}


void keyPushButton(){
    if (isKeyPressed(KEY_NSPIRE_TAB))
        cmd = "\t";
    if (isKeyPressed(KEY_NSPIRE_ENTER))
        cmd = "\n";
    if (isKeyPressed(KEY_NSPIRE_DEL))
        cmd = "\b";
    if (isKeyPressed(KEY_NSPIRE_A))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "A" : "a";
    if (isKeyPressed(KEY_NSPIRE_B))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "B" : "b";
    if (isKeyPressed(KEY_NSPIRE_C))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "C" : "c";
    if (isKeyPressed(KEY_NSPIRE_D))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "D" : "d";
    if (isKeyPressed(KEY_NSPIRE_E))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "E" : "e";
    if (isKeyPressed(KEY_NSPIRE_F))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "F" : "f";
    if (isKeyPressed(KEY_NSPIRE_G))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "G" : "g";
    if (isKeyPressed(KEY_NSPIRE_H))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "H" : "h";
    if (isKeyPressed(KEY_NSPIRE_I))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "I" : "i";
    if (isKeyPressed(KEY_NSPIRE_J))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "J" : "j";
    if (isKeyPressed(KEY_NSPIRE_K))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "K" : "k";
    if (isKeyPressed(KEY_NSPIRE_L))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "L" : "l";
    if (isKeyPressed(KEY_NSPIRE_M))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "M" : "m";
    if (isKeyPressed(KEY_NSPIRE_N))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "N" : "n";
    if (isKeyPressed(KEY_NSPIRE_O))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "O" : "o";
    if (isKeyPressed(KEY_NSPIRE_P))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "P" : "p";
    if (isKeyPressed(KEY_NSPIRE_Q))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "Q" : "q";
    if (isKeyPressed(KEY_NSPIRE_R))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "R" : "r";
    if (isKeyPressed(KEY_NSPIRE_S))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "S" : "s";
    if (isKeyPressed(KEY_NSPIRE_T))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "T" : "t";
    if (isKeyPressed(KEY_NSPIRE_U))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "U" : "u";
    if (isKeyPressed(KEY_NSPIRE_V))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "V" : "v";
    if (isKeyPressed(KEY_NSPIRE_W))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "W" : "w";
    if (isKeyPressed(KEY_NSPIRE_X))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "X" : "x";
    if (isKeyPressed(KEY_NSPIRE_Y))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "Y" : "y";
    if (isKeyPressed(KEY_NSPIRE_Z))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "Z" : "z";
    if (isKeyPressed(KEY_NSPIRE_1))
        cmd = "1";
    if (isKeyPressed(KEY_NSPIRE_2))
        cmd = "2";
    if (isKeyPressed(KEY_NSPIRE_3))
        cmd = "3";
    if (isKeyPressed(KEY_NSPIRE_4))
        cmd = "4";
    if (isKeyPressed(KEY_NSPIRE_5))
        cmd = "5";
    if (isKeyPressed(KEY_NSPIRE_6))
        cmd = "6";
    if (isKeyPressed(KEY_NSPIRE_7))
        cmd = "7";
    if (isKeyPressed(KEY_NSPIRE_8))
        cmd = "8";
    if (isKeyPressed(KEY_NSPIRE_9))
        cmd = "9";
    if (isKeyPressed(KEY_NSPIRE_0))
        cmd = "0";
    if (isKeyPressed(KEY_NSPIRE_SPACE))
        cmd = " ";
    if (isKeyPressed(KEY_NSPIRE_PERIOD))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? ":" : ".";
    if (isKeyPressed(KEY_NSPIRE_COLON))
        cmd = ":";
    if (isKeyPressed(KEY_NSPIRE_COMMA)){
                if (isKeyPressed(KEY_NSPIRE_SHIFT))
                        cmd = ";";
                if (isKeyPressed(KEY_NSPIRE_CTRL))
                        cmd = "`";
                else
                        cmd = ",";
        }
    if (isKeyPressed(KEY_NSPIRE_QUESEXCL) || isKeyPressed(KEY_NSPIRE_QUES))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "!" : "?";
    if (isKeyPressed(KEY_NSPIRE_PLUS))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "&" : "+";
    if (isKeyPressed(KEY_NSPIRE_NEGATIVE) || isKeyPressed(KEY_NSPIRE_MINUS)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "_";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "~";
        else
            cmd = "-";
    }
    if (isKeyPressed(KEY_NSPIRE_MULTIPLY))
        cmd = isKeyPressed(KEY_NSPIRE_SHIFT) ? "#" : "*";
    if (isKeyPressed(KEY_NSPIRE_DIVIDE)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "\\";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "|";
        else
            cmd = "/";
    }
    if (isKeyPressed(KEY_NSPIRE_BAR))
        cmd = "|";
    if (isKeyPressed(KEY_NSPIRE_QUOTE))
        cmd = "\"";
    if (isKeyPressed(KEY_NSPIRE_APOSTROPHE))
        cmd = "'";
    if (isKeyPressed(KEY_NSPIRE_EXP)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "'";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "\"";
        else
            cmd = "^";
    }
    if (isKeyPressed(KEY_NSPIRE_EQU)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = ">";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "<";
        else
            cmd = "= ";
    }
    if (isKeyPressed(KEY_NSPIRE_LTHAN))
        cmd = "<";
    if (isKeyPressed(KEY_NSPIRE_GTHAN))
        cmd = ">";
    if (isKeyPressed(KEY_NSPIRE_LP)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "[";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "{";
        else
            cmd = "(";
    }
    if (isKeyPressed(KEY_NSPIRE_RP)) {
        if (isKeyPressed(KEY_NSPIRE_SHIFT))
            cmd = "]";
        if (isKeyPressed(KEY_NSPIRE_CTRL))
            cmd = "}";
        else
            cmd = ")";
    }
    if (isKeyPressed(KEY_NSPIRE_FLAG)) {
                if (isKeyPressed(KEY_NSPIRE_SHIFT))
                        cmd = "$";
                if (isKeyPressed(KEY_NSPIRE_CTRL))
                        cmd = "@";
        cmd = "%";
    }
    if(isKeyPressed(KEY_NSPIRE_ESC)) cmd = "ESC";
    if(isKeyPressed(KEY_NSPIRE_DEL)) cmd = "DEL";
    if(isKeyPressed(KEY_NSPIRE_ENTER)) cmd = "ENT";
    if(isKeyPressed(KEY_NSPIRE_RET)) cmd = "RET";
    if(isKeyPressed(KEY_NSPIRE_THETA)) cmd = "THETA";
    if(isKeyPressed(KEY_NSPIRE_eEXP)) cmd = "eEXP";
    if(isKeyPressed(KEY_NSPIRE_PI)) cmd = "PI";
    if(isKeyPressed(KEY_NSPIRE_TENX)) cmd = "TENX";
    if(isKeyPressed(KEY_NSPIRE_EE)) cmd = "EE";
    if(isKeyPressed(KEY_NSPIRE_SQU)) cmd = "SQU";
    if(isKeyPressed(KEY_NSPIRE_II)) cmd = "II";
    if(isKeyPressed(KEY_NSPIRE_TAN)) cmd = "TAN";
    if(isKeyPressed(KEY_NSPIRE_COS)) cmd = "COS";
    if(isKeyPressed(KEY_NSPIRE_SIN)) cmd = "SIN";
    if(isKeyPressed(KEY_NSPIRE_EXP)) cmd = "EXP";
    if(isKeyPressed(KEY_NSPIRE_CAT)) cmd = "CAT";
    if(isKeyPressed(KEY_NSPIRE_FRAC)) cmd = "FRAC";
    if(isKeyPressed(KEY_NSPIRE_VAR)) cmd = "VAR";
    if(isKeyPressed(KEY_NSPIRE_DEL)) cmd = "DEL";
    if(isKeyPressed(KEY_NSPIRE_FLAG)){ cmd = "FLAG";quit=true;}
    if(isKeyPressed(KEY_NSPIRE_CLICK)) cmd = "CLICK";
    if(isKeyPressed(KEY_NSPIRE_HOME)) cmd = "HOME";
    if(isKeyPressed(KEY_NSPIRE_MENU)) cmd = "MENU";
    if(isKeyPressed(KEY_NSPIRE_SHIFT)) cmd = "SHIFT";
    if(isKeyPressed(KEY_NSPIRE_CTRL)) cmd = "CTRL";
    if(isKeyPressed(KEY_NSPIRE_DOC)) cmd = "DOC";
    if(isKeyPressed(KEY_NSPIRE_TRIG)) cmd = "TRIG";
    if(isKeyPressed(KEY_NSPIRE_SCRATCHPAD)) cmd = "SCRPAD";

    uart_puts(cmd);
    uart_puts("!\n");
}

void padPushButton(){
    if(isKeyPressed(KEY_NSPIRE_UP)) cmd = "UP";
    if(isKeyPressed(KEY_NSPIRE_UPRIGHT)) cmd = "UPRIGHT";
    if(isKeyPressed(KEY_NSPIRE_RIGHT)) cmd = "RIGHT";
    if(isKeyPressed(KEY_NSPIRE_RIGHTDOWN)) cmd = "RIGHTDOWN";
    if(isKeyPressed(KEY_NSPIRE_DOWN)) cmd = "DOWN";
    if(isKeyPressed(KEY_NSPIRE_DOWNLEFT)) cmd = "DOWNLEFT";
    if(isKeyPressed(KEY_NSPIRE_LEFT)) cmd = "LEFT";
    if(isKeyPressed(KEY_NSPIRE_LEFTUP)) cmd = "LEFTUP";

    uart_puts(cmd);
    uart_puts("!\n");

}


static const int key_hook_addrs[] = {0x100B66C8, 0x100B6988,  // Clickpad / Touchpad 3.1
                                 0x100EAAAC, 0x100EADC4,  // CX 3.1
                                 0x100E72CC, 0x100E75E4,  // CM 3.1
                                 0x101122b8, 0x100eb288,  // Clickpad / Touchpad 3.6
                                 0x10111cfc, 0x1011201C, // CX 3.6
                                                                 0x101184C0, 0, // ClickPad / Touchpad 3.9.0
                                 0, 0, // ClickPad / Touchpad 3.9.1
                                 0, 0, // CX 3.9.0
                                                                 0, 0x101184B0, // CX 3.9.1
                                                                 0, 0, // CX 4.0.0
                                                                 0x1011EF68, 0x1011EDB8, // CX 4.0.3
                                                                0x1006A230, 0x10069cf0, // CX 4.2
                                                                };

static const int pad_hook_addrs[] = {0x100B66C8, 0x100B6988,  // Clickpad / Touchpad 3.1
                                 0x100EAAAC, 0x100EADC4,  // CX 3.1
                                 0x100E72CC, 0x100E75E4,  // CM 3.1
                                 0x101122b8, 0x100eb288,  // Clickpad / Touchpad 3.6
                                 0x10111cfc, 0x1011201C, // CX 3.6
                                                                 0x101184C0, 0, // ClickPad / Touchpad 3.9.0
                                 0, 0, // ClickPad / Touchpad 3.9.1
                                 0, 0, // CX 3.9.0
                                                                 0, 0x101184B0, // CX 3.9.1
                                                                 0, 0, // CX 4.0.0
                                                                 0x1011EF68, 0x1011EDB8, // CX 4.0.3
                                                                0x1022F2D0, 0x1022f834, // CX 4.2
                                                                };

HOOK_DEFINE(hook_keyPushButton){
    keyPushButton();
    HOOK_RESTORE_RETURN(hook_keyPushButton);
}
HOOK_DEFINE(hook_padPushButton){
    padPushButton();
    HOOK_RESTORE_RETURN(hook_padPushButton);
}

int main(int argc, char* argv[]){

    cmd = "URTX";
    uart_puts(cmd);
    uart_puts("!\n");
    HOOK_INSTALL(nl_osvalue((int*)pad_hook_addrs, sizeof(pad_hook_addrs)/sizeof(pad_hook_addrs[0])), hook_padPushButton);
    HOOK_INSTALL(nl_osvalue((int*)key_hook_addrs, sizeof(key_hook_addrs)/sizeof(key_hook_addrs[0])), hook_keyPushButton);
    nl_set_resident();
    return 0;
}


Avatar de l’utilisateur
MishaShapo
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Prochain niv.: 68%
 
Messages: 17
Inscription: 06 Mai 2016, 04:58
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Ndless KeyListener

Message non lude Vogtinator » 07 Mai 2016, 23:54

There is no HOME key on the CX, there's only the ON key. As none of your isKeyPressed tests apply, cmd remains unmodified.
I'm not sure what's going on with the touchpad, it works fine here on 4.2 CX CAS on firebird.
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: Ndless KeyListener

Message non lude MishaShapo » 07 Mai 2016, 23:58

Is there an isKeyPressed test for the ON Button? The CX has a home picture on it, so I figure it matched with

Code: Tout sélectionner
  if(isKeyPressed(KEY_NSPIRE_HOME)) cmd = "HOME";


Let me try to reinstall a new image on firebird and test on an actual calculator to see if the touchpad behavior is also there.
Avatar de l’utilisateur
MishaShapo
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Prochain niv.: 68%
 
Messages: 17
Inscription: 06 Mai 2016, 04:58
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Ndless KeyListener

Message non lude Vogtinator » 08 Mai 2016, 00:04

Looks like the ON button is actually missing for CX.
In the meanwhile, use a custom
Code: Tout sélectionner
static const t_key KEY_NSPIRE_ON = _KEY(0x10, 0x200);
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile

Re: Ndless KeyListener

Message non lude MishaShapo » 08 Mai 2016, 00:21

Vogtinator, I am going to go all out and just give you a rundown of my project in order to not keep you in the dark anymore.

I am trying to send keypresses from the Nspire through the USB port to an chinese Arduino Micro clone which then uses a wireless module https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo to connect to another Micro+wireless module on the computer which then uses the Arduino Keyboard and Mouse libraries to emulate a keyboard and a mouse. I even got everything to work using the Lua ASI library which is officially supported by TI https://education.ti.com/html/webhelp/EG_TINspireLUA/EN/content/libraries/stem-iolib/asilibrary.htm

The only problem was that the ASI library did not have key listeners for the ON, Doc, and Menu buttons. And more importantly, those Lua programs can't run in the background which makes for a pretty inconvenient user experience.

Anyway, so now you know. I suppose that my next plan of action is to look at the NavNet API. (I mistakenly though that the NspirIO uart meant the USB port, but now I suppose that it means the serial port on the doc connector). Also, the touchpad "blocking" bug is still there on my real-life non-CAS CX . And the cutsom ON key you suggested also works on firebird.
Avatar de l’utilisateur
MishaShapo
Niveau 3: MH (Membre Habitué)
Niveau 3: MH (Membre Habitué)
Prochain niv.: 68%
 
Messages: 17
Inscription: 06 Mai 2016, 04:58
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

PrécédenteSuivante

Retourner vers Native: Ndless, Linux, ...

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 7 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
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 Calculatrices à acheter chez Calcuso
-
Stats.
956 utilisateurs:
>913 invités
>39 membres
>4 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)