hid.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * File : hid.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2011, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2011-12-12 Yi Qiu first version
  13. */
  14. #ifndef __HID_H__
  15. #define __HID_H__
  16. #include <rtthread.h>
  17. struct uhid
  18. {
  19. upipe_t pipe_in;
  20. rt_uint8_t buffer[8];
  21. uprotocal_t protocal;
  22. };
  23. typedef struct uhid uhid_t;
  24. #define USB_REQ_GET_REPORT 0x01
  25. #define USB_REQ_GET_IDLE 0x02
  26. #define USB_REQ_GET_PROTOCOL 0x03
  27. #define USB_REQ_SET_REPORT 0x09
  28. #define USB_REQ_SET_IDLE 0x0a
  29. #define USB_REQ_SET_PROTOCOL 0x0b
  30. #define USB_HID_KEYBOARD 1
  31. #define USB_HID_MOUSE 2
  32. rt_err_t rt_usbh_hid_set_idle(struct uintf* intf, int duration, int report_id);
  33. rt_err_t rt_usbh_hid_get_report(struct uintf* intf, rt_uint8_t type, rt_uint8_t id, rt_uint8_t *buffer, rt_size_t size);
  34. rt_err_t rt_usbh_hid_set_report(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size);
  35. rt_err_t rt_usbh_hid_set_protocal(struct uintf* intf, int protocol);
  36. rt_err_t rt_usbh_hid_get_report_descriptor(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size);
  37. rt_err_t rt_usbh_hid_protocal_register(uprotocal_t protocal);
  38. #endif