diff options
author | Zach Eveland <zeveland@blacklabel-development.com> | 2011-08-30 17:25:35 -0400 |
---|---|---|
committer | Zach Eveland <zeveland@blacklabel-development.com> | 2011-08-30 17:25:35 -0400 |
commit | df068274f4a383ce6c944168ce41f859f3bc22c9 (patch) | |
tree | 91398691bd927d908b8a879910a51ce9108c220d /cores/arduino/HID.cpp | |
parent | af635024db2b5d46d57eb5f5da959f6b4f4bf42c (diff) |
on a CDC or HID write() error, call setWriteError(). better handling of USB_Send errors in CDC.
Diffstat (limited to 'cores/arduino/HID.cpp')
-rw-r--r-- | cores/arduino/HID.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cores/arduino/HID.cpp b/cores/arduino/HID.cpp index cea90fc..e3aadb5 100644 --- a/cores/arduino/HID.cpp +++ b/cores/arduino/HID.cpp @@ -398,11 +398,15 @@ size_t Keyboard_::write(uint8_t c) _keyMap->charToKey(c,&keys); else { - if (c >= 128) + if (c >= 128) { + setWriteError(); return 0; + } c = pgm_read_byte(_asciimap + c); - if (!c) + if (!c) { + setWriteError(); return 0; + } if (c & 0x80) { keys.modifiers |= KEY_MODIFIER_LEFT_SHIFT; |