USB HID Tanışma faslının bittiğini nasıl anlıyoruz

Başlatan z, 01 Temmuz 2012, 18:43:56

acemi2010

Tekrar merhaba;
Problemi yanlış anlamışım, ancak halen anlayabildiğimi sanmıyorum;
Hocam PC cihaza SET_CONFIGURATION komutunu gönderdikten sonra (HID Class) SET_IDLE (sonsuz süreli idle) komutu gönderir, ki bu komut da enumerasyonun tamamlandığının bir işaretidir aslında. Hemen ardından PC cihazdan HID Report descriptoru ister.
Cihaz bu descriptoru göndermeyi tamamlar tamamlamaz PC cihaza, descriptorlerde belirtilmiş periotlar ile inturrupt IN paketleri göndererek reportları talep eder.

1) Eğer HID class SET_IDLE komutu gelmiyorsa enumerasyonun tamamlanmasında bir sorun olmuştur. Cihaz tarafında bu komutun alınıp alınmadığı kontrol edilebilir.
2) HID Report descriptor PC'ye transfer edildikten sonra, descriptorlerde belirlediğimiz periodlarla Interrupt IN paketleri cihaza gelmelidir; bunu da watch dog timer metoduna benzer bir yöntem ile  kontrol edilebilir.
3) Interrupt endpoint EP0'dan farklı olacak; PC, EP0 üzerinden enumerasyonun tamamlandığına dair 3-4 byte'lık kontrol transfer ile tamamlandı bilgisi gönderebilir.

Saygılarımla
Timuçin

http://www.usbmadesimple.co.uk/ums_5.htm
Alıntı Yap
The host has then sent the Set Configuration request, and from that point in time, the device is 'configured' and is able to perform its purpose in life. The host is now able to send the HID class request 'Set Idle', to tell the device only to respond to an interrupt IN transaction if a new event occurs. (In any case when an IN request is sent and there is no change to report, the device will respond with a NAK packet.

Jan Amcanın kitabından alıntı;
Alıntı Yap
Set_Idle
Purpose: Saves bandwidth by limiting the reporting frequency of an inter- rupt IN endpoint when the data hasn't changed since the last report.

Request Number (bRequest): 0Ah Source of Data: no Data stage Data Length (wLength): no Data stage Contents of wValue field: The high byte sets the duration, or the maxi- mum amount of time between reports. A value of zero means that the HID will send a report only when the report data has changed. The low byte indicates the report ID that the request applies to. If the low byte is zero, the request applies to all of the HID's Input reports.

Contents of wIndex field: the number of the interface that supports this request.

Contents of data packet in the Data stage: no Data stage.

Comments: The duration is in units of 4 milliseconds, which gives a range of 4 to 1,020 milliseconds. No matter what the duration value is, if the report data has changed since the last Input report sent, on receiving an interrupt IN token packet, the HID sends a report. If the data hasn't changed and the duration time hasn't elapsed since the last report, the HID returns NAK. If the data hasn't changed and the duration time has elapsed since the last report, the HID sends a report. A duration value of zero indi- cates an infinite duration: the HID sends a report only if the report data has changed and responds to all other interrupt IN requests with NAK. If the HID returns a STALL in response to this request, the HID can send reports whether or not the data has changed. On enumerating a HID, the Windows HID driver attempts to set the idle rate to zero. The HID should Stall this request if an infinite Idle duration isn't wanted! HIDs aren't required to support this request except for keyboards using the boot proto- col.