gpt4 book ai didi

ios - 蓝牙 LE HID 弹出键代码?

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:46:33 39 4
gpt4 key购买 nike

我正在实现一个基于 TI 蓝牙 LE HID 示例的加密狗,它需要恢复或禁用键盘功能。在 iOS 设备上使用 Apple 键盘时,按下弹出按钮将启用/禁用设备,隐藏/显示键盘。

大多数引用资料都说弹出按钮没有键码,尽管有人将其列为 161;这在从蓝牙 LE 设备使用时不起作用。从键盘发送到设备以完成此操作的键代码是什么?

当然,我假设蓝牙 LE 设备将发送与蓝牙设备相同的键码,并且 Apple 的蓝牙 LE HID 实现包括隐藏和恢复键盘的功能。如果其中一个假设不正确,那也会有所帮助。

最佳答案

我已经使用以下报告映射成功地使用 Nordic Semiconductor 的 nRF51822 和 S110:

static uint8_t report_map_data[] =
{
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x06, // Usage (Keyboard)
0xA1, 0x01, // Collection (Application)
0x85, 0x01, // Report Id (1)
0x05, 0x07, // Usage Page (Key Codes)
0x19, 0xe0, // Usage Minimum (224)
0x29, 0xe7, // Usage Maximum (231)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x08, // Report Count (8)
0x81, 0x02, // Input (Data, Variable, Absolute)

0x95, 0x01, // Report Count (1)
0x75, 0x08, // Report Size (8)
0x81, 0x01, // Input (Constant) reserved byte(1)

0x95, 0x05, // Report Count (5)
0x75, 0x01, // Report Size (1)
0x05, 0x08, // Usage Page (Page# for LEDs)
0x19, 0x01, // Usage Minimum (1)
0x29, 0x05, // Usage Maximum (5)
0x91, 0x02, // Output (Data, Variable, Absolute), Led report
0x95, 0x01, // Report Count (1)
0x75, 0x03, // Report Size (3)
0x91, 0x01, // Output (Data, Variable, Absolute), Led report padding

0x95, 0x06, // Report Count (6)
0x75, 0x08, // Report Size (8)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x65, // Logical Maximum (101)
0x05, 0x07, // Usage Page (Key codes)
0x19, 0x00, // Usage Minimum (0)
0x29, 0x65, // Usage Maximum (101)
0x81, 0x00, // Input (Data, Array) Key array(6 bytes)

0x09, 0x05, // Usage (Vendor Defined)
0x15, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x75, 0x08, // Report Count (2)
0x95, 0x02, // Report Size (8 bit)
0xB1, 0x02, // Feature (Data, Variable, Absolute)

0xC0, // End Collection (Application)
// Report ID 2: Advanced buttons
0x05, 0x0C, // Usage Page (Consumer)
0x09, 0x01, // Usage (Consumer Control)
0xA1, 0x01, // Collection (Application)
0x85, 0x02, // Report Id (2)
0x15, 0x00, // Logical minimum (0)
0x25, 0x01, // Logical maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x01, // Report Count (1)

0x0A, 0xAE, 0x01, // Usage (AL Keyboard Layout)
0x81, 0x06, // Input (Data,Value,Relative,Bit Field)
0xC0 // End Collection
};

有了这个报告 map ,我就可以用这个发送一个切换:

static void toggle_send(void)
{
uint32_t err_code;

uint8_t release = 0;
uint8_t keyboard_toggle = 0x01;

// 1 designates the report index, not report ID.
err_code = ble_hids_inp_rep_send(&m_hids, 1, sizeof(keyboard_toggle), &keyboard_toggle);
APP_ERROR_CHECK(err_code);

err_code = ble_hids_inp_rep_send(&m_hids, 1, sizeof(release), &release);
APP_ERROR_CHECK(err_code);
}

我不太了解 TI API,但我希望这对您有所帮助。如果您也可以访问该芯片,则上述修改应该很容易添加到常规 nRF51 SDK 中的 ble_app_hids_keyboard。

关于ios - 蓝牙 LE HID 弹出键代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22181883/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com