[FL-2159] BadUSB alt codes (#935)

* badusb: alt code commands
* badusb: demo script update
* usb hid: consumer control descriptor
* BadUsb: remove dangerous type casting, rename variable to match codding style guide

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Nikolay Minaylov
2022-01-02 20:34:39 +03:00
committed by GitHub
parent 5b1f50e63a
commit 1202f9b82d
10 changed files with 483 additions and 214 deletions

View File

@@ -255,6 +255,13 @@ typedef void (*HidStateCallback)(bool state, void* context);
/** ASCII to keycode conversion macro */
#define HID_ASCII_TO_KEY(x) (((uint8_t)x < 128) ? (hid_asciimap[(uint8_t)x]) : KEY_NONE)
/** HID keyboard leds */
enum HidKeyboardLeds {
HID_KB_LED_NUM = (1 << 0),
HID_KB_LED_CAPS = (1 << 1),
HID_KB_LED_SCROLL = (1 << 2),
};
/** HID mouse buttons */
enum HidMouseButtons {
HID_MOUSE_BTN_LEFT = (1 << 0),
@@ -268,6 +275,12 @@ enum HidMouseButtons {
*/
bool furi_hal_hid_is_connected();
/** Get USB HID keyboard leds state
*
* @return leds state
*/
uint8_t furi_hal_hid_get_led_state();
/** Set USB HID connect/disconnect callback
*
* @param cb callback
@@ -316,3 +329,15 @@ bool furi_hal_hid_mouse_release(uint8_t button);
* @param delta number of scroll steps
*/
bool furi_hal_hid_mouse_scroll(int8_t delta);
/** Set the following consumer key to pressed state and send HID report
*
* @param button key code
*/
bool furi_hal_hid_consumer_key_press(uint16_t button);
/** Set the following consumer key to released state and send HID report
*
* @param button key code
*/
bool furi_hal_hid_consumer_key_release(uint16_t button);