mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 03:35:20 +00:00
hid_device: add HID_SUBEVENT_VIRTUAL_CABLE_UNPLUG, fix HID suspend events
This commit is contained in:
parent
1ad99f3bd3
commit
acfd7ed247
@ -2892,17 +2892,25 @@ typedef uint8_t sm_key_t[16];
|
||||
/**
|
||||
* @format 12
|
||||
* @param subevent_code
|
||||
* @param con_handle
|
||||
* @param hid_cid
|
||||
*/
|
||||
#define HID_SUBEVENT_SUSPEND 0x04
|
||||
|
||||
/**
|
||||
* @format 12
|
||||
* @param subevent_code
|
||||
* @param con_handle
|
||||
* @param hid_cid
|
||||
*/
|
||||
#define HID_SUBEVENT_EXIT_SUSPEND 0x05
|
||||
|
||||
/**
|
||||
* @format 12
|
||||
* @param subevent_code
|
||||
* @param hid_cid
|
||||
*/
|
||||
#define HID_SUBEVENT_VIRTUAL_CABLE_UNPLUG 0x06
|
||||
|
||||
|
||||
|
||||
// HIDS Meta Event Group
|
||||
|
||||
|
@ -8658,22 +8658,32 @@ static inline uint16_t hid_subevent_can_send_now_get_hid_cid(const uint8_t * eve
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field con_handle from event HID_SUBEVENT_SUSPEND
|
||||
* @brief Get field hid_cid from event HID_SUBEVENT_SUSPEND
|
||||
* @param event packet
|
||||
* @return con_handle
|
||||
* @return hid_cid
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t hid_subevent_suspend_get_con_handle(const uint8_t * event){
|
||||
static inline uint16_t hid_subevent_suspend_get_hid_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field con_handle from event HID_SUBEVENT_EXIT_SUSPEND
|
||||
* @brief Get field hid_cid from event HID_SUBEVENT_EXIT_SUSPEND
|
||||
* @param event packet
|
||||
* @return con_handle
|
||||
* @return hid_cid
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t hid_subevent_exit_suspend_get_con_handle(const uint8_t * event){
|
||||
static inline uint16_t hid_subevent_exit_suspend_get_hid_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field hid_cid from event HID_SUBEVENT_VIRTUAL_CABLE_UNPLUG
|
||||
* @param event packet
|
||||
* @return hid_cid
|
||||
* @note: btstack_type 2
|
||||
*/
|
||||
static inline uint16_t hid_subevent_virtual_cable_unplug_get_hid_cid(const uint8_t * event){
|
||||
return little_endian_read_16(event, 3);
|
||||
}
|
||||
|
||||
|
@ -569,6 +569,10 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * pack
|
||||
case HID_CONTROL_PARAM_EXIT_SUSPEND:
|
||||
hid_device_emit_event(device, HID_SUBEVENT_EXIT_SUSPEND);
|
||||
break;
|
||||
case HID_CONTROL_PARAM_VIRTUAL_CABLE_UNPLUG:
|
||||
device->unplugged = true;
|
||||
hid_device_emit_event(device, HID_SUBEVENT_VIRTUAL_CABLE_UNPLUG);
|
||||
break;
|
||||
default:
|
||||
device->state = HID_DEVICE_W2_SEND_UNSUPPORTED_REQUEST;
|
||||
l2cap_request_can_send_now_event(device->control_cid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user