summaryrefslogtreecommitdiff
path: root/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'protocol')
-rw-r--r--protocol/lufa.mk16
m---------protocol/lufa/LUFA-git0
-rw-r--r--protocol/lufa/descriptor.c22
-rw-r--r--protocol/lufa/descriptor.h16
-rw-r--r--protocol/lufa/lufa.c94
-rw-r--r--protocol/lufa/lufa.h11
-rw-r--r--protocol/pjrc/usb.c22
-rw-r--r--protocol/pjrc/usb_keyboard.c9
-rw-r--r--protocol/pjrc/usb_keyboard.h2
-rw-r--r--protocol/ps2_mouse.c7
10 files changed, 125 insertions, 74 deletions
diff --git a/protocol/lufa.mk b/protocol/lufa.mk
index 3489f19c2c..ac70ac0391 100644
--- a/protocol/lufa.mk
+++ b/protocol/lufa.mk
@@ -1,7 +1,12 @@
LUFA_DIR = protocol/lufa
# Path to the LUFA library
-LUFA_PATH ?= protocol/lufa/LUFA-120730
+ifeq (, $(wildcard $(TOP_DIR)/$(LUFA_DIR)/LUFA-git/LUFA/Version.h))
+ LUFA_PATH ?= $(LUFA_DIR)/LUFA-120730
+else
+ LUFA_PATH ?= $(LUFA_DIR)/LUFA-git
+endif
+
# Create the LUFA source path variables by including the LUFA makefile
ifneq (, $(wildcard $(TOP_DIR)/$(LUFA_PATH)/LUFA/Build/lufa_sources.mk))
@@ -30,9 +35,12 @@ VPATH += $(TOP_DIR)/$(LUFA_PATH)
#endif
# LUFA library compile-time options and predefined tokens
-LUFA_OPTS = -D USB_DEVICE_ONLY
-LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
-LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+LUFA_OPTS = -DUSB_DEVICE_ONLY
+LUFA_OPTS += -DUSE_FLASH_DESCRIPTORS
+LUFA_OPTS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+#LUFA_OPTS += -DINTERRUPT_CONTROL_ENDPOINT
+LUFA_OPTS += -DFIXED_CONTROL_ENDPOINT_SIZE=8
+LUFA_OPTS += -DFIXED_NUM_CONFIGURATIONS=1
OPT_DEFS += -DF_USB=$(F_USB)UL
OPT_DEFS += -DARCH=ARCH_$(ARCH)
diff --git a/protocol/lufa/LUFA-git b/protocol/lufa/LUFA-git
new file mode 160000
+Subproject b6c18b2a7c544653efbe12a1d4e8ba65e7d83c3
diff --git a/protocol/lufa/descriptor.c b/protocol/lufa/descriptor.c
index a46ba3ec6a..c13a81bda8 100644
--- a/protocol/lufa/descriptor.c
+++ b/protocol/lufa/descriptor.c
@@ -230,12 +230,12 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
- .USBSpecification = VERSION_BCD(01.10),
+ .USBSpecification = VERSION_BCD(1,1,0),
.Class = USB_CSCP_NoDeviceClass,
.SubClass = USB_CSCP_NoDeviceSubclass,
.Protocol = USB_CSCP_NoDeviceProtocol,
- .Endpoint0Size = 8,
+ .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
/* specified in config.h */
.VendorID = VENDOR_ID,
@@ -246,7 +246,7 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
- .NumberOfConfigurations = 1
+ .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
/*******************************************************************************
@@ -292,7 +292,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
- .HIDSpec = VERSION_BCD(01.11),
+ .HIDSpec = VERSION_BCD(1,1,1),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
@@ -306,7 +306,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_IN_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = KEYBOARD_EPSIZE,
- .PollingIntervalMS = 0x01
+ .PollingIntervalMS = 0x0A
},
/*
@@ -333,7 +333,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
- .HIDSpec = VERSION_BCD(01.11),
+ .HIDSpec = VERSION_BCD(1,1,1),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
@@ -347,7 +347,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_IN_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MOUSE_EPSIZE,
- .PollingIntervalMS = 0x01
+ .PollingIntervalMS = 0x0A
},
#endif
@@ -375,7 +375,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
- .HIDSpec = VERSION_BCD(01.11),
+ .HIDSpec = VERSION_BCD(1,1,1),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
@@ -389,7 +389,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointAddress = (ENDPOINT_DIR_IN | EXTRAKEY_IN_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = EXTRAKEY_EPSIZE,
- .PollingIntervalMS = 0x01
+ .PollingIntervalMS = 0x0A
},
#endif
@@ -417,7 +417,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
- .HIDSpec = VERSION_BCD(01.11),
+ .HIDSpec = VERSION_BCD(1,1,1),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
@@ -469,7 +469,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
- .HIDSpec = VERSION_BCD(01.11),
+ .HIDSpec = VERSION_BCD(1,1,1),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
diff --git a/protocol/lufa/descriptor.h b/protocol/lufa/descriptor.h
index 9ee1c04d79..42af07917c 100644
--- a/protocol/lufa/descriptor.h
+++ b/protocol/lufa/descriptor.h
@@ -137,13 +137,17 @@ typedef struct
#ifdef CONSOLE_ENABLE
# define CONSOLE_IN_EPNUM (EXTRAKEY_IN_EPNUM + 1)
-# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 2)
+# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 1)
+//# define CONSOLE_OUT_EPNUM (EXTRAKEY_IN_EPNUM + 2)
#else
# define CONSOLE_OUT_EPNUM EXTRAKEY_IN_EPNUM
#endif
#ifdef NKRO_ENABLE
# define NKRO_IN_EPNUM (CONSOLE_OUT_EPNUM + 1)
+# if defined(__AVR_ATmega32U2__) && NKRO_IN_EPNUM > 4
+# error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO)"
+# endif
#endif
@@ -159,4 +163,14 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
+
+/* new API */
+#if LUFA_VERSION_INTEGER < 0x140302
+ #undef VERSION_BCD
+ #define VERSION_BCD(Major, Minor, Revision) \
+ CPU_TO_LE16( ((Major & 0xFF) << 8) | \
+ ((Minor & 0x0F) << 4) | \
+ (Revision & 0x0F) )
+#endif
+
#endif
diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c
index eca51c8784..d60aecc3f1 100644
--- a/protocol/lufa/lufa.c
+++ b/protocol/lufa/lufa.c
@@ -52,8 +52,8 @@
#include "descriptor.h"
#include "lufa.h"
-static uint8_t idle_duration = 0;
-static uint8_t protocol_report = 1;
+uint8_t keyboard_idle = 0;
+uint8_t keyboard_protocol = 1;
static uint8_t keyboard_led_stats = 0;
static report_keyboard_t keyboard_report_sent;
@@ -184,15 +184,6 @@ void EVENT_USB_Device_StartOfFrame(void)
/** Event handler for the USB_ConfigurationChanged event.
* This is fired when the host sets the current configuration of the USB device after enumeration.
*/
-#if LUFA_VERSION_INTEGER < 0x120730
- /* old API 120219 */
- #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint(epnum, eptype, epdir, epsize, epbank)
-#else
- /* new API >= 120730 */
- #define ENDPOINT_BANK_SINGLE 1
- #define ENDPOINT_BANK_DOUBLE 2
- #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint((epdir) | (epnum) , eptype, epsize, epbank)
-#endif
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
@@ -217,9 +208,11 @@ void EVENT_USB_Device_ConfigurationChanged(void)
/* Setup Console HID Report Endpoints */
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
CONSOLE_EPSIZE, ENDPOINT_BANK_DOUBLE);
+#if 0
ConfigSuccess &= ENDPOINT_CONFIG(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
#endif
+#endif
#ifdef NKRO_ENABLE
/* Setup NKRO HID Report Endpoints */
@@ -279,6 +272,7 @@ void EVENT_USB_Device_ControlRequest(void)
// Interface
switch (USB_ControlRequest.wIndex) {
case KEYBOARD_INTERFACE:
+ case NKRO_INTERFACE:
Endpoint_ClearSETUP();
while (!(Endpoint_IsOUTReceived())) {
@@ -299,21 +293,29 @@ void EVENT_USB_Device_ControlRequest(void)
case HID_REQ_GetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSETUP();
- while (!(Endpoint_IsINReady()));
- Endpoint_Write_8(protocol_report);
- Endpoint_ClearIN();
- Endpoint_ClearStatusStage();
+ if (USB_ControlRequest.wIndex == KEYBOARD_INTERFACE) {
+ Endpoint_ClearSETUP();
+ while (!(Endpoint_IsINReady()));
+ Endpoint_Write_8(keyboard_protocol);
+ Endpoint_ClearIN();
+ Endpoint_ClearStatusStage();
+ }
}
break;
case HID_REQ_SetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSETUP();
- Endpoint_ClearStatusStage();
+ if (USB_ControlRequest.wIndex == KEYBOARD_INTERFACE) {
+ Endpoint_ClearSETUP();
+ Endpoint_ClearStatusStage();
- protocol_report = ((USB_ControlRequest.wValue & 0xFF) != 0x00);
+ keyboard_protocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00);
+#ifdef NKRO_ENABLE
+ keyboard_nkro = !!keyboard_protocol;
+#endif
+ clear_keyboard();
+ }
}
break;
@@ -323,7 +325,7 @@ void EVENT_USB_Device_ControlRequest(void)
Endpoint_ClearSETUP();
Endpoint_ClearStatusStage();
- idle_duration = ((USB_ControlRequest.wValue & 0xFF00) >> 8);
+ keyboard_idle = ((USB_ControlRequest.wValue & 0xFF00) >> 8);
}
break;
@@ -332,7 +334,7 @@ void EVENT_USB_Device_ControlRequest(void)
{
Endpoint_ClearSETUP();
while (!(Endpoint_IsINReady()));
- Endpoint_Write_8(idle_duration);
+ Endpoint_Write_8(keyboard_idle);
Endpoint_ClearIN();
Endpoint_ClearStatusStage();
}
@@ -351,7 +353,7 @@ static uint8_t keyboard_leds(void)
static void send_keyboard(report_keyboard_t *report)
{
- uint8_t timeout = 0;
+ uint8_t timeout = 255;
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
@@ -359,26 +361,27 @@ static void send_keyboard(report_keyboard_t *report)
/* Select the Keyboard Report Endpoint */
#ifdef NKRO_ENABLE
if (keyboard_nkro) {
+ /* Report protocol - NKRO */
Endpoint_SelectEndpoint(NKRO_IN_EPNUM);
- }
- else
-#endif
- {
- Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM);
- }
- /* Check if Keyboard Endpoint Ready for Read/Write */
- while (--timeout && !Endpoint_IsReadWriteAllowed()) ;
+ /* Check if write ready for a polling interval around 1ms */
+ while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(4);
+ if (!Endpoint_IsReadWriteAllowed()) return;
- /* Write Keyboard Report Data */
-#ifdef NKRO_ENABLE
- if (keyboard_nkro) {
+ /* Write Keyboard Report Data */
Endpoint_Write_Stream_LE(report, NKRO_EPSIZE, NULL);
}
else
#endif
{
- /* boot mode */
+ /* Boot protocol */
+ Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM);
+
+ /* Check if write ready for a polling interval around 10ms */
+ while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
+ if (!Endpoint_IsReadWriteAllowed()) return;
+
+ /* Write Keyboard Report Data */
Endpoint_Write_Stream_LE(report, KEYBOARD_EPSIZE, NULL);
}
@@ -391,7 +394,7 @@ static void send_keyboard(report_keyboard_t *report)
static void send_mouse(report_mouse_t *report)
{
#ifdef MOUSE_ENABLE
- uint8_t timeout = 0;
+ uint8_t timeout = 255;
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
@@ -399,8 +402,9 @@ static void send_mouse(report_mouse_t *report)
/* Select the Mouse Report Endpoint */
Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);
- /* Check if Mouse Endpoint Ready for Read/Write */
- while (--timeout && !Endpoint_IsReadWriteAllowed()) ;
+ /* Check if write ready for a polling interval around 10ms */
+ while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
+ if (!Endpoint_IsReadWriteAllowed()) return;
/* Write Mouse Report Data */
Endpoint_Write_Stream_LE(report, sizeof(report_mouse_t), NULL);
@@ -412,7 +416,7 @@ static void send_mouse(report_mouse_t *report)
static void send_system(uint16_t data)
{
- uint8_t timeout = 0;
+ uint8_t timeout = 255;
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
@@ -422,14 +426,18 @@ static void send_system(uint16_t data)
.usage = data
};
Endpoint_SelectEndpoint(EXTRAKEY_IN_EPNUM);
- while (--timeout && !Endpoint_IsReadWriteAllowed()) ;
+
+ /* Check if write ready for a polling interval around 10ms */
+ while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
+ if (!Endpoint_IsReadWriteAllowed()) return;
+
Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL);
Endpoint_ClearIN();
}
static void send_consumer(uint16_t data)
{
- uint8_t timeout = 0;
+ uint8_t timeout = 255;
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
@@ -439,7 +447,11 @@ static void send_consumer(uint16_t data)
.usage = data
};
Endpoint_SelectEndpoint(EXTRAKEY_IN_EPNUM);
- while (--timeout && !Endpoint_IsReadWriteAllowed()) ;
+
+ /* Check if write ready for a polling interval around 10ms */
+ while (timeout-- && !Endpoint_IsReadWriteAllowed()) _delay_us(40);
+ if (!Endpoint_IsReadWriteAllowed()) return;
+
Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL);
Endpoint_ClearIN();
}
diff --git a/protocol/lufa/lufa.h b/protocol/lufa/lufa.h
index bcee060d67..195123c0f9 100644
--- a/protocol/lufa/lufa.h
+++ b/protocol/lufa/lufa.h
@@ -66,4 +66,15 @@ typedef struct {
uint16_t usage;
} __attribute__ ((packed)) report_extra_t;
+
+#if LUFA_VERSION_INTEGER < 0x120730
+ /* old API 120219 */
+ #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint(epnum, eptype, epdir, epsize, epbank)
+#else
+ /* new API >= 120730 */
+ #define ENDPOINT_BANK_SINGLE 1
+ #define ENDPOINT_BANK_DOUBLE 2
+ #define ENDPOINT_CONFIG(epnum, eptype, epdir, epsize, epbank) Endpoint_ConfigureEndpoint((epdir) | (epnum) , eptype, epsize, epbank)
+#endif
+
#endif
diff --git a/protocol/pjrc/usb.c b/protocol/pjrc/usb.c
index 393b36f78e..1e6ba8719a 100644
--- a/protocol/pjrc/usb.c
+++ b/protocol/pjrc/usb.c
@@ -38,6 +38,7 @@
#include "sleep_led.h"
#endif
#include "suspend.h"
+#include "action.h"
#include "action_util.h"
@@ -628,6 +629,7 @@ uint8_t usb_configured(void)
void usb_remote_wakeup(void)
{
UDCON |= (1<<RMWKUP);
+ while (UDCON & (1<<RMWKUP));
}
@@ -692,20 +694,20 @@ ISR(USB_GEN_vect)
}
/* TODO: should keep IDLE rate on each keyboard interface */
#ifdef NKRO_ENABLE
- if (!keyboard_nkro && usb_keyboard_idle_config && (++div4 & 3) == 0) {
+ if (!keyboard_nkro && keyboard_idle && (++div4 & 3) == 0) {
#else
- if (usb_keyboard_idle_config && (++div4 & 3) == 0) {
+ if (keyboard_idle && (++div4 & 3) == 0) {
#endif
UENUM = KBD_ENDPOINT;
if (UEINTX & (1<<RWAL)) {
usb_keyboard_idle_count++;
- if (usb_keyboard_idle_count == usb_keyboard_idle_config) {
+ if (usb_keyboard_idle_count == keyboard_idle) {
usb_keyboard_idle_count = 0;
/* TODO: fix keyboard_report inconsistency */
/* To avoid Mac SET_IDLE behaviour.
UEDATX = keyboard_report_prev->mods;
UEDATX = 0;
- uint8_t keys = usb_keyboard_protocol ? KBD_REPORT_KEYS : 6;
+ uint8_t keys = keyboard_protocol ? KBD_REPORT_KEYS : 6;
for (uint8_t i=0; i<keys; i++) {
UEDATX = keyboard_report_prev->keys[i];
}
@@ -901,13 +903,13 @@ ISR(USB_COM_vect)
}
if (bRequest == HID_GET_IDLE) {
usb_wait_in_ready();
- UEDATX = usb_keyboard_idle_config;
+ UEDATX = keyboard_idle;
usb_send_in();
return;
}
if (bRequest == HID_GET_PROTOCOL) {
usb_wait_in_ready();
- UEDATX = usb_keyboard_protocol;
+ UEDATX = keyboard_protocol;
usb_send_in();
return;
}
@@ -921,14 +923,18 @@ ISR(USB_COM_vect)
return;
}
if (bRequest == HID_SET_IDLE) {
- usb_keyboard_idle_config = (wValue >> 8);
+ keyboard_idle = (wValue >> 8);
usb_keyboard_idle_count = 0;
//usb_wait_in_ready();
usb_send_in();
return;
}
if (bRequest == HID_SET_PROTOCOL) {
- usb_keyboard_protocol = wValue;
+ keyboard_protocol = wValue;
+#ifdef NKRO_ENABLE
+ keyboard_nkro = !!keyboard_protocol;
+#endif
+ clear_keyboard();
//usb_wait_in_ready();
usb_send_in();
return;
diff --git a/protocol/pjrc/usb_keyboard.c b/protocol/pjrc/usb_keyboard.c
index de798fcc22..d168331879 100644
--- a/protocol/pjrc/usb_keyboard.c
+++ b/protocol/pjrc/usb_keyboard.c
@@ -34,12 +34,12 @@
// protocol setting from the host. We use exactly the same report
// either way, so this variable only stores the setting since we
// are required to be able to report which setting is in use.
-uint8_t usb_keyboard_protocol=1;
+uint8_t keyboard_protocol=1;
// the idle configuration, how often we send the report to the
// host (ms * 4) even when it hasn't changed
// Windows and Linux set 0 while OS X sets 6(24ms) by SET_IDLE request.
-uint8_t usb_keyboard_idle_config=125;
+uint8_t keyobard_idle=125;
// count until idle timeout
uint8_t usb_keyboard_idle_count=0;
@@ -61,10 +61,7 @@ int8_t usb_keyboard_send_report(report_keyboard_t *report)
else
#endif
{
- if (usb_keyboard_protocol)
- result = send_report(report, KBD_ENDPOINT, 0, KBD_SIZE);
- else
- result = send_report(report, KBD_ENDPOINT, 0, 6);
+ result = send_report(report, KBD_ENDPOINT, 0, KBD_SIZE);
}
if (result) return result;
diff --git a/protocol/pjrc/usb_keyboard.h b/protocol/pjrc/usb_keyboard.h
index c362ca3b86..9b798e9a86 100644
--- a/protocol/pjrc/usb_keyboard.h
+++ b/protocol/pjrc/usb_keyboard.h
@@ -30,8 +30,6 @@
#include "host.h"
-extern uint8_t usb_keyboard_protocol;
-extern uint8_t usb_keyboard_idle_config;
extern uint8_t usb_keyboard_idle_count;
extern volatile uint8_t usb_keyboard_leds;
diff --git a/protocol/ps2_mouse.c b/protocol/ps2_mouse.c
index 4702f12c40..c3e8b3c1c3 100644
--- a/protocol/ps2_mouse.c
+++ b/protocol/ps2_mouse.c
@@ -82,9 +82,14 @@ void ps2_mouse_task(void)
mouse_report.x = ps2_host_recv_response();
mouse_report.y = ps2_host_recv_response();
} else {
- if (!debug_mouse) print("ps2_mouse: fail to get mouse packet\n");
+ if (debug_mouse) print("ps2_mouse: fail to get mouse packet\n");
return;
}
+ xprintf("%ud ", timer_read());
+ print("ps2_mouse raw: [");
+ phex(mouse_report.buttons); print("|");
+ print_hex8((uint8_t)mouse_report.x); print(" ");
+ print_hex8((uint8_t)mouse_report.y); print("]\n");
/* if mouse moves or buttons state changes */
if (mouse_report.x || mouse_report.y ||