Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cabcafb
Fix comands format so they work
DexterNano Mar 6, 2025
fa16614
test README.md
DexterNano Mar 10, 2025
513090c
Update README.md
DexterNano Mar 10, 2025
2d93e08
Update logitacker_keyboard_map.c to add ES
DexterNano Mar 13, 2025
aae4c8e
Update logitacker_keyboard_map.h to add ES
DexterNano Mar 13, 2025
a56991d
Update logitacker_keyboard_map.h to add ES (now for real)
DexterNano Mar 13, 2025
3f80f11
Update logitacker_keyboard_map.h fix errors in compiling
DexterNano Mar 14, 2025
e659d50
fix duplicates logitacker_keyboard_map.h
DexterNano Mar 14, 2025
9a7cc6a
Update logitacker_options.c to include ES layout
DexterNano Mar 14, 2025
32c27ce
fix logitacker_keyboard_map.c
DexterNano Mar 14, 2025
6081fdc
fix duplicates or not unique names in logitacker_keyboard_map.h
DexterNano Mar 14, 2025
a8fbb3f
Update logitacker.h to fix compiling error due to duplication
DexterNano Mar 14, 2025
27f74fc
fix logitacker_usb.h duplication errors
DexterNano Mar 14, 2025
7393c14
fix? main.c
DexterNano Mar 14, 2025
c31f717
Update logitacker.h
DexterNano Mar 14, 2025
057f1d5
Update logitacker_usb.h
DexterNano Mar 14, 2025
b611e51
Update main.c
DexterNano Mar 14, 2025
0cb4bbe
Update main.c
DexterNano Mar 14, 2025
8ed1ca0
Update logitacker.h
DexterNano Mar 14, 2025
3c98666
Update logitacker_usb.h
DexterNano Mar 14, 2025
1a3d1ba
Update main.c
DexterNano Mar 14, 2025
d11ef06
Update main.c
DexterNano Mar 14, 2025
a5df99d
Update logitacker.h
DexterNano Mar 14, 2025
b74a19c
Update logitacker.c
DexterNano Mar 14, 2025
42b0cad
Update logitacker.c
DexterNano Mar 14, 2025
d151469
Update main.c
DexterNano Mar 14, 2025
ba45ba8
Update logitacker_cli.c to add ES option
DexterNano Mar 17, 2025
c5ee37d
Revert README.md to original
DexterNano Mar 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions logitacker/logitacker.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ static void main_event_handler_bsp(bsp_event_t ev) {
ev); // call BSP handler function of p_processor and hand in p_processor (self) as first arg
}


#define CLI_NAME_MAX_LEN 64
// Transfers execution to active_enum_process_sub_event
void logitacker_enter_mode_passive_enum(uint8_t *rf_address) {
if (p_processor != NULL && p_processor->p_deinit_func != NULL) (*p_processor->p_deinit_func)(p_processor);
p_processor = new_processor_passive_enum(rf_address);
p_processor->p_init_func(p_processor);

m_state_local.mainstate = LOGITACKER_MODE_PASSIVE_ENUMERATION;
sprintf(g_logitacker_cli_name, "LOGITacker (passive enum) $ ");
snprintf(g_logitacker_cli_name, CLI_NAME_MAX_LEN, "LOGITacker (passive enum) $ ");
}

