wwjmaomao
驱动牛犊
驱动牛犊
  • 注册日期2003-07-07
  • 最后登录2004-06-07
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1542回复:1

HI,大家好,问大家一个关于HID设备report descriptor 的问题

楼主#
更多 发布于:2004-01-09 20:47
该设备现在处于能写,不能读的状态,应用程序如下后:
Result = ReadFile (ReadHandle,
InputReport,
Capabilities.InputReportByteLength,
&NumberOfBytesRead,
(LPOVERLAPPED) &HIDOverlapped);

cout<<\"ReadFile: \"<<GetLastError()<<endl ;
总是TIMEOUT,为什么,盼大家给予指点。
BTW:CREATEFILE 和WRITEFILE 都正常。偶怀疑是FIRMWARE中report descriptor 的问题,但又不明白哪里除了问题,谁能给偶一些提示。

DSCR_DEVICE equ 1;; Descriptor type: Device
DSCR_CONFIG equ 2;; Descriptor type: Configuration
DSCR_STRING equ 3;; Descriptor type: String
DSCR_INTRFC equ 4;; Descriptor type: Interface
DSCR_ENDPNT equ 5;; Descriptor type: Endpoint

ET_CONTROL equ 0;; Endpoint type: Control
ET_ISO equ 1;; Endpoint type: Isochronous
ET_BULK equ 2;; Endpoint type: Bulk
ET_INT equ 3;; Endpoint type: Interrupt

public DeviceDscr, ConfigDscr, StringDscr, UserDscr, HIDDscr, ReportDscr, ReportDscrEnd

DSCR SEGMENT CODE

;;-----------------------------------------------------------------------------
;; Global Variables
;;-----------------------------------------------------------------------------
;; Note: This segment must be located in on-part memory.
rseg DSCR;; locatethedescriptortableanywherebelow 8K
DeviceDscr:db deviceDscrEnd-DeviceDscr;; Descriptor length
db DSCR_DEVICE ;; Decriptor type
dw 1001H ;; Specification Version (BCD)
db 00H ;; Device class
db 00H ;; Device sub-class
db 00H ;; Device sub-sub-class
db 40H ;; Maximum packet size
dw 0B404H ;; Vendor ID
dw 0255H ;; Product ID
dw 0100H ;; Product version ID
db 1 ;; Manufacturer string index
db 2 ;; Product string index
db 0 ;; Serial numberstring index
db 1 ;; Number of configurations
deviceDscrEnd:

ConfigDscr:db ConfigDscrEnd-ConfigDscr;; Descriptor length
db DSCR_CONFIG ;; Descriptor type
db StringDscr-ConfigDscr;;Configuration+End
;; Points length (LSB)
db (StringDscr-ConfigDscr)/256 ;; Configuration
;;+ End Points length (MSB)
db 1 ;; Number of interfaces
db 1 ;; Interface number
db 0 ;; Configuration string
db 10000000b;; Attributes (b7 - buspwr, b6 -
;;selfpwr, b5 - rwu)
db 0FAH ;; Power requirement (div 2 ma)
ConfigDscrEnd:

IntrfcDscr:
db IntrfcDscrEnd-IntrfcDscr;; Descriptor length
db DSCR_INTRFC ;; Descriptor type
db 0 ;; Zero-based index of this interface
db 0 ;; Alternate setting
db 2 ;; Number of end points
db 03H ;; Interface class (HID)
db 00H ;; Interface sub class
db 00H ;; Interface sub sub class
db 05H ;; Interface descriptor string index
IntrfcDscrEnd:

HIDDscr:
db 09h ;; length
db 21h ;; type: HID
dw 1001h ;; release: HID class rev 1.1
db 00h ;; country code (USA)
db 01h;; number of HID class descriptors tofollow
db 22h ;; report descriptor type (HID)
db (ReportDscrEnd-ReportDscr);;lengthofHID descriptor
db 00h
HIDDscrEnd:

Ep1InDscr:
db Ep1InDscrEnd-Ep1InDscr;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 81H ;; Endpoint number, and direction
db ET_INT ;; Endpoint type
db 40H ;; Maximum packet size (LSB)
db 00H ;; Max packet size (MSB)
db 1 ;; Polling interval (ms)
Ep1InDscrEnd:

Ep2OutDscr:
db Ep2OutDscrEnd-Ep2OutDscr;; Descriptor length
db DSCR_ENDPNT ;; Descriptor type
db 02H;; Endpoint number, and direction
db ET_INT ;; Endpoint type
db 40H ;; Maximum packet size (LSB)
db 00H ;; Max packet size (MSB)
db 1 ;; Polling interval (ms)
Ep2OutDscrEnd:

ReportDscr:
db 06h, 0A0h, 0FFh ;; Usage Page (FFA0H = vendor defined)
db 09h, 01h ;; Usage (vendor defined)
db 0A1h, 01h ;; Collection (Application)
;; The input report
db 09h, 01h ;; Usage (vendor defined)
db 15h, 00h ;; Logical minimum (0)
db 25h, 0FFh ;; Logical maximum (255)
db 75h, 08h ;; Report size (8 bits)
db 95h, 40h ;; Report count (64 fields)
db 81h, 02h;; Input (Data, variable, absolute)
;; The output report
db 09h, 02h ;; Usage (vendor defined)
db 75h, 08h ;; Report size (8 bits)
db 95h, 40h ;; Report count (64 fields)
db 91h, 02h;; Output (Data, Variable, Absolute)
;; The feature report
db 09h, 03h;; Usage Page (vendor defined)
db 75h, 08h ;; Report size (8 bits)
db 95h, 05h ;; Report count (5 fields)
db 0B1h, 02h;; Output (Data, variable, absolute)

db 0C0h ;; End Collection
ReportDscrEnd:



 
junki
驱动牛犊
驱动牛犊
  • 注册日期2004-09-02
  • 最后登录2007-11-30
  • 粉丝0
  • 关注0
  • 积分124分
  • 威望13点
  • 贡献值0点
  • 好评度10点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2005-03-31 10:59
db 15h, 81h ;; Logical minimum (-127)
db 25h, 07Fh ;; Logical maximum (127)
游客

返回顶部