Updates and fixes.
- Implement fix for keyboards not switching to boot mode properly, until full report parsing gets done. This is expected to improve support for certain models that were reported problematic. - Implement fix for mouse acceleration omitting absolute mode - Provide pass_to_os = true to not capture shift+backspace from the OS, it's annoying when you hold shift and mistype something, then want to use backspace but couldn't.
This commit is contained in:
		
							parent
							
								
									1cf90ae31d
								
							
						
					
					
						commit
						b44ef2dc6f
					
				| 
						 | 
					@ -55,6 +55,7 @@ hotkey_combo_t hotkeys[] = {
 | 
				
			||||||
    {.modifier       = KEYBOARD_MODIFIER_RIGHTSHIFT,
 | 
					    {.modifier       = KEYBOARD_MODIFIER_RIGHTSHIFT,
 | 
				
			||||||
     .keys           = {HID_KEY_BACKSPACE},
 | 
					     .keys           = {HID_KEY_BACKSPACE},
 | 
				
			||||||
     .key_count      = 1,
 | 
					     .key_count      = 1,
 | 
				
			||||||
 | 
					     .pass_to_os     = true,
 | 
				
			||||||
     .action_handler = &output_config_hotkey_handler},
 | 
					     .action_handler = &output_config_hotkey_handler},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Erase stored config */
 | 
					    /* Erase stored config */
 | 
				
			||||||
| 
						 | 
					@ -191,6 +192,12 @@ void process_keyboard_report(uint8_t *raw_report, int length, device_t *state) {
 | 
				
			||||||
    if (length < KBD_REPORT_LENGTH)
 | 
					    if (length < KBD_REPORT_LENGTH)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* If the report is longer by 1 byte, we can assume the first byte is the report ID
 | 
				
			||||||
 | 
					       and that the keyboard didn't switch to boot mode properly. Use this workaround
 | 
				
			||||||
 | 
					       until full HID report parsing is implemented */
 | 
				
			||||||
 | 
					    if (length == KBD_REPORT_LENGTH + 1)
 | 
				
			||||||
 | 
					        keyboard_report = (hid_keyboard_report_t *)(raw_report + 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Check if any hotkey was pressed */
 | 
					    /* Check if any hotkey was pressed */
 | 
				
			||||||
    hotkey = check_all_hotkeys(keyboard_report, state);
 | 
					    hotkey = check_all_hotkeys(keyboard_report, state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,7 +52,7 @@ int32_t accelerate(int32_t offset) {
 | 
				
			||||||
        return offset;
 | 
					        return offset;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (int i = 0; i < 7; i++) {
 | 
					    for (int i = 0; i < 7; i++) {
 | 
				
			||||||
        if (offset < acceleration[i].value) {
 | 
					        if (abs(offset) < acceleration[i].value) {
 | 
				
			||||||
            return offset * acceleration[i].factor;
 | 
					            return offset * acceleration[i].factor;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -103,6 +103,9 @@ void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const *desc_re
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    switch (itf_protocol) {
 | 
					    switch (itf_protocol) {
 | 
				
			||||||
        case HID_ITF_PROTOCOL_KEYBOARD:
 | 
					        case HID_ITF_PROTOCOL_KEYBOARD:
 | 
				
			||||||
 | 
					            if (ENFORCE_PORTS && BOARD_ROLE == PICO_B)
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Keeping this is required for setting leds from device set_report callback */
 | 
					            /* Keeping this is required for setting leds from device set_report callback */
 | 
				
			||||||
            global_state.kbd_dev_addr       = dev_addr;
 | 
					            global_state.kbd_dev_addr       = dev_addr;
 | 
				
			||||||
            global_state.kbd_instance       = instance;
 | 
					            global_state.kbd_instance       = instance;
 | 
				
			||||||
| 
						 | 
					@ -110,6 +113,9 @@ void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const *desc_re
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case HID_ITF_PROTOCOL_MOUSE:
 | 
					        case HID_ITF_PROTOCOL_MOUSE:
 | 
				
			||||||
 | 
					            if (ENFORCE_PORTS && BOARD_ROLE == PICO_A)
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Switch to using protocol report instead of boot report, it's more complicated but
 | 
					            /* Switch to using protocol report instead of boot report, it's more complicated but
 | 
				
			||||||
               at least we get all the information we need (looking at you, mouse wheel) */
 | 
					               at least we get all the information we need (looking at you, mouse wheel) */
 | 
				
			||||||
            if (tuh_hid_get_protocol(dev_addr, instance) == HID_PROTOCOL_BOOT) {
 | 
					            if (tuh_hid_get_protocol(dev_addr, instance) == HID_PROTOCOL_BOOT) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -158,3 +158,17 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define OUTPUT_A_OS LINUX
 | 
					#define OUTPUT_A_OS LINUX
 | 
				
			||||||
#define OUTPUT_B_OS LINUX
 | 
					#define OUTPUT_B_OS LINUX
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**================================================== *
 | 
				
			||||||
 | 
					 * =================  Enforce Ports ================= *
 | 
				
			||||||
 | 
					 * ==================================================
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * If enabled, fixes some device incompatibilities by
 | 
				
			||||||
 | 
					 * enforcing keyboard has to be in port A and mouse in port B.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * ENFORCE_PORTS: [0, 1] - 1 means keyboard has to plug in A and mouse in B
 | 
				
			||||||
 | 
					 *                         0 means no such layout is enforced
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define ENFORCE_PORTS 0
 | 
				
			||||||
		Loading…
	
		Reference in New Issue