wValue in USB HID read call

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
FrPo_1282226
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

Hello experts,

we designed a medical-grade unit using the PSoC 5LP.

in order to do this and to keep the compatibility with the previous software, we had to use the Endpoint EP0 and EP1.

and after some trouble, we managed to get both of them working.

We have one last question to answer (keep in mind that the end product is medical).

in order to  read and write to the HID report , we had to set the wValue for the following call to 0x200. (see code below)

while the original code was 0x2. Do you know what this "magic number" does?

I have tried to read the USB HID specs, but it is not clear at all to me.

def hid_set_report(self,report):

#implement HID set reports via USB control transfer

self.dev.ctrl_transfer(

0x21, #REQUEST_TYPE_CLASS | RECIPIENT_INTERFACE | ENDPOINT OUT

9, # SET_REPORT

0x200,0x00,

report

)

def hid_get_report(self):

#implement HIG GetReport via USB control transfer

return self.dev.ctrl_transfer(

0xA1, # REQUEST_TYPE_CLASS | RECIPIENT_INTERFACE | ENDPOINT_IN

1, # GET REPORT

0x200,0x00,

😎

Thank you!

Francesco

0 Likes
1 Solution
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi FrPo_1282226​,

Did you go through the HID spec ( https://www.usb.org/sites/default/files/documents/hid1_11.pdf ) ? Please refer to the sections 'Get_Report Request' and 'Report Protocols' for the details of information mentioned below-

The wValue field specifies the Report Type in the high byte and the Report ID in the low byte. The Report ID is set to 0 (zero), if Report IDs are not used.

When the wValue is set to 02, the Report Type is 'output'. The Output item is used to define an output data field in a report and it describes the data sent to the device.

Please let us know if you need any more clarifications regarding this.

Best Regards,

Aashita

View solution in original post

0 Likes
4 Replies
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi FrPo_1282226​,

Did you go through the HID spec ( https://www.usb.org/sites/default/files/documents/hid1_11.pdf ) ? Please refer to the sections 'Get_Report Request' and 'Report Protocols' for the details of information mentioned below-

The wValue field specifies the Report Type in the high byte and the Report ID in the low byte. The Report ID is set to 0 (zero), if Report IDs are not used.

When the wValue is set to 02, the Report Type is 'output'. The Output item is used to define an output data field in a report and it describes the data sent to the device.

Please let us know if you need any more clarifications regarding this.

Best Regards,

Aashita

0 Likes

Hi there,

the end customer is a medical company, and they are using the wvalue to 20 on a previous product.

so changing to 200 it means months and months of delay.

Would it be possible for me to send you the source code of the 2 projects and somebody at Cypress have a look, please?

Kind regards,

Francesco

0 Likes

Hi FrPo_1282226​,

Please attach your project here. Also, Can you please let us know for what exactly do you want the reviews?

Best Regards,

Aashita

0 Likes

Hi Aashita,

I have the permission fro my customer to send the source code to Cypress, but I can't attach on this thread.

Can you give me your email address please and I will send to you?

Kind regards,

Francesco

0 Likes