同樣的問(wèn)題,沒(méi)得到回復(fù)和解決,再發(fā)一遍

?代碼用的是論壇提供的參考代碼,之前一直都是和單純的鍵盤(pán)通信沒(méi)有問(wèn)題,用set_report也能正??刂芅UM LOCK,CAP LOCK燈。但換成復(fù)合鍵盤(pán)(兩個(gè)interface,兩個(gè)HID報(bào)告描述符)的鍵盤(pán)時(shí)就無(wú)法控制燈了,鍵盤(pán)倒是能正常工作,而且枚舉過(guò)程結(jié)束時(shí)set_report也成功點(diǎn)亮了NUM LOCK燈,但是僅此一次,之后再也控制不了燈了。請(qǐng)問(wèn)參考代碼是不是有需要改動(dòng)的地方?

????我看論壇提供的CH376控制鍵盤(pán)的代碼只能測(cè)試鍵盤(pán)按鍵的功能,對(duì)于set_report只是在枚舉完時(shí)用了一次,之后就沒(méi)有繼續(xù)測(cè)試了,


若未及時(shí)回復(fù)可電話聯(lián)系,025-52638373


你好:

????你的設(shè)備是復(fù)合類(lèi)設(shè)備,根據(jù)你的描述是有兩個(gè)接口,那么在獲取描述符中應(yīng)該得到兩個(gè)接口號(hào),在對(duì)鍵盤(pán)進(jìn)行點(diǎn)燈操作中需要進(jìn)行set_report控制傳輸,注意修改set_report控制幀命令。



這個(gè)復(fù)合鍵盤(pán)的鍵盤(pán)接口號(hào)是0,系統(tǒng)控制功能接口號(hào)是1。set_report發(fā)送的命令是0x21,0x09,0x00,0x02,0x00,0x00,0x01,0x00 看起來(lái)也沒(méi)錯(cuò)啊,的確是發(fā)給接口0了。或者您說(shuō)的修改set_report控制幀是有其他含義,我理解錯(cuò)了?


你好:

這樣看set_report發(fā)送的應(yīng)該沒(méi)有錯(cuò),可以將你這個(gè)符合鍵盤(pán)枚舉中獲取的描述符發(fā)來(lái)看看嗎?我想確認(rèn)一下這個(gè)鍵盤(pán)中的信息再分析原因。你可以單獨(dú)郵件給我cl@wch.cn.


Connection StatusDevice connectedCurrent Configuration1SpeedLow (1.5 Mbit/s)Device Address5Number Of Open Pipes2

Device Descriptor USB Keyboard

OffsetFieldSizeValueDescription0bLength112h
1bDescriptorType101hDevice2bcdUSB20110hUSB Spec 1.14bDeviceClass100hClass info in Ifc Descriptors5bDeviceSubClass100h
6bDeviceProtocol100h
7bMaxPacketSize0108h8 bytes8idVendor21C4Fh
10idProduct20026h
12bcdDevice20110h1.1014iManufacturer101h"SIGMACHIP"15iProduct102h"USB Keyboard"16iSerialNumber100h
17bNumConfigurations101h

Configuration Descriptor 1 Bus Powered, 98 mA

OffsetFieldSizeValueDescription0bLength109h
1bDescriptorType102hConfiguration2wTotalLength2003Bh
4bNumInterfaces102h
5bConfigurationValue101h
6iConfiguration100h
7bmAttributes1A0hBus Powered, Remote Wakeup
4..0: Reserved
...00000

5: Remote Wakeup
..1.....Yes
6: Self Powered
.0......No, Bus Powered
7: Reserved (set to one)
(bus-powered for 1.0)
1.......
8bMaxPower131h98 mA

Interface Descriptor 0/0 HID, 1 Endpoint

OffsetFieldSizeValueDescription0bLength109h
1bDescriptorType104hInterface2bInterfaceNumber100h
3bAlternateSetting100h
4bNumEndpoints101h
5bInterfaceClass103hHID6bInterfaceSubClass101hBoot Interface7bInterfaceProtocol101hKeyboard8iInterface100h

HID Descriptor

OffsetFieldSizeValueDescription0bLength109h
1bDescriptorType121hHID2bcdHID20110h1.104bCountryCode100h
5bNumDescriptors101h
6bDescriptorType122hReport7wDescriptorLength20036h54 bytes

Endpoint Descriptor 81 1 In, Interrupt, 10 ms

