Exemple #1
0
void handleSubCmd(struct Key k) {
    uint8_t type=PH_TYPE_ALNUMSYM;
    uint8_t len=12;
    char password[PH_MAX_LEN+1];
    uint8_t ret;

    switch( subcmd )
    {
        case SUB_MACRO:
            setMacroMode(true);
            activateMacro(k.row*ROWS+k.col);
            setCommandMode(false);
            break;
        case SUB_MACRO_REC:
            setMacroRecording(1+k.row*ROWS+k.col);
            setCommandMode(false);
            break;
        case SUB_PASSHASH:
            ret = passHash(password, len, type, "secret", "key", "tag");
            printf("\nPH len=%d type=%d = %s", len, type, password);
            setCommandMode(false);
            break;

        default:
            setCommandMode(false);
            break;
    }
    clearActiveKeys();
    clearRowData();
}
Exemple #2
0
void handleSubCmd(struct Key k) {
    uint8_t h =getKeyCode(k.row, k.col, getActiveLayer());
    switch( subcmd )
    {
        case SUB_READ:
            if(h == HID_ESC) {
                printf("\nSubRead terminated");
                setCommandMode(false);
            } else {
                if(idx>=MAXLEN) {
                    idx=0;
                    setCommandMode(false);
                }
                str[idx++]=h;
                printf("\n%2d %d: ",idx,h);
                for(uint8_t i=0; i<idx; ++i)
                    printf("%02x", str[i]);
            }
            break;
        case SUB_LAYOUT:
        {
            // das nŠchste Layout auf die gedrŸckte Spalte setzen, also 12 verschiedene Layouts verfŸgbar
            /*
            Layout nextLayout = k.col < LAYOUTS ? k.col : eeprom_read_byte (&alternateLayoutNr);
            eeprom_write_byte(&alternateLayoutNr, nextLayout);
            PrintConfiguration();
            */
            printf("\nLAYOUTS not yet implemented");
            setCommandMode(false);
            break;
        }
        case SUB_GEOAREA:
        {
            // den geografischen Bereich auf die gedrŸckte Spalte setzen, DE, GB und US verfŸgbar
            GeoArea nextAlternateGeoArea = k.col < 3 ? k.col : eeprom_read_byte (&alternateGeoArea);
            eeprom_write_byte(&alternateGeoArea, nextAlternateGeoArea);
            PrintConfiguration();
            setCommandMode(false);
            break;
        }
        case SUB_PC_MAC:
        {
            // die Hardware auf die gedrŸckte Spalte setzen, PC/Mac verfŸgbar
            MacOrPC  nextAltMacOrPC = k.col < 2 ? k.col : eeprom_read_byte (&altMacOrPC);
            eeprom_write_byte(&altMacOrPC, nextAltMacOrPC);
            PrintConfiguration();
            setCommandMode(false);
            break;
        }
        case SUB_MACRO:
            setMacroMode(true);
            activateMacro(k.row*ROWS+k.col);
            setCommandMode(false);
            break;
        default:
            break;
    }
    clearActiveKeys();
    clearRowData();
}