Author Topic: Report ID usage precisions  (Read 23016 times)

gbr

  • Member
  • ***
  • Posts: 23
Report ID usage precisions
« on: June 11, 2010, 12:03:55 pm »
The best way to introduce my problem is to post a copy of the Email I sent you to day and to which you answered super quickly the same day

COPY
Hi Jan,
 
Sorry to worry you.
 
I cannot find the old framework to go with your example for the Pic4550(report ID1/2)
 
Alternatively,
 
It has all to see about the Report ID(using a working joystick of 6 axis + one set of 8 buttons)
I am trying to implement 2 simple report IDs (1 and 2) as a testing ground
 
I cannot find the place where the Host decides the lenght of the report it wants
 
If I set two report IDs say one of 6 bytes (all the axis)
                                    one of 1 byte   ( the button byte)
 
I can get the first one (using the lenght of 7 (one for the report ID).. Axis are working on windows control pannel games controller
but I cannot find where Windows ask for the second report
otherwise it would be easy to set it up
 
If I try to request 9 bytes , hoping that windows(the Host) will sort it out , the thing stops working
 
I have tried to follow the passage of the program by using LEDs
It show a constant passage on the correct HID service
but at this place there is no way to get the report ID ( I have tried it is not in the wValue I always get 0  (default) )

Contents of wValue field: The high byte contains the report type

(1=Input, 3=Feature), and the low byte contains the report ID. The default

report ID is zero.
I suspect that the setup is made once only at start up but I cannot find where
My problem is compouded by the use of PicMicrocontroller IDE from Oshonsoft (I can barely  digest C compilers)
I work only in ASM
 
Reading from your book about your example ,  the explanations are simple and straight forward (as usual with your way of explaining things)
 
BUT it does not explain where the REPORT IDs are generated or found
(I tried to find them in the Microchip new stack but no go)
I have inquired on different forums but have received no reply about this
Should you be interested to help I can give you a full run down on what I hope to accomplish.
It could be published on the forum if you so desire
Note that I had a lot of help from Tnuneo about using Joystick combined with Key entry
but the help has dried out ,maybe I ask too much ...?
 
Best regards and thank you  for your valuable contribution to the spreading of USB and other(I have a few of your books)
 
G B
(logged as gbr at Microchip forum)
END of COPY

Obviously the problem is not fully described and will be detailed fully ,with code ,if you think that it would be of any interest to the community.



Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Report ID usage precisions
« Reply #1 on: June 11, 2010, 02:52:26 pm »
Thank you for posting to the forum.

For Input reports sent via interrupt transfers, the device decides what to send. If using ReadFile on the host, the report buffer should be at least large enough to hold the longest report + 1 byte for the report ID.

If using control transfers. HidD_GetFeature's or HidD_GetInputReport's ReportBuffer parameter contains the desired report ID. The device firmware must retrieve the received report ID and use it to decide which report to send.

Jan

gbr

  • Member
  • ***
  • Posts: 23
Re: Report ID usage precisions
« Reply #2 on: June 15, 2010, 12:08:22 pm »
Jan,
Thank you for your answer,but it does not reply really to my main question ,which is ,sorry for creating a misunderstanding, ::::

Where is the mechanism created for having the host requesting 2 different reports ,namely, report ID 1 and report ID 2.
(when the report descriptor stipulates 2 Reports IDs)


I have sorted out the reason why I could not get your example going .
It was because I was using the stack on a drive that was not the C drive.
Having looked at it ,I found out that it was not using 2 reports IDs and therefore did not cater for Report ID other than 0.

I have looked everywhere and have not found a single example where 2 reports IDs were used on PIC micros(I have seen some for other processors but it is obviousely no help to me as I use Pic 18 exclusively.

It is also possible that I misunderstand the works of the USB .....,most probably ,in which case I will go back to my readings...

gb

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Report ID usage precisions
« Reply #3 on: June 15, 2010, 02:03:43 pm »
If you want to know how the device determines what report to send, the report ID is in wValue of the Get_Report request. See 7.2.1 in the HID spec. If using interrupt transfers, the device decides which report to send.

Jan

gbr

  • Member
  • ***
  • Posts: 23
Re: Report ID usage precisions
« Reply #4 on: June 30, 2010, 08:19:31 am »
The real correct answer to that question was never answered in the right context

The question was in details 

I have tried to follow the passage of the program by using LEDs
It show a constant passage on the correct HID service
but at this place there is no way to get the report ID ( I have tried it is not

in the wValue I always get 0  (default) )

Contents of wValue field: The high byte contains the report type

(1=Input, 3=Feature), and the low byte contains the report ID. The default

report ID is zero.
I suspect that the setup is made once only at start up but I cannot find where
My problem is compouded by the use of PicMicrocontroller IDE from Oshonsoft (I

can barely  digest C compilers)
I work only in ASM
 
Reading from your book about your example ,  the explanations are simple and

straight forward (as usual with your way of explaining things)
 
BUT it does not explain where the REPORT IDs are generated or found


I now stand corrected as I finally found the answer IN YOUR BOOK !!!
in the following passage

Quote :Page 363
"
For Input reports when there are multiple Input Report IDs, THE HOST's
DRIVER HAS NO WAY TO REQUEST A SPECIFIC REPORT from the HID.
 On receiving the IN token packet, the device returns whatever report is in its buffer. In
other words, the device firmware decides which report to send. At the host,
the HID driver stores the received report and its report ID in a buffer.
"
Unquote


That is exactly in line with the difficulties I experienced

I SIMPLY toggle between the reports pointers,sendind one then the other
and it works perfectly .


I/e
 
bytes in buffer in bank 0

ID#1, Data1,Data2,Data3,Data4..DataX,ID#2,Data1,Data2,Data3End of data
Code: [Select]
;Sending to USB Buffer

   btfsc   Report_ID,0,0   ; if 0 use 1
   bra     WritingLoop2   ; if not 0 use 2

WritingLoop1:
   MOVLW   _write         ;Beginning of Report in Bank 0
   MOVLB   0
   MOVWF   HID_Write+0, 1
   MOVLW   0;
   MOVWF   HID_Write+1, 1
   MOVLW   HID_EP1_IN_REPORT_BYTES ; Number of bytes
   MOVWF   HID_Write+2, 1   ;
   CALL   _HID_Write   
   MOVF   Hack0, 1, 0
   BZ   WritingLoop1      ; Done is 1
   BsF   Report_ID,0      ; Set bit for next report = 2
   BRA   main_loop      ; get data and wait for next request

WritingLoop2:
   ; The offset is nb of bytes report 1+1
   MOVLW   _write+OFFSET         ;Beginning + OFFSET
   MOVLB   0
   MOVWF   FARG_HID_Write+0, 1
   MOVLW   0;@_write no
   MOVWF   FARG_HID_Write+1, 1

   MOVLW   HID_EP1_IN_REPORT_BYTES ; Number of bytes
   MOVWF   FARG_HID_Write+2, 1   ; into
   CALL   _HID_Write
   MOVF   STACK0, 1, 0
   BZ   WritingLoop2
   BcF   Report_ID,0      ; Set for Report 1
   BRA   main_loop

Many thanks for your help from every quarter.
I have learned plenty due to this problem.

gb




Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Report ID usage precisions
« Reply #5 on: June 30, 2010, 05:46:39 pm »
I'm glad to hear you got it working. Thanks for posting the solution.

Jan