void logitacker_enter_mode_prx(uint8_t *rf_address) {
Expand All @@ -165,7 +165,7 @@ void logitacker_enter_mode_prx(uint8_t *rf_address) {
p_processor->p_init_func(p_processor);

m_state_local.mainstate = LOGITACKER_MODE_PRX;
sprintf(g_logitacker_cli_name, "LOGITacker (prx) $ ");
snprintf(g_logitacker_cli_name, CLI_NAME_MAX_LEN, "LOGITacker (prx) $ ");
}


Expand All @@ -176,7 +176,7 @@ void logitacker_enter_mode_pair_sniff() {
p_processor->p_init_func(p_processor);

m_state_local.mainstate = LOGITACKER_MODE_SNIFF_PAIRING;
sprintf(g_logitacker_cli_name, "LOGITacker (sniff pairing) $ ");
snprintf(g_logitacker_cli_name, CLI_NAME_MAX_LEN, "LOGITacker (sniff pairing) $ ");
}


Expand All @@ -187,7 +187,7 @@ void logitacker_enter_mode_active_enum(uint8_t *rf_address) {
p_processor->p_init_func(p_processor);

m_state_local.mainstate = LOGITACKER_MODE_ACTIVE_ENUMERATION;
sprintf(g_logitacker_cli_name, "LOGITacker (active enum) $ ");
snprintf(g_logitacker_cli_name, CLI_NAME_MAX_LEN, "LOGITacker (active enum) $ ");
}

void logitacker_enter_mode_covert_channel(uint8_t *rf_address, nrf_cli_t const *p_cli) {
Expand All @@ -197,8 +197,8 @@ void logitacker_enter_mode_covert_channel(uint8_t *rf_address, nrf_cli_t const *
p_processor->p_init_func(p_processor);

m_state_local.mainstate = LOGITACKER_MODE_COVERT_CHANNEL;
//sprintf(g_logitacker_cli_name, "LOGITacker (covert channel) $ ");
sprintf(g_logitacker_cli_name, " "); // empty prompt, use the one from bound shell
//snprintf(g_logitacker_cli_name, "LOGITacker (covert channel) $ ");
snprintf(g_logitacker_cli_name, CLI_NAME_MAX_LEN, " "); // empty prompt, use the one from bound shell
}

static uint8_t temp_dev_id = 1;
Expand Down Expand Up @@ -231,7 +231,7 @@ void logitacker_enter_mode_pair_device(uint8_t const *rf_address) {
p_processor->p_init_func(p_processor);

m_state_local.mainstate = LOGITACKER_MODE_PAIR_DEVICE;
sprintf(g_logitacker_cli_name, "LOGITacker (pair device) $ ");
snprintf(g_logitacker_cli_name, CLI_NAME_MAX_LEN, "LOGITacker (pair device) $ ");

}

Expand All @@ -242,7 +242,7 @@ void logitacker_enter_mode_injection(uint8_t const *rf_address) {
p_processor->p_init_func(p_processor);

m_state_local.mainstate = LOGITACKER_MODE_INJECT;
sprintf(g_logitacker_cli_name, "LOGITacker (injection) $ ");
snprintf(g_logitacker_cli_name, CLI_NAME_MAX_LEN, "LOGITacker (injection) $ ");
}

void logitacker_enter_mode_discovery() {
Expand All @@ -254,7 +254,7 @@ void logitacker_enter_mode_discovery() {
p_processor->p_init_func(p_processor); //call init function

m_state_local.mainstate = LOGITACKER_MODE_DISCOVERY;
sprintf(g_logitacker_cli_name, "LOGITacker (discover) $ ");
snprintf(g_logitacker_cli_name, CLI_NAME_MAX_LEN, "LOGITacker (discover) $ ");

}

Expand Down Expand Up @@ -292,7 +292,7 @@ uint8_t rf_addr_usb[5] = {0};

uint32_t logitacker_init() {
logitacker_options_init_state();
sprintf(g_logitacker_cli_name, "LOGITacker $ ");
snprintf(g_logitacker_cli_name, CLI_NAME_MAX_LEN, "LOGITacker $ ");
logitacker_flash_init();
logitacker_options_restore_from_flash(); // try to restore options from flash (updates stats like boot count)
logitacker_options_store_to_flash(); // store back updated options
Expand Down
5 changes: 2 additions & 3 deletions logitacker/logitacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ typedef enum {
LOGITACKER_MODE_IDLE
} logitacker_mode_t;

char g_logitacker_cli_name[32];

extern char g_logitacker_cli_name[];
uint32_t logitacker_init();

void logitacker_enter_mode_discovery();
Expand Down Expand Up @@ -80,4 +79,4 @@ uint32_t logitacker_covert_channel_push_data(covert_channel_payload_data_t const



#endif
#endif
2 changes: 1 addition & 1 deletion logitacker/logitacker_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ static void cmd_options_inject_lang(nrf_cli_t const *p_cli, size_t argc, char **

return;
} else {
nrf_cli_fprintf(p_cli, NRF_CLI_ERROR, "need language layout name as first argument (f.e. us, de, da, fr)\r\n");
nrf_cli_fprintf(p_cli, NRF_CLI_ERROR, "need language layout name as first argument (f.e. us, de, da, es, fr)\r\n");
return;

}
Expand Down
10 changes: 8 additions & 2 deletions logitacker/logitacker_keyboard_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ uint32_t logitacker_keyboard_map_combo_str_to_hid_report(char const *in_str,
/* maps the given wchar to respective HID report sequence (currently only US,DE layout) */
uint32_t logitacker_keyboard_map_wc_to_hid_reports(hid_keyboard_report_t **p_out_report_seq, uint32_t *out_rep_seq_len,
logitacker_keyboard_map_lang_t in_layout, wchar_t in_rune) {

if (in_layout == LANGUAGE_LAYOUT_US) {
switch (in_rune) {
LAYOUT_US(LAYOUT_SWITCH_CASE)
Expand All @@ -229,6 +228,12 @@ uint32_t logitacker_keyboard_map_wc_to_hid_reports(hid_keyboard_report_t **p_out
default:
return NRF_ERROR_INVALID_PARAM;
}
} else if (in_layout == LANGUAGE_LAYOUT_ES) { //ES case
switch (in_rune) {
LAYOUT_ES(LAYOUT_SWITCH_CASE)
default:
return NRF_ERROR_INVALID_PARAM;
}
} else if (in_layout == LANGUAGE_LAYOUT_DA) {
switch (in_rune) {
LAYOUT_DA(LAYOUT_SWITCH_CASE)
Expand Down Expand Up @@ -320,8 +325,9 @@ logitacker_keyboard_map_lang_t logitacker_keyboard_map_lang_from_str(char * lang
if (strcmp(lang_str, "us") == 0 || strcmp(lang_str, "US") == 0 ) return LANGUAGE_LAYOUT_US;
if (strcmp(lang_str, "da") == 0 || strcmp(lang_str, "DA") == 0 ) return LANGUAGE_LAYOUT_DA;
if (strcmp(lang_str, "fr") == 0 || strcmp(lang_str, "FR") == 0 ) return LANGUAGE_LAYOUT_FR;
if (strcmp(lang_str, "es") == 0 || strcmp(lang_str, "ES") == 0 ) return LANGUAGE_LAYOUT_ES;

lab_default:
NRF_LOG_WARNING("unknown language layout '%s' ... using 'us' as default", nrf_log_push(lang_str));
return LANGUAGE_LAYOUT_US; // default
}
}
17 changes: 17 additions & 0 deletions logitacker/logitacker_keyboard_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,15 @@ DEF_REPORT_SEQUENCE_NAMED(US_RALT_AND_9, DEF_REPORT(HID_MOD_KEY_RI
DEF_REPORT_SEQUENCE_NAMED(US_RALT_AND_0, DEF_REPORT(HID_MOD_KEY_RIGHT_ALT, HID_KEY_0));


// ES-specific sequences (avoiding duplicates and using unique names)
DEF_REPORT_SEQUENCE_NAMED(ES_RALT_1, DEF_REPORT(HID_MOD_KEY_RIGHT_ALT, HID_KEY_1));
DEF_REPORT_SEQUENCE_NAMED(ES_RALT_2, DEF_REPORT(HID_MOD_KEY_RIGHT_ALT, HID_KEY_2));
DEF_REPORT_SEQUENCE_NAMED(ES_INVERTED_QUESTION, DEF_REPORT(HID_MOD_KEY_RIGHT_ALT, HID_KEY_MINUS));
DEF_REPORT_SEQUENCE_NAMED(ES_NTILDE, DEF_REPORT(HID_MOD_KEY_RIGHT_ALT, HID_KEY_SEMICOLON));
DEF_REPORT_SEQUENCE_NAMED(ES_NTILDE_SHIFT, DEF_REPORT(HID_MOD_KEY_RIGHT_ALT | HID_MOD_KEY_LEFT_SHIFT, HID_KEY_SEMICOLON));



#define LAYOUT_US(PROC_FUNC) \
PROC_FUNC(L'\t', HID_REPORT_SEQUENCE_US_TAB) \
PROC_FUNC(L'\n', HID_REPORT_SEQUENCE_US_ENTER) \
Expand Down Expand Up @@ -837,6 +846,13 @@ DEF_REPORT_SEQUENCE_NAMED(US_RALT_AND_0, DEF_REPORT(HID_MOD_KEY_RI
PROC_FUNC(L'€', HID_REPORT_SEQUENCE_RALT_AND_E) \
PROC_FUNC(L'¿', HID_REPORT_SEQUENCE_RALT_AND_M) \

#define LAYOUT_ES(PROC_FUNC) \
PROC_FUNC(L'ñ', HID_REPORT_SEQUENCE_ES_NTILDE) \
PROC_FUNC(L'Ñ', HID_REPORT_SEQUENCE_ES_NTILDE_SHIFT) \
PROC_FUNC(L'¡', HID_REPORT_SEQUENCE_ES_RALT_1) \
PROC_FUNC(L'¿', HID_REPORT_SEQUENCE_ES_INVERTED_QUESTION) \
PROC_FUNC(L'@', HID_REPORT_SEQUENCE_ES_RALT_2) \



#define LAYOUT_SWITCH_CASE(nameval, val) case nameval: {*p_out_report_seq=(void*)val; *out_rep_seq_len=sizeof(val) ;return NRF_SUCCESS; }
Expand All @@ -848,6 +864,7 @@ typedef enum {
LANGUAGE_LAYOUT_US,
LANGUAGE_LAYOUT_DA,
LANGUAGE_LAYOUT_FR,
LANGUAGE_LAYOUT_ES, // Add ES layout
} logitacker_keyboard_map_lang_t;

typedef struct {
Expand Down
3 changes: 3 additions & 0 deletions logitacker/logitacker_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ void logitacker_options_print(nrf_cli_t const * p_cli)
case LANGUAGE_LAYOUT_FR:
injection_lan_str = "fr";
break;
case LANGUAGE_LAYOUT_ES:
injection_lan_str = "es";
break;
}

char * workmode_str = "unknown";
Expand Down
3 changes: 1 addition & 2 deletions logitacker/logitacker_usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ typedef enum {
}


const app_usbd_hid_generic_t m_app_hid_generic;

extern const app_usbd_hid_generic_t m_app_hid_generic;

// User event handler.
//static void usbd_hid_generic_event_handler(app_usbd_class_inst_t const * p_inst, app_usbd_hid_user_event_t event);
Expand Down
8 changes: 7 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ void unifying_event_handler(unifying_evt_t const *p_event) {
NRF_CLI_CDC_ACM_DEF(m_cli_cdc_acm_transport);
NRF_CLI_DEF(m_cli_cdc_acm, g_logitacker_cli_name, &m_cli_cdc_acm_transport.transport, '\r', 20);


#define CLI_NAME_MAX_LEN 64
char g_logitacker_cli_name[CLI_NAME_MAX_LEN] = "logitacker";
//warinings fix
int _close(int fd) { return -1; }
int _lseek(int fd, int ptr, int dir) { return -1; }
int _read(int fd, char *ptr, int len) { return -1; }
int _write(int fd, char *ptr, int len) { return -1; }


int main(void)
Expand Down