From 57ebc86a880eaac65b979996d7cebe001b07b7c4 Mon Sep 17 00:00:00 2001 From: _N0x Date: Mon, 7 Feb 2022 02:19:18 +0100 Subject: [PATCH 1/7] fixed readme --- .gitignore | 3 +++ README.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cd531cf..7b2e2e2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +build/ +firmware/ + # ---> C # Prerequisites *.d diff --git a/README.md b/README.md index 8d378f1..8ae5f6b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # f8prog -A simple tool to reprogram the MAX FALCON-8 macropad \ No newline at end of file +A tool to programm the MAX FALCON-8 macropad written in C -- 2.39.5 From 873aaa670b401f91fc03d834bb73bda2c7f6d659 Mon Sep 17 00:00:00 2001 From: _N0x Date: Wed, 9 Feb 2022 00:35:01 +0100 Subject: [PATCH 2/7] Added make file for project and fixed .gitignore --- .gitignore | 5 +++++ Makefile | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 7b2e2e2..6f1695e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,10 @@ +# exclude project binary +f8prog + +# exclude project dirs build/ firmware/ +.ccls-cache/ # ---> C # Prerequisites diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a64b886 --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +## Compiler settings +CC = cc +CFLAGS = -Wall +LDFLAGS = + +## Project settings +TARGET = f8prog ## name of the application + +## Paths +SRC = $(wildcard src/*.c) +OFILES = $(patsubst src%, build%, $(patsubst src/%.c, build/%.o, $(SRC))) + + +$(TARGET): ./build $(OFILES) + $(CC) $(CFLAGS) $(OFILES) -o $(TARGET) $(LDFLAGS) + +%.o: ../src/%.c + $(CC) $(CFLAGS) -c $^ -o $@ + +./build: + mkdir -p $@ + +clean: + rm -rf $(OFILES) + rm -f $(TARGET) + rm -rf ./build + +test: $(TARGET) + ./$(TARGET) + +options: + @echo $(TARGET) build options: + @echo "CFLAGS = ${CFLAGS}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "CC = ${CC}" + +.PHONY: options clean test -- 2.39.5 From c161f29aa145c1414258b00074ea0fb50d293bf2 Mon Sep 17 00:00:00 2001 From: _N0x Date: Wed, 9 Feb 2022 05:10:15 +0100 Subject: [PATCH 3/7] First test to read and edit the firmware, added defines for the required offsets etc --- firmware.bin | Bin 0 -> 32768 bytes include/change_key.h | 32 +++++++++++++++++++++++ include/firmware_handling.h | 11 ++++++++ src/change_key.c | 10 ++++++++ src/firmware_handling.c | 49 ++++++++++++++++++++++++++++++++++++ src/main.c | 27 ++++++++++++++++++++ 6 files changed, 129 insertions(+) create mode 100644 firmware.bin create mode 100644 include/change_key.h create mode 100644 include/firmware_handling.h create mode 100644 src/change_key.c create mode 100644 src/firmware_handling.c create mode 100644 src/main.c diff --git a/firmware.bin b/firmware.bin new file mode 100644 index 0000000000000000000000000000000000000000..3e478deb202031cb1feb665f245103022cdfc54b GIT binary patch literal 32768 zcmeHwd3Y36*7vRMPEuJQov;N6p%MaiARwTOC@4h|nyNq`ASx(mv#3E?!YEGIq*>HP z83~FGD$a{K<1phI6g6s002jbfyTuI4TaV$2wv-bNtr@EWy%sb!nJ&%8U?|f;V zbMM*ixoe%eTZQeiaDF8T@g1NZa2#*~@IBzviSQ4i-R}qRP6Ft68u3{`@c(g`?G~c< zMM8|f_@B#K+vT5mRG*ti3o!=J1yDZQ6cFZ^ z&~v8}JHL7?Rdg|>)QsBZUWKM)&lq2Hvk>zDNkz_(G@+}R8YkBRyCyf0;|UA1;{2dT zEzFV-HU{Qp+5Phfzot2`x!~J_<>QfWKanf?ivi9{T(uRun?IYH;Hn+ETdPg>l#lPb zt8a~Sm$SxU?rctThl9beFo(AY^R|%v#c=Rc*#5dOSA>L+H8H-e{-6KZHHU61c1)mr z`lHU<2Q4trB z*`OQ6w+P`}FA3)$#E$~D0m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Jk3Tnv(#~AEcIB@(&Jhdln09NI ze%+=H=)Qj3N`Ws_ldG=?-gI+n3jIjZ4QAy8HmPG zh4-Hr$9IW_m&A#e#oyl(-+wLsaa{b+Ak1~r$-AXf_erO>NN2KbXZzWH%(Vsk+d>0u zjpx~#2HO7UC>2jSCW}8g62uNip7^ulQt=nZAn}ys5Kl{S;u$GkJS(M$=cF|8yp%4g zq%LBoG(o%|O%g9k-NY`byLd_JAzqd;#4C6=19r@t7PZ zh&ovoyX8c&M@|xZ z@?`OWJXQGRDIy>zNFU0VN(bdq=_7fv^s!uO`$V2hBN~Gl!x=xj13y`oI_~9O#_3MZ` z+JRc&fB85Nf*vdfUJ}2|?|*xHbd=wEtUKDF5C49dr{bKIj&|)BU)%!!%ikN(aeQuM z|1wzAZb#hloct#|C%?>7an4G|bJ6i!{3kpY(Q$lkWdAZ))NV)I@tpi8JSV@*Q*q8p z$8*u~T>K|I7twKiZe;&5Sk!Ju-0__JCp;&wFW~2b?nwv_zz>@4Ok^equ?@6iD*i_w z{PzsD5%wp-hi(4wFY_4ve`SUK53G(~M+H-nWD&j0`b literal 0 HcmV?d00001 diff --git a/include/change_key.h b/include/change_key.h new file mode 100644 index 0000000..d39ed56 --- /dev/null +++ b/include/change_key.h @@ -0,0 +1,32 @@ +/* changeKey.h */ + +/* Define for key offsets */ +#define KEY1 0x00005149 +#define KEY2 0x00005179 +#define KEY3 0x00005181 +#define KEY4 0x00005189 +#define KEY5 0x00005190 +#define KEY6 0x00005182 +#define KEY7 0x0000517a +#define KEY8 0x0000514a + +/* Define for prog1-8 offset */ +#define PROG1_OFFSET 0x0000539C +#define PROG2_OFFSET 0x000056BC +#define PROG3_OFFSET 0x000059DC +#define PROG4_OFFSET 0x00005CFC +#define PROG5_OFFSET 0x0000601C +#define PROG6_OFFSET 0x0000633C +#define PROG7_OFFSET 0x0000665C +#define PROG8_OFFSET 0x0006977C + +typedef struct key_prog key_prog; +struct key_prog +{ + int offset; + int key_settings[100][8]; +}; + + +void set_key_value(char* firmware_buffer, int key, int value); + diff --git a/include/firmware_handling.h b/include/firmware_handling.h new file mode 100644 index 0000000..07eeb91 --- /dev/null +++ b/include/firmware_handling.h @@ -0,0 +1,11 @@ +typedef struct fbuffer_t fbuffer_t; +struct fbuffer_t +{ + char* buffer; + int size; +}; + +/* reads in the firmware file into a buffer */ +fbuffer_t* get_firmware_buffer(char* filename); +void write_firmware_buffer(char* filename, fbuffer_t* p_fb); + diff --git a/src/change_key.c b/src/change_key.c new file mode 100644 index 0000000..9166d04 --- /dev/null +++ b/src/change_key.c @@ -0,0 +1,10 @@ +#include +#include +#include +#include + +#include "../include/change_key.h" + +void set_key_value(char* firmware_buffer, int key, int value) { + memset(firmware_buffer + key, value, 1); +} diff --git a/src/firmware_handling.c b/src/firmware_handling.c new file mode 100644 index 0000000..2447fa1 --- /dev/null +++ b/src/firmware_handling.c @@ -0,0 +1,49 @@ +#include +#include +#include +#include +#include + +#include "../include/firmware_handling.h" + +fbuffer_t* get_firmware_buffer(char* filename) { + + fbuffer_t buffer; + fbuffer_t* p_fb = &buffer; + + FILE *firmware = fopen(filename, "rb"); + if(!firmware) { + perror("Error while reading in Firmware File.\r\nExiting."); + exit(EXIT_FAILURE); + } + + struct stat sb; + if(stat(filename, &sb) == -1) { + perror("Error while reading Firmware metadata.\r\nExiting."); + exit(EXIT_FAILURE); + } + + p_fb->size = sb.st_size; + p_fb->buffer = malloc(p_fb->size); + fread(p_fb->buffer, p_fb->size, 1, firmware); + + /* for testing if the buffer could be read correclty */ + // printf("buffer size: %d", p_fb->size); + + fclose(firmware); + + return p_fb; +} + +void write_firmware_buffer(char* filename, fbuffer_t* p_fb) { + + FILE *firmware_file = fopen(filename, "wb+"); + if(!firmware_file) { + perror("Error while opening in Firmware File.\r\nExiting."); + exit(EXIT_FAILURE); + } + + fwrite(p_fb->buffer, p_fb->size, 1, firmware_file); + + fclose(firmware_file); +} diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..e5ba17b --- /dev/null +++ b/src/main.c @@ -0,0 +1,27 @@ +#include +#include +#include + +#include "../include/change_key.h" +#include "../include/firmware_handling.h" + +int main (int argc, char *argv[]) +{ + fbuffer_t* p_fb = get_firmware_buffer(argv[1]); + + set_key_value(p_fb->buffer, KEY8, 0x1E); + + /* for debugging -> print content of buffer to terminal */ + /* + for(int i = 0; isize; i++){ + putc(isprint(fb->buffer[i]) ? fb->buffer[i] : '.', stdout); + } + */ + + char str[50]; + + sprintf(str, "new_%s", argv[1]); + + write_firmware_buffer(str, p_fb); + return 0; +} -- 2.39.5 From 67ce593eea40d8f3f4393b1aef272c9a56c6278e Mon Sep 17 00:00:00 2001 From: _N0x Date: Wed, 9 Feb 2022 05:32:13 +0100 Subject: [PATCH 4/7] Added header file for keycodes --- include/change_key.h | 16 +-- include/keycodes.h | 233 +++++++++++++++++++++++++++++++++++++++++++ src/main.c | 7 +- 3 files changed, 245 insertions(+), 11 deletions(-) create mode 100644 include/keycodes.h diff --git a/include/change_key.h b/include/change_key.h index d39ed56..cdc2083 100644 --- a/include/change_key.h +++ b/include/change_key.h @@ -1,14 +1,14 @@ /* changeKey.h */ /* Define for key offsets */ -#define KEY1 0x00005149 -#define KEY2 0x00005179 -#define KEY3 0x00005181 -#define KEY4 0x00005189 -#define KEY5 0x00005190 -#define KEY6 0x00005182 -#define KEY7 0x0000517a -#define KEY8 0x0000514a +#define F8_KEY1 0x00005149 +#define F8_KEY2 0x00005179 +#define F8_KEY3 0x00005181 +#define F8_KEY4 0x00005189 +#define F8_KEY5 0x00005190 +#define F8_KEY6 0x00005182 +#define F8_KEY7 0x0000517a +#define F8_KEY8 0x0000514a /* Define for prog1-8 offset */ #define PROG1_OFFSET 0x0000539C diff --git a/include/keycodes.h b/include/keycodes.h new file mode 100644 index 0000000..0bf10f6 --- /dev/null +++ b/include/keycodes.h @@ -0,0 +1,233 @@ +/* keycodes taken from https://usb.org/sites/default/files/hut1_22.pdf + * See also: https://github.com/benblazak/ergodox-firmware/blob/master/src/lib/usb/usage-page/keyboard.h + * */ + +#define KEY_ErrorRollOver 0x01 +#define KEY_POSTFail 0x02 +#define KEY_ErrorUndefined 0x03 +#define KEY_a_A 0x04 +#define KEY_b_B 0x05 +#define KEY_c_C 0x06 +#define KEY_d_D 0x07 +#define KEY_e_E 0x08 +#define KEY_f_F 0x09 +#define KEY_g_G 0x0A +#define KEY_h_H 0x0B +#define KEY_i_I 0x0C +#define KEY_j_J 0x0D +#define KEY_k_K 0x0E +#define KEY_l_L 0x0F +#define KEY_m_M 0x10 +#define KEY_n_N 0x11 +#define KEY_o_O 0x12 +#define KEY_p_P 0x13 +#define KEY_q_Q 0x14 +#define KEY_r_R 0x15 +#define KEY_s_S 0x16 +#define KEY_t_T 0x17 +#define KEY_u_U 0x18 +#define KEY_v_V 0x19 +#define KEY_w_W 0x1A +#define KEY_x_X 0x1B +#define KEY_y_Y 0x1C +#define KEY_z_Z 0x1D +#define KEY_1_Exclamation 0x1E +#define KEY_2_At 0x1F +#define KEY_3_Pound 0x20 +#define KEY_4_Dollar 0x21 +#define KEY_5_Percent 0x22 +#define KEY_6_Caret 0x23 +#define KEY_7_Ampersand 0x24 +#define KEY_8_Asterisk 0x25 +#define KEY_9_LeftParenthesis 0x26 +#define KEY_0_RightParenthesis 0x27 +#define KEY_ReturnEnter 0x28 +#define KEY_Escape 0x29 +#define KEY_DeleteBackspace 0x2A +#define KEY_Tab 0x2B +#define KEY_Spacebar 0x2C +#define KEY_Dash_Underscore 0x2D +#define KEY_Equal_Plus 0x2E +#define KEY_LeftBracket_LeftBrace 0x2F +#define KEY_RightBracket_RightBrace 0x30 +#define KEY_Backslash_Pipe 0x31 +#define KEY_NonUS_Pound_Tilde 0x32 +#define KEY_Semicolon_Colon 0x33 +#define KEY_SingleQuote_DoubleQuote 0x34 +#define KEY_GraveAccent_Tilde 0x35 +#define KEY_Comma_LessThan 0x36 +#define KEY_Period_GreaterThan 0x37 +#define KEY_Slash_Question 0x38 +#define KEY_CapsLock 0x39 +#define KEY_F1 0x3A +#define KEY_F2 0x3B +#define KEY_F3 0x3C +#define KEY_F4 0x3D +#define KEY_F5 0x3E +#define KEY_F6 0x3F +#define KEY_F7 0x40 +#define KEY_F8 0x41 +#define KEY_F9 0x42 +#define KEY_F10 0x43 +#define KEY_F11 0x44 +#define KEY_F12 0x45 +#define KEY_PrintScreen 0x46 +#define KEY_ScrollLock 0x47 +#define KEY_Pause 0x48 +#define KEY_Insert 0x49 +#define KEY_Home 0x4A +#define KEY_PageUp 0x4B +#define KEY_DeleteForward 0x4C +#define KEY_End 0x4D +#define KEY_PageDown 0x4E +#define KEY_RightArrow 0x4F +#define KEY_LeftArrow 0x50 +#define KEY_DownArrow 0x51 +#define KEY_UpArrow 0x52 + +#define KEYPAD_NumLock_Clear 0x53 +#define KEYPAD_Slash 0x54 +#define KEYPAD_Asterisk 0x55 +#define KEYPAD_Minus 0x56 +#define KEYPAD_Plus 0x57 +#define KEYPAD_ENTER 0x58 +#define KEYPAD_1_End 0x59 +#define KEYPAD_2_DownArrow 0x5A +#define KEYPAD_3_PageDown 0x5B +#define KEYPAD_4_LeftArrow 0x5C +#define KEYPAD_5 0x5D +#define KEYPAD_6_RightArrow 0x5E +#define KEYPAD_7_Home 0x5F +#define KEYPAD_8_UpArrow 0x60 +#define KEYPAD_9_PageUp 0x61 +#define KEYPAD_0_Insert 0x62 +#define KEYPAD_Period_Delete 0x63 + +#define KEY_NonUS_Backslash_Pipe 0x64 +#define KEY_Application 0x65 +#define KEY_Power 0x66 + +#define KEYPAD_Equal 0x67 + +#define KEY_F13 0x68 +#define KEY_F14 0x69 +#define KEY_F15 0x6A +#define KEY_F16 0x6B +#define KEY_F17 0x6C +#define KEY_F18 0x6D +#define KEY_F19 0x6E +#define KEY_F20 0x6F +#define KEY_F21 0x70 +#define KEY_F22 0x71 +#define KEY_F23 0x72 +#define KEY_F24 0x73 +#define KEY_Execute 0x74 +#define KEY_Help 0x75 +#define KEY_Menu 0x76 +#define KEY_Select 0x77 +#define KEY_Stop 0x78 +#define KEY_Again 0x79 +#define KEY_Undo 0x7A +#define KEY_Cut 0x7B +#define KEY_Copy 0x7C +#define KEY_Paste 0x7D +#define KEY_Find 0x7E +#define KEY_Mute 0x7F +#define KEY_VolumeUp 0x80 +#define KEY_VolumeDown 0x81 +#define KEY_LockingCapsLock 0x82 +#define KEY_LockingNumLock 0x83 +#define KEY_LockingScrollLock 0x84 + +#define KEYPAD_Comma 0x85 +#define KEYPAD_EqualSign 0x86 + +#define KEY_International1 0x87 +#define KEY_International2 0x88 +#define KEY_International3 0x89 +#define KEY_International4 0x8A +#define KEY_International5 0x8B +#define KEY_International6 0x8C +#define KEY_International7 0x8D +#define KEY_International8 0x8E +#define KEY_International9 0x8F +#define KEY_LANG1 0x90 +#define KEY_LANG2 0x91 +#define KEY_LANG3 0x92 +#define KEY_LANG4 0x93 +#define KEY_LANG5 0x94 +#define KEY_LANG6 0x95 +#define KEY_LANG7 0x96 +#define KEY_LANG8 0x97 +#define KEY_LANG9 0x98 +#define KEY_AlternateErase 0x99 +#define KEY_SysReq_Attention 0x9A +#define KEY_Cancel 0x9B +#define KEY_Clear 0x9C +#define KEY_Prior 0x9D +#define KEY_Return 0x9E +#define KEY_Separator 0x9F +#define KEY_Out 0xA0 +#define KEY_Oper 0xA1 +#define KEY_Clear_Again 0xA2 +#define KEY_CrSel_Props 0xA3 +#define KEY_ExSel 0xA4 +// (Reserved) 0xA5..0xAF +#define KEYPAD_00 0xB0 +#define KEYPAD_000 0xB1 + +#define KEY_ThousandsSeparator 0xB2 +#define KEY_DecimalSeparator 0xB3 +#define KEY_CurrencyUnit 0xB4 +#define KEY_CurrencySubunit 0xB5 + +#define KEYPAD_LeftParenthesis 0xB6 +#define KEYPAD_RightParenthesis 0xB7 +#define KEYPAD_LeftBrace 0xB8 +#define KEYPAD_RightBrace 0xB9 + +#define KEYPAD_Tab 0xBA +#define KEYPAD_Backspace 0xBB +#define KEYPAD_A 0xBC +#define KEYPAD_B 0xBD +#define KEYPAD_C 0xBE +#define KEYPAD_D 0xBF +#define KEYPAD_E 0xC0 +#define KEYPAD_F 0xC1 +#define KEYPAD_XOR 0xC2 +#define KEYPAD_Caret 0xC3 +#define KEYPAD_Percent 0xC4 +#define KEYPAD_LessThan 0xC5 +#define KEYPAD_GreaterThan 0xC6 +#define KEYPAD_Ampersand 0xC7 +#define KEYPAD_AmpersandAmpersand 0xC8 +#define KEYPAD_Pipe 0xC9 +#define KEYPAD_PipePipe 0xCA +#define KEYPAD_Colon 0xCB +#define KEYPAD_Pound 0xCC +#define KEYPAD_Space 0xCD +#define KEYPAD_At 0xCE +#define KEYPAD_Exclamation 0xCF +#define KEYPAD_MemoryStore 0xD0 +#define KEYPAD_MemoryRecall 0xD1 +#define KEYPAD_MemoryClear 0xD2 +#define KEYPAD_MemoryAdd 0xD3 +#define KEYPAD_MemorySubtract 0xD4 +#define KEYPAD_MemoryMultiply 0xD5 +#define KEYPAD_MemoryDivide 0xD6 +#define KEYPAD_PlusMinus 0xD7 +#define KEYPAD_Clear 0xD8 +#define KEYPAD_ClearEntry 0xD9 +#define KEYPAD_Binary 0xDA +#define KEYPAD_Octal 0xDB +#define KEYPAD_Decimal 0xDC +#define KEYPAD_Hexadecimal 0xDD +// (Reserved) 0xDE..0xDF +#define KEY_LeftControl 0xE0 +#define KEY_LeftShift 0xE1 +#define KEY_LeftAlt 0xE2 +#define KEY_LeftGUI 0xE3 +#define KEY_RightControl 0xE4 +#define KEY_RightShift 0xE5 +#define KEY_RightAlt 0xE6 +#define KEY_RightGUI 0xE7 diff --git a/src/main.c b/src/main.c index e5ba17b..a8ed322 100644 --- a/src/main.c +++ b/src/main.c @@ -4,12 +4,13 @@ #include "../include/change_key.h" #include "../include/firmware_handling.h" +#include "../include/keycodes.h" int main (int argc, char *argv[]) { fbuffer_t* p_fb = get_firmware_buffer(argv[1]); - set_key_value(p_fb->buffer, KEY8, 0x1E); + set_key_value(p_fb->buffer, F8_KEY8, KEY_a_A); /* for debugging -> print content of buffer to terminal */ /* @@ -17,9 +18,9 @@ int main (int argc, char *argv[]) putc(isprint(fb->buffer[i]) ? fb->buffer[i] : '.', stdout); } */ - + + /* Temporary solution to renaming the input file */ char str[50]; - sprintf(str, "new_%s", argv[1]); write_firmware_buffer(str, p_fb); -- 2.39.5 From a228cc519f26b0e33aa2a1b470ee56153952086f Mon Sep 17 00:00:00 2001 From: _N0x Date: Wed, 9 Feb 2022 17:24:53 +0100 Subject: [PATCH 5/7] Added original Firmware file --- MAX_Falcon-8_V2.1_Firmware.bin | Bin 0 -> 27856 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 MAX_Falcon-8_V2.1_Firmware.bin diff --git a/MAX_Falcon-8_V2.1_Firmware.bin b/MAX_Falcon-8_V2.1_Firmware.bin new file mode 100644 index 0000000000000000000000000000000000000000..cbb232f66d82d6e0d0949c145ab862f956e47f1e GIT binary patch literal 27856 zcmeHwd3+RAw*ReOlF9<9ge^c5Dht?wfPgZhpcF~yR0RS7qk@7qiyD+AjN*h%nni7t zk)Y_H;yheNnQ;w@8Z{<>3*e~TqK<%QxlJIr6r0`Iy5INQs&1pRynp78-+Mp8=iGa? zd+u7N?pDn-6^{cqah#cM9u3uJKEAc(NHMLj1le3xFu|VF&a7=Bka=g4+?Wxt#&KJ2B|cnQ>iYIJ1vwVA%^H6|&RkPMOQHr_2=q ztYMy}%}+;fw+04eUst-xdmT^hl0^Dc5vQ5FzNrmzJh`CmVuLUb<;+a4t$CP$(c|4HL9|R?hZpwKRPeYw&2=JkuV_ z9&e=_SGwu?B5ilrC#8Fmkegjd2nhLNz?PpEu;(uh4$v>wE{5)W{Q@ls_I{QpLoNkV z^pV;~$W!$5wDS-rA|8$y{hxg<@;ECeixV<&+nW;5u04@~6PQD7+?`TMVb5XN zHrN{*wj1Y!_u?tsi~5NkRvmSx1t*_w9TpAMMQ!qK&b3#w96QgU7xdG@_0XSI`x-*Q zofxP?Y;)TKFC(_Q3xcsyFGkL0sps=DP+70%Ji=xJGfOiQ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es.md added with notes about offsets etc that might be handy later --- Notes.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Notes.md diff --git a/Notes.md b/Notes.md new file mode 100644 index 0000000..6b1e1c4 --- /dev/null +++ b/Notes.md @@ -0,0 +1,45 @@ +# Notes regarding firmware analyzing + +# Memory informatio +Most of these values have been determined from changing the firmware and looking at it with a hex-editor. All values still need to be tested and confirmed. + +## Key Offsets + +- 0x00005189 -> Key 1 +- 0x00005181 -> Key 2 +- 0x00005179 -> Key 3 +- 0x00005149 -> Key 4 +- 0x00005190 -> Key 5 +- 0x00005182 -> Key 6 +- 0x0000517A -> Key 7 +- 0x0000514A -> Key 8 + +## Program "Key"-Codes + +Set a key to this value to activate the corresponding program. + +- 0xD7 Prog1 +- 0xD8 Prog2 +- 0xD9 Prog3 +- 0xDA Prog4 +- 0xDB Prog5 +- 0xDC Prog6 +- 0xDD Prog7 +- 0xDE Prog8 + +## Program Offsets + +- 0x0000539C -> Prog1 +- 0x000056BC -> Prog2 +- 0x000059DC -> Prog3 +- 0x00005CFC -> Prog4 +- 0x0000601C -> Prog5 +- 0x0000633C -> Prog6 +- 0x0000665C -> Prog7 +- 0x0000697C -> Prog8 + +# Sources and help: +https://blog.mateusz.perlak.com/index.php/2016/12/05/max-falcon-8-keyboard-hacking/ +https://github.com/benblazak/ergodox-firmware/blob/master/src/lib/usb/usage-page/keyboard.h + + -- 2.39.5 From 4d6c9655b7dbb9355cb3a7fdf60d2b4418a074d5 Mon Sep 17 00:00:00 2001 From: _N0x Date: Fri, 11 Feb 2022 00:19:20 +0100 Subject: [PATCH 7/7] Added basic implementation of writing a macro program to the firmware --- Makefile | 2 +- firmware.bin | Bin 32768 -> 0 bytes include/change_key.h | 32 -------------- include/firmware_handling.h | 86 +++++++++++++++++++++++++++++++++--- src/change_key.c | 10 ----- src/firmware_handling.c | 42 +++++++++++++++--- src/main.c | 77 +++++++++++++++++++++++++++----- 7 files changed, 184 insertions(+), 65 deletions(-) delete mode 100644 firmware.bin delete mode 100644 include/change_key.h delete mode 100644 src/change_key.c diff --git a/Makefile b/Makefile index a64b886..4b76162 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ## Compiler settings CC = cc -CFLAGS = -Wall +CFLAGS = -Wall -Werror -g -std=c99 LDFLAGS = ## Project settings diff --git a/firmware.bin b/firmware.bin deleted file mode 100644 index 3e478deb202031cb1feb665f245103022cdfc54b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeHwd3Y36*7vRMPEuJQov;N6p%MaiARwTOC@4h|nyNq`ASx(mv#3E?!YEGIq*>HP z83~FGD$a{K<1phI6g6s002jbfyTuI4TaV$2wv-bNtr@EWy%sb!nJ&%8U?|f;V zbMM*ixoe%eTZQeiaDF8T@g1NZa2#*~@IBzviSQ4i-R}qRP6Ft68u3{`@c(g`?G~c< zMM8|f_@B#K+vT5mRG*ti3o!=J1yDZQ6cFZ^ z&~v8}JHL7?Rdg|>)QsBZUWKM)&lq2Hvk>zDNkz_(G@+}R8YkBRyCyf0;|UA1;{2dT zEzFV-HU{Qp+5Phfzot2`x!~J_<>QfWKanf?ivi9{T(uRun?IYH;Hn+ETdPg>l#lPb zt8a~Sm$SxU?rctThl9beFo(AY^R|%v#c=Rc*#5dOSA>L+H8H-e{-6KZHHU61c1)mr z`lHU<2Q4trB z*`OQ6w+P`}FA3)$#E$~D0m{eIKZpCd)55Eu{_DeNFRgsMit+ymSvlYv?nw&eX1hUodgi;V&8Z1g}LF4(vQ>wR*?JB%WurGZlG#_%Gy4=zDeMDYp3yy~m7!;_R(edU3$(g`*WKt8({k#m ztc7tCv6TX?B=D$oGGZzn{X@@t9qP!n4z&*PbpnID_si7v&Pu;s2&D}pjey3HbC<|T z$d(klDYZ#C$=Ob~-E3)k`YYJNMR8vkiw)NLm0SlDpJHV_w_b`tv)BsChy;p!Gvfc~8k{EjySTbXOMoyOA zA6o4>BHIRgV?uWGywE;8h5JxH*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=_7fv^s!uO`$V2hBN~Gl!x=xj13y`oI_~9O#_3MZ` z+JRc&fB85Nf*vdfUJ}2|?|*xHbd=wEtUKDF5C49dr{bKIj&|)BU)%!!%ikN(aeQuM z|1wzAZb#hloct#|C%?>7an4G|bJ6i!{3kpY(Q$lkWdAZ))NV)I@tpi8JSV@*Q*q8p z$8*u~T>K|I7twKiZe;&5Sk!Ju-0__JCp;&wFW~2b?nwv_zz>@4Ok^equ?@6iD*i_w z{PzsD5%wp-hi(4wFY_4ve`SUK53G(~M+H-nWD&j0`b diff --git a/include/change_key.h b/include/change_key.h deleted file mode 100644 index cdc2083..0000000 --- a/include/change_key.h +++ /dev/null @@ -1,32 +0,0 @@ -/* changeKey.h */ - -/* Define for key offsets */ -#define F8_KEY1 0x00005149 -#define F8_KEY2 0x00005179 -#define F8_KEY3 0x00005181 -#define F8_KEY4 0x00005189 -#define F8_KEY5 0x00005190 -#define F8_KEY6 0x00005182 -#define F8_KEY7 0x0000517a -#define F8_KEY8 0x0000514a - -/* Define for prog1-8 offset */ -#define PROG1_OFFSET 0x0000539C -#define PROG2_OFFSET 0x000056BC -#define PROG3_OFFSET 0x000059DC -#define PROG4_OFFSET 0x00005CFC -#define PROG5_OFFSET 0x0000601C -#define PROG6_OFFSET 0x0000633C -#define PROG7_OFFSET 0x0000665C -#define PROG8_OFFSET 0x0006977C - -typedef struct key_prog key_prog; -struct key_prog -{ - int offset; - int key_settings[100][8]; -}; - - -void set_key_value(char* firmware_buffer, int key, int value); - diff --git a/include/firmware_handling.h b/include/firmware_handling.h index 07eeb91..a41c617 100644 --- a/include/firmware_handling.h +++ b/include/firmware_handling.h @@ -1,11 +1,85 @@ -typedef struct fbuffer_t fbuffer_t; -struct fbuffer_t +#include + +/* Max prog_actions per key_prog */ +#define MAX_ACTION 100 + +/* Defines for key offsets */ +#define F8_KEY1 0x00005189 +#define F8_KEY2 0x00005181 +#define F8_KEY3 0x00005179 +#define F8_KEY4 0x00005149 +#define F8_KEY5 0x0000518A +#define F8_KEY6 0x00005182 +#define F8_KEY7 0x0000517A +#define F8_KEY8 0x0000514A + +/* Defines for key program code */ +#define F8_PROG1 0xD7 +#define F8_PROG2 0xD8 +#define F8_PROG3 0xD9 +#define F8_PROG4 0xDA +#define F8_PROG5 0xDB +#define F8_PROG6 0xDC +#define F8_PROG7 0xDD +#define F8_PROG8 0xDE + +/* Define for prog1-8 offset */ +#define PROG1_OFFSET 0x0000539C +#define PROG2_OFFSET 0x000056BC +#define PROG3_OFFSET 0x000059DC +#define PROG4_OFFSET 0x00005CFC +#define PROG5_OFFSET 0x0000601C +#define PROG6_OFFSET 0x0000633C +#define PROG7_OFFSET 0x0000665C +#define PROG8_OFFSET 0x0000697C + +typedef struct f_bffr_t* f_bffrP; +struct f_bffr_t { - char* buffer; + char *buffer; int size; }; -/* reads in the firmware file into a buffer */ -fbuffer_t* get_firmware_buffer(char* filename); -void write_firmware_buffer(char* filename, fbuffer_t* p_fb); +/* + * A single macro action + * First value is the modifiers to be hold while executing the other actions (see keycodes.h) + * Second value is the delay between the keypresse ranging from 0.0 seconds to 3.0 seconds + * The remaining values are the keycodes to be pressed + */ +typedef struct prog_action* prog_actionP; +struct prog_action +{ + uint8_t k_modifier; + uint8_t k_delay; + uint8_t k_action1; + uint8_t k_action2; + uint8_t k_action3; + uint8_t k_action4; + uint8_t k_action5; + uint8_t k_action6; +}; + +/* + * A single macro program consisting of the offset and up to MAX_ACTION (100) actions + */ +typedef struct key_prog* key_progP; +struct key_prog +{ + int prog_offset; + prog_actionP prog_actions[MAX_ACTION]; +}; + +/* + * set the value "value" to the specified key "key" inside the buffer "firmware_buffer" + * Key has to be the offset of the key to be altered. + * Value has to be a keycode + */ +void set_key_value(char *firmware_buffer, int key, int value); + +void set_program(f_bffrP p_fb, key_progP kp); + +/* reads in the firmware file into a buffer */ +f_bffrP get_firmware_buffer(char *filename); + +void write_firmware_buffer(char *filename, f_bffrP p_fb); diff --git a/src/change_key.c b/src/change_key.c deleted file mode 100644 index 9166d04..0000000 --- a/src/change_key.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include - -#include "../include/change_key.h" - -void set_key_value(char* firmware_buffer, int key, int value) { - memset(firmware_buffer + key, value, 1); -} diff --git a/src/firmware_handling.c b/src/firmware_handling.c index 2447fa1..e19c9ed 100644 --- a/src/firmware_handling.c +++ b/src/firmware_handling.c @@ -1,15 +1,16 @@ #include #include -#include #include +#include + +/* Just for debugging */ #include #include "../include/firmware_handling.h" -fbuffer_t* get_firmware_buffer(char* filename) { +f_bffrP get_firmware_buffer(char *filename) { - fbuffer_t buffer; - fbuffer_t* p_fb = &buffer; + f_bffrP p_fb = malloc(sizeof(*p_fb)); FILE *firmware = fopen(filename, "rb"); if(!firmware) { @@ -23,6 +24,7 @@ fbuffer_t* get_firmware_buffer(char* filename) { exit(EXIT_FAILURE); } + /* set buffer size and read in firmware file into buffer*/ p_fb->size = sb.st_size; p_fb->buffer = malloc(p_fb->size); fread(p_fb->buffer, p_fb->size, 1, firmware); @@ -35,7 +37,7 @@ fbuffer_t* get_firmware_buffer(char* filename) { return p_fb; } -void write_firmware_buffer(char* filename, fbuffer_t* p_fb) { +void write_firmware_buffer(char *filename, f_bffrP p_fb) { FILE *firmware_file = fopen(filename, "wb+"); if(!firmware_file) { @@ -47,3 +49,33 @@ void write_firmware_buffer(char* filename, fbuffer_t* p_fb) { fclose(firmware_file); } + + +void set_key_value(char *firmware_buffer, int key, int value) { + memset(firmware_buffer + key, value, 1); +} + +void set_program(f_bffrP p_fb, key_progP kp) { + for(int i=0; iprog_actions[i]){ + /* calculate the offset for the action + * -> general prog_offset + current prog_action i times bytes per action + */ + int actionpointer = kp->prog_offset + (i * sizeof(*kp->prog_actions[0])); + + /* set the modifiers */ + memset(p_fb->buffer + actionpointer + 0, kp->prog_actions[i]->k_modifier, 1); + /* set timing delay */ + memset(p_fb->buffer + actionpointer + 1, kp->prog_actions[i]->k_delay, 1); + /* set action 1-6 */ + memset(p_fb->buffer + actionpointer + 2, kp->prog_actions[i]->k_action1, 1); + memset(p_fb->buffer + actionpointer + 3, kp->prog_actions[i]->k_action2, 1); + memset(p_fb->buffer + actionpointer + 4, kp->prog_actions[i]->k_action3, 1); + memset(p_fb->buffer + actionpointer + 5, kp->prog_actions[i]->k_action4, 1); + memset(p_fb->buffer + actionpointer + 6, kp->prog_actions[i]->k_action5, 1); + memset(p_fb->buffer + actionpointer + 7, kp->prog_actions[i]->k_action6, 1); + } + } +} diff --git a/src/main.c b/src/main.c index a8ed322..6d8523a 100644 --- a/src/main.c +++ b/src/main.c @@ -1,28 +1,83 @@ #include +#include #include #include -#include "../include/change_key.h" #include "../include/firmware_handling.h" #include "../include/keycodes.h" +void testing (f_bffrP p_fb); +char *updated_file_name(char *orig); + int main (int argc, char *argv[]) { - fbuffer_t* p_fb = get_firmware_buffer(argv[1]); + /* Read in the firmware file into a f_bffr_t struct */ + f_bffrP p_fb = get_firmware_buffer(argv[1]); - set_key_value(p_fb->buffer, F8_KEY8, KEY_a_A); + /* Call testing method */ + testing(p_fb); + + write_firmware_buffer(updated_file_name(argv[1]), p_fb); + + free(p_fb->buffer); + free(p_fb); + + return 0; +} + +char *updated_file_name (char *orig){ + char *ne = "_new.bin"; + int len = strlen(orig); + + char *new_name = malloc(len + 4); + + strncpy(new_name, orig, len - 4); + strcat(new_name, ne); + + printf("New File Name: %s", new_name); + + return new_name; +} + +void testing (f_bffrP p_fb) { + set_key_value(p_fb->buffer, F8_KEY1, KEY_9_LeftParenthesis); + set_key_value(p_fb->buffer, F8_KEY2, KEY_8_Asterisk); + set_key_value(p_fb->buffer, F8_KEY3, KEY_7_Ampersand); + set_key_value(p_fb->buffer, F8_KEY4, KEY_6_Caret); + set_key_value(p_fb->buffer, F8_KEY5, KEY_5_Percent); + set_key_value(p_fb->buffer, F8_KEY6, KEY_4_Dollar); + set_key_value(p_fb->buffer, F8_KEY7, KEY_3_Pound); + set_key_value(p_fb->buffer, F8_KEY8, KEY_2_At); /* for debugging -> print content of buffer to terminal */ /* - for(int i = 0; isize; i++){ - putc(isprint(fb->buffer[i]) ? fb->buffer[i] : '.', stdout); + for(int i = 0; isize; i++){ + putc(isprint(p_fb->buffer[i]) ? p_fb->buffer[i] : '.', stdout); } */ - - /* Temporary solution to renaming the input file */ - char str[50]; - sprintf(str, "new_%s", argv[1]); - write_firmware_buffer(str, p_fb); - return 0; + prog_actionP pa = calloc(1, sizeof(*pa)); + pa->k_modifier = 0x00; + pa->k_delay = 0x00; + pa->k_action1 = 0x0B; + pa->k_action2 = 0x04; + pa->k_action3 = 0x0F; + pa->k_action4 = 0x0F; + pa->k_action5 = 0x12; + pa->k_action6 = 0x00; + + + key_progP kp = calloc(1, sizeof(*kp)); + kp->prog_offset = PROG1_OFFSET; + kp->prog_actions[0] = pa; + kp->prog_actions[1] = pa; + kp->prog_actions[2] = pa; + kp->prog_actions[3] = pa; + kp->prog_actions[99] = pa; + //*/ + + set_program(p_fb, kp); + + free(kp); + free(pa); } -- 2.39.5