Re: USB HID Telephony Device

作者 misteryao 於 2017年06月30日 10:49:20
usb_headset 看起來好像不是HID 的裝置,因為沒有看到類似HID的Descriptor
我現在做法是用keyboard 的範例來改,descriptor 用USB-IF 的Descriptor Tool 產生Telephony descriptor,然後直接替換掉Keyboard 範例原本的descriptor,載入後,電腦指認出是HID裝置,認不出是Telephony,Telephony Descriptor 如下
hid_kbd_report_desc = {
{
//0x95, 0x01, /*REPORT_COUNT (1)*/
0x05, 0x0B, /*USAGE_PAGE (Telephony Devices)*/
0x09, 0x01, /*USAGE (Phone)*/
0xA1, 0x01, /*COLLECTION (Application)*/
0x09, 0x07, /*USAGE (Programmable Button)*/
0xA1, 0x02, /*COLLECTION (Logical)*/
0x05, 0x09, /*USAGE_PAGE (Button)*/
0x19, 0x01, /*USAGE_MINIMUM (Button 1)*/
0x29, 0x06, /*USAGE_MAXIMUM (Button 6)*/
0x75, 0x03, /*REPORT_SIZE (3)*/
0x15, 0x01, /*LOGICAL_MINIMUM (1)*/
0x25, 0x06, /*LOGICAL_MAXIMUM (6)*/
0x81, 0x00, /*INPUT (Data,Ary,Abs)*/
0xC0, /*END_COLLECTION*/
0x05, 0x0B, /*USAGE_PAGE (Telephony Devices)*/
0x09, 0x06, /*USAGE (Telephony Key Pad)*/
0xA1, 0x02, /*COLLECTION (Logical)*/
0x05, 0x09, /*USAGE_PAGE (Button)*/
0x19, 0x01, /*USAGE_MINIMUM (Button 1)*/
0x29, 0x0C, /*USAGE_MAXIMUM (Button 12)*/
0x25, 0x0C, /*LOGICAL_MAXIMUM (12)*/
0x75, 0x04, /*REPORT_SIZE (4)*/
0x81, 0x00, /*INPUT (Data,Ary,Abs)*/
0xC0, /*END_COLLECTION*/
0x05, 0x0B, /*USAGE_PAGE (Telephony Devices)*/
0x09, 0x20, /*USAGE (Hook Switch)*/
0x09, 0x29, /*USAGE (Alternate Function)*/
0x09, 0x2C, /*USAGE (Conference)*/
0x09, 0x25, /*USAGE (Transfer)*/
0x09, 0x26, /*USAGE (Drop)*/
0x09, 0x23, /*USAGE (Hold)*/
0x09, 0x2B, /*USAGE (Speaker Phone)*/
0x25, 0x07, /*LOGICAL_MAXIMUM (7)*/
0x75, 0x03, /*REPORT_SIZE (3)*/
0x81, 0x00, /*INPUT (Data,Ary,Abs)*/
0x05, 0x0C, /*USAGE_PAGE (Consumer Devices)*/
0x09, 0xE0, /*USAGE (Volume)*/
0x15, 0xFF, /*LOGICAL_MINIMUM (-1)*/
0x25, 0x01, /*LOGICAL_MAXIMUM (1)*/
0x75, 0x02, /*REPORT_SIZE (2)*/
0x81, 0x02, /*INPUT (Data,Var,Abs)*/
0x75, 0x04, /*REPORT_SIZE (4)*/
0x81, 0x03, /*INPUT (Cnst,Var,Abs)*/
0x15, 0x00, /*LOGICAL_MINIMUM (0)*/
0x25, 0x01, /*LOGICAL_MAXIMUM (1)*/
0x05, 0x08, /*USAGE_PAGE (LEDs)*/
0x09, 0x3A, /*USAGE (Usage Selected Indicator)*/
0xA1, 0x02, /*COLLECTION (Logical)*/
0x05, 0x0B, /*USAGE_PAGE (Telephony Devices)*/
0x09, 0x07, /*USAGE (Programmable Button)*/
0xA1, 0x02, /*COLLECTION (Logical)*/
0x05, 0x09, /*USAGE_PAGE (Button)*/
0x19, 0x01, /*USAGE_MINIMUM (Button 1)*/
0x29, 0x02, /*USAGE_MAXIMUM (Button 2)*/
0x95, 0x02, /*REPORT_COUNT (2)*/
0x91, 0x02, /*OUTPUT (Data,Var,Abs)*/
0xC0, /*END_COLLECTION*/
0xC0, /*END_COLLECTION*/
0x05, 0x08, /*USAGE_PAGE (LEDs)*/
0x09, 0x3B, /*USAGE (Usage In Use Indicator)*/
0xA1, 0x02, /*COLLECTION (Logical)*/
0x05, 0x0B, /*USAGE_PAGE (Telephony Devices)*/
0x09, 0x07, /*USAGE (Programmable Button)*/
0xA1, 0x02, /*COLLECTION (Logical)*/
0x05, 0x09, /*USAGE_PAGE (Button)*/
0x19, 0x01, /*USAGE_MINIMUM (Undefined)*/
0x29, 0x06, /*USAGE_MAXIMUM (Undefined)*/
0x95, 0x06, /*REPORT_COUNT (6)*/
0x91, 0x02, /*OUTPUT (Data,Var,Abs)*/
0xC0, /*END_COLLECTION*/
0x05, 0x0B, /*USAGE_PAGE (Telephony Devices)*/
0x09, 0x29, /*USAGE (Alternate Function)*/
0x95, 0x01, /*REPORT_COUNT (1)*/
0x91, 0x02, /*OUTPUT (Data,Var,Abs)*/
0xC0, /*END_COLLECTION*/
0x05, 0x08, /*USAGE_PAGE (LEDs)*/
0x09, 0x3C, /*USAGE (Usage Multi Mode Indicator)*/
0xA1, 0x02, /*COLLECTION (Logical)*/
0x05, 0x0B, /*USAGE_PAGE (Telephony Devices)*/
0x09, 0x73, /*USAGE (Message)*/
0xA1, 0x02, /*COLLECTION (Logical)*/
0x05, 0x08, /*USAGE_PAGE (LEDs)*/
0x09, 0x3D, /*USAGE (Indicator On)*/
0x09, 0x40, /*USAGE (Indicator Fast Blink)*/
0x09, 0x41, /*USAGE (Indicator Off)*/
0x75, 0x02, /*REPORT_SIZE (2)*/
0x91, 0x00, /*OUTPUT (Data,Ary,Abs)*/
0xC0, /*END_COLLECTION*/
0xC0, /*END_COLLECTION*/
0x75, 0x05, /*REPORT_SIZE (5)*/
0x81, 0x03, /*INPUT (Cnst,Var,Abs)*/
0xC0 /*END_COLLECTION*/
}
};

來自: http://www.microchip.com.tw/newbb/viewtopic.php?forum=7&topic_id=21078&post_id=75774