OffsetFieldSizeValueDescription0bLength107h
1bDescriptorType105hEndpoint2bEndpointAddress181h1 In3bmAttributes103hInterrupt
1..0: Transfer Type
......11Interrupt
7..2: Reserved
000000..
4wMaxPacketSize20008h8 bytes6bInterval10Ah10 ms

Interface Descriptor 1/0 HID, 1 Endpoint

OffsetFieldSizeValueDescription0bLength109h
1bDescriptorType104hInterface2bInterfaceNumber101h
3bAlternateSetting100h
4bNumEndpoints101h
5bInterfaceClass103hHID6bInterfaceSubClass100h
7bInterfaceProtocol100h
8iInterface100h

HID Descriptor

OffsetFieldSizeValueDescription0bLength109h
1bDescriptorType121hHID2bcdHID20110h1.104bCountryCode100h
5bNumDescriptors101h
6bDescriptorType122hReport7wDescriptorLength20032h50 bytes

Endpoint Descriptor 82 2 In, Interrupt, 10 ms

OffsetFieldSizeValueDescription0bLength107h
1bDescriptorType105hEndpoint2bEndpointAddress182h2 In3bmAttributes103hInterrupt
1..0: Transfer Type
......11Interrupt
7..2: Reserved
000000..
4wMaxPacketSize20003h3 bytes6bInterval10Ah10 ms

Interface 0 HID Report Descriptor Keyboard

Item Tag (Value)Raw DataUsage Page (Generic Desktop)05 01Usage (Keyboard)09 06Collection (Application)A1 01Usage Page (LEDs)05 08Usage Minimum (Num Lock)19 01Usage Maximum (Scroll Lock)29 03Logical Minimum (0)15 00Logical Maximum (1)25 01Report Size (1)75 01Report Count (3)95 03Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)91 02Report Count (5)95 05Output (Cnst,Ary,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)91 01Usage Page (Keyboard/Keypad)05 07Usage Minimum (Keyboard Left Control)19 E0Usage Maximum (Keyboard Right GUI)29 E7Report Count (8)95 08Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)81 02Report Size (8)75 08Report Count (1)95 01Input (Cnst,Ary,Abs)81 01Usage Minimum (Undefined)19 00Usage Maximum (Keyboard LANG2)29 91Logical Maximum (255)26 FF 00Report Count (6)95 06Input (Data,Ary,Abs)81 00End CollectionC0

Interface 1 HID Report Descriptor Consumer Control

Item Tag (Value)Raw DataUsage Page (Consumer Devices)05 0CUsage (Consumer Control)09 01Collection (Application)A1 01Report ID (1)85 01Usage Minimum (Undefined)19 00Usage Maximum (AC Format)2A 3C 02Logical Minimum (0)15 00Logical Maximum (572)26 3C 02Report Count (1)95 01Report Size (16)75 10Input (Data,Ary,Abs)81 00End CollectionC0Usage Page (Generic Desktop)05 01Usage (System Control)09 80Collection (Application)A1 01Report ID (2)85 02Usage Minimum (System Power Down)19 81Usage Maximum (System Wake Up)29 83Logical Maximum (1)25 01Report Size (1)75 01Report Count (3)95 03Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)81 02Report Count (5)95 05Input (Cnst,Ary,Abs)81 01End CollectionC0



嗨,鍵盤(pán)枚舉的信息已發(fā),這是一款惠普的鍵盤(pán),同樣的問(wèn)題雙飛燕的也有,因?yàn)樗麄兌际悄欠N兩個(gè)接口兩個(gè)報(bào)告描述符的鍵盤(pán),因此都面臨著只能使用鍵盤(pán)而不能控制LED燈的情況,不過(guò)在枚舉結(jié)束完成后的那一下set_report倒是都把燈點(diǎn)亮了。


你好:

????例程中的set_report在枚舉執(zhí)行一次用來(lái)點(diǎn)燈,后面操作ch376點(diǎn)燈步驟其實(shí)一樣,如果不是主機(jī)主動(dòng),是鍵盤(pán)按鍵提示點(diǎn)燈,那么set_report這條命令其實(shí)應(yīng)該是在按鍵按下和抬起兩條中斷傳輸之間進(jìn)行一次控制傳輸。從你描述符中看鍵盤(pán)接口是0,那么set_report命令的數(shù)據(jù)段就是之前的,不用改。

你可以使用抓包工具看一下電腦操作鍵盤(pán)點(diǎn)燈的數(shù)據(jù)傳輸過(guò)程,然后修改ch376控制鍵盤(pán)點(diǎn)燈操作。應(yīng)該是軟件上處理的問(wèn)題。


只有登錄才能回復(fù),可以選擇微信賬號(hào)登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频