Adding missing GET_PROTOCOL handling
- Odd that this went unnoticed for sooooo long - Fixes Mac OSX issue where keyboard freezes/hangs on a reboot - Also adding missing code for usbMuxUart
This commit is contained in:
parent
044f14a52b
commit
8fbc8d535f
@ -589,10 +589,23 @@ static void usb_setup()
|
|||||||
USBKeys_Protocol = setup.wValue & 0xFF; // 0 - Boot Mode, 1 - NKRO Mode
|
USBKeys_Protocol = setup.wValue & 0xFF; // 0 - Boot Mode, 1 - NKRO Mode
|
||||||
goto send;
|
goto send;
|
||||||
|
|
||||||
|
case 0x03A1: /// HID GET_PROTOCOL
|
||||||
|
#ifdef UART_DEBUG
|
||||||
|
print("GET_PROTOCOL - ");
|
||||||
|
printHex( setup.wValue );
|
||||||
|
print(" - ");
|
||||||
|
printHex( USBKeys_Protocol );
|
||||||
|
print(NL);
|
||||||
|
#endif
|
||||||
|
reply_buffer[0] = USBKeys_Protocol;
|
||||||
|
datalen = 1;
|
||||||
|
goto send;
|
||||||
|
|
||||||
// case 0xC940:
|
// case 0xC940:
|
||||||
default:
|
default:
|
||||||
#ifdef UART_DEBUG_UNKNOWN
|
#ifdef UART_DEBUG_UNKNOWN
|
||||||
print("UNKNOWN");
|
print("UNKNOWN");
|
||||||
|
print(NL);
|
||||||
#endif
|
#endif
|
||||||
endpoint0_stall();
|
endpoint0_stall();
|
||||||
return;
|
return;
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
#include <arm/usb_serial.h>
|
#include <arm/usb_serial.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// KLL
|
||||||
|
#include <kll_defs.h>
|
||||||
|
|
||||||
// Local Includes
|
// Local Includes
|
||||||
#include "output_com.h"
|
#include "output_com.h"
|
||||||
|
|
||||||
@ -117,15 +120,25 @@ uint8_t USBKeys_SentCLI = 0;
|
|||||||
// 1=num lock, 2=caps lock, 4=scroll lock, 8=compose, 16=kana
|
// 1=num lock, 2=caps lock, 4=scroll lock, 8=compose, 16=kana
|
||||||
volatile uint8_t USBKeys_LEDs = 0;
|
volatile uint8_t USBKeys_LEDs = 0;
|
||||||
|
|
||||||
|
// Currently pressed mouse buttons, bitmask, 0 represents no buttons pressed
|
||||||
|
volatile uint16_t USBMouse_Buttons = 0;
|
||||||
|
|
||||||
|
// Relative mouse axis movement, stores pending movement
|
||||||
|
volatile uint16_t USBMouse_Relative_x = 0;
|
||||||
|
volatile uint16_t USBMouse_Relative_y = 0;
|
||||||
|
|
||||||
// Protocol setting from the host.
|
// Protocol setting from the host.
|
||||||
// 0 - Boot Mode
|
// 0 - Boot Mode
|
||||||
// 1 - NKRO Mode (Default, unless set by a BIOS or boot interface)
|
// 1 - NKRO Mode (Default, unless set by a BIOS or boot interface)
|
||||||
volatile uint8_t USBKeys_Protocol = 1;
|
volatile uint8_t USBKeys_Protocol = USBProtocol_define;
|
||||||
|
|
||||||
// Indicate if USB should send update
|
// Indicate if USB should send update
|
||||||
// OS only needs update if there has been a change in state
|
// OS only needs update if there has been a change in state
|
||||||
USBKeyChangeState USBKeys_Changed = USBKeyChangeState_None;
|
USBKeyChangeState USBKeys_Changed = USBKeyChangeState_None;
|
||||||
|
|
||||||
|
// Indicate if USB should send update
|
||||||
|
USBMouseChangeState USBMouse_Changed = 0;
|
||||||
|
|
||||||
// the idle configuration, how often we send the report to the
|
// the idle configuration, how often we send the report to the
|
||||||
// host (ms * 4) even when it hasn't changed
|
// host (ms * 4) even when it hasn't changed
|
||||||
uint8_t USBKeys_Idle_Config = 125;
|
uint8_t USBKeys_Idle_Config = 125;
|
||||||
@ -511,6 +524,63 @@ void Output_flashMode_capability( uint8_t state, uint8_t stateType, uint8_t *arg
|
|||||||
Output_firmwareReload();
|
Output_firmwareReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sends a mouse command over the USB Output buffer
|
||||||
|
// XXX This function *will* be changing in the future
|
||||||
|
// If you use it, be prepared that your .kll files will break in the future (post KLL 0.5)
|
||||||
|
// Argument #1: USB Mouse Button (16 bit)
|
||||||
|
// Argument #2: USB X Axis (16 bit) relative
|
||||||
|
// Argument #3: USB Y Axis (16 bit) relative
|
||||||
|
void Output_usbMouse_capability( uint8_t state, uint8_t stateType, uint8_t *args )
|
||||||
|
{
|
||||||
|
// Display capability name
|
||||||
|
if ( stateType == 0xFF && state == 0xFF )
|
||||||
|
{
|
||||||
|
print("Output_usbMouse(mouseButton,relX,relY)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine which mouse button was sent
|
||||||
|
// The USB spec defines up to a max of 0xFFFF buttons
|
||||||
|
// The usual are:
|
||||||
|
// 1 - Button 1 - (Primary)
|
||||||
|
// 2 - Button 2 - (Secondary)
|
||||||
|
// 3 - Button 3 - (Tertiary)
|
||||||
|
uint16_t mouse_button = *(uint16_t*)(&args[0]);
|
||||||
|
|
||||||
|
// X/Y Relative Axis
|
||||||
|
uint16_t mouse_x = *(uint16_t*)(&args[2]);
|
||||||
|
uint16_t mouse_y = *(uint16_t*)(&args[4]);
|
||||||
|
|
||||||
|
// Adjust for bit shift
|
||||||
|
uint16_t mouse_button_shift = mouse_button - 1;
|
||||||
|
|
||||||
|
// Only send mouse button if in press or hold state
|
||||||
|
if ( stateType == 0x00 && state == 0x03 ) // Release state
|
||||||
|
{
|
||||||
|
// Release
|
||||||
|
if ( mouse_button )
|
||||||
|
USBMouse_Buttons &= ~(1 << mouse_button_shift);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Press or hold
|
||||||
|
if ( mouse_button )
|
||||||
|
USBMouse_Buttons |= (1 << mouse_button_shift);
|
||||||
|
|
||||||
|
if ( mouse_x )
|
||||||
|
USBMouse_Relative_x = mouse_x;
|
||||||
|
if ( mouse_y )
|
||||||
|
USBMouse_Relative_y = mouse_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trigger updates
|
||||||
|
if ( mouse_button )
|
||||||
|
USBMouse_Changed |= USBMouseChangeState_Buttons;
|
||||||
|
|
||||||
|
if ( mouse_x || mouse_y )
|
||||||
|
USBMouse_Changed |= USBMouseChangeState_Relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----- Functions -----
|
// ----- Functions -----
|
||||||
|
Reference in New Issue
Block a user