usbkvm_fw.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. usbkvm_fw.h
  3. Author: tobychui
  4. */
  5. #ifndef _usbkvm_
  6. #define _usbkvm_
  7. /* Hardware Configurations */
  8. #define MIN_KEY_EVENTS_DELAY 20 //ms
  9. #define LED_RW_SIG 16
  10. #define USB_SW_SEL 32
  11. /* Operation Types */
  12. #define OPR_TYPE_RESERVED 0x00 // Reserved
  13. #define OPR_TYPE_KEYBOARD_WRITE 0x01 // Keyboard-related operation
  14. #define OPR_TYPE_MOUSE_WRITE 0x02 // Mouse-related operation
  15. #define OPR_TYPE_MOUSE_MOVE 0x03 // Mouse-move operation (Notes: When opr_type is OPR_TYPE_MOUSE_MOVE, opr_subtype is the X position value)
  16. #define OPR_TYPE_MOUSE_SCROLL 0x04 //Mouse scroll (Notes: when opr_type is OPR_TYPE_MOUSE_SCROLL, opr_subtype is up/down and payload is scroll tilt valie (max 127))
  17. #define OPR_TYPE_SWITCH_WRITE 0x05 // Switch/button operation
  18. #define OPR_TYPE_LED_WRITE 0x06 // LED control operation
  19. #define OPR_TYPE_RESET_INSTR_COUNT 0xFE // Reset instruction counter
  20. #define OPR_TYPE_DATA_RESET 0xFF //Reset opr data queue, if state of device is unknown, clear before use
  21. /* Operation Sub-types */
  22. #define SUBTYPE_RESERVED 0x00
  23. /* Keyboard Subtypes */
  24. #define SUBTYPE_KEYBOARD_ASCII_WRITE 0x01 // Write ASCII characters (32-127)
  25. #define SUBTYPE_KEYBOARD_ASCII_PRESS 0x02 // Press a key (ASCII 32-127)
  26. #define SUBTYPE_KEYBOARD_ASCII_RELEASE 0x03 // Release a key (ASCII 32-127)
  27. #define SUBTYPE_KEYBOARD_MODIFIER_SET 0x04 // Modifier key write (bit flags)
  28. #define SUBTYPE_KEYBOARD_MODIFIER_CLEAR 0x05 // Modifier key press (bit flags)
  29. #define SUBTYPE_KEYBOARD_FUNCTKEY_WRITE 0x06 //Function key write
  30. #define SUBTYPE_KEYBOARD_OTHERKEY_PRESS 0x07 //Other keys press
  31. #define SUBTYPE_KEYBOARD_OTHERKEY_RELEASE 0x08 //Other keys release
  32. #define SUBTYPE_KEYBOARD_SPECIAL_CTRLALTDEL 0xFD //Ctrl + Alt + Del
  33. #define SUBTYPE_KEYBOARD_SPECIAL_RESET 0xFE //Reset all keypress state
  34. #define SUBTYPE_KEYBOARD_SPECIAL_RESERVED 0xFF //Reserved
  35. /* Mouse Subtypes */
  36. #define SUBTYPE_MOUSE_CLICK 0x01 //Mouse button click
  37. #define SUBTYPE_MOUSE_PRESS 0x02 //Mouse button press
  38. #define SUBTYPE_MOUSE_RELEASE 0x03 //Mouse button release
  39. #define SUBTYPE_MOUSE_SETPOS 0x04 //Mouse presets position
  40. #define SUBTYPE_MOUSE_RESET 0x05 //Reset all mouse button states
  41. /* Mouse Buttons ID */
  42. #define PAYLOAD_MOUSE_BTN_LEFT 0x01
  43. #define PAYLOAD_MOUSE_BTN_RIGHT 0x02
  44. #define PAYLOAD_MOUSE_BTN_MID 0x03
  45. /* Response Codes */
  46. #define resp_ok 0x00
  47. #define resp_unknown_opr 0x01
  48. #define resp_invalid_opr_type 0x02
  49. #define resp_invalid_key_value 0x03
  50. #define resp_not_implemented 0x04
  51. /* Debug */
  52. #define resp_start_of_info_msg 0xED
  53. #define resp_end_of_msg 0xEF
  54. #endif