Mercurial > louis > kiibohd-controller
comparison Output/pjrcUSB/arm/usb_keyboard.c @ 447:56237ba5da6f
Adding auto-restart support whenever USB gets into an odd state
- Somewhat aggresive, may cause restarts if the keyboard/OS hasn't fully intialized the keyboard
- Added GET_IDLE handling and correct usage of SET_IDLE
- Initial implementation of idle send, commented out as it causes issues on Mac OSX for sleeping
(keyboard has been working without it)
- MacOSX seems to have some sort of data corruption on the USB link, not sure why (other OSs have no issues)
- Cleaned up some code
- Added a longer sleep after the resume sequence to prevent possible issues sending keys too soon
(may need to be increased more)
Ipad support now seems flaky, though Mac, Windows seems solid.
Init sequence on Linux seems slow, even though there are no errors.
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Fri, 27 May 2016 01:21:57 -0700 |
parents | 68e19d7c953e |
children | 45feb80a2ad1 |
comparison
equal
deleted
inserted
replaced
446:f570ab7c861a | 447:56237ba5da6f |
---|---|
124 } | 124 } |
125 | 125 |
126 if ( ++wait_count > TX_TIMEOUT || transmit_previous_timeout ) | 126 if ( ++wait_count > TX_TIMEOUT || transmit_previous_timeout ) |
127 { | 127 { |
128 transmit_previous_timeout = 1; | 128 transmit_previous_timeout = 1; |
129 warn_print("USB Transmit Timeout..."); | 129 warn_print("USB Transmit Timeout...restarting device"); |
130 USBKeys_Changed = USBKeyChangeState_None; // Indicate packet lost | 130 USBKeys_Changed = USBKeyChangeState_None; // Indicate packet lost |
131 usb_device_software_reset(); | |
131 return; | 132 return; |
132 } | 133 } |
133 yield(); | 134 yield(); |
134 } | 135 } |
136 | |
137 transmit_previous_timeout = 0; | |
135 | 138 |
136 // Pointer to USB tx packet buffer | 139 // Pointer to USB tx packet buffer |
137 uint8_t *tx_buf = tx_packet->buf; | 140 uint8_t *tx_buf = tx_packet->buf; |
138 | 141 |
139 // Check system control keys | 142 // Check system control keys |