webusb / arduino

WebUSB demos running on Arduino (and compatible) hardware.
566 stars 152 forks source link

Question about usage of controlTransferOut() at connect() and disconnect() in serial.js #89

Closed Kazhuu closed 2 years ago

Kazhuu commented 2 years ago

Hi and thanks for this awesome project. I'm currently learning to use WebUSB and this repo is really a gold mine. I've been looking through the code and saw controlTransferOut() in serial.js at connect() and disconnect(). Like here. And kept wondering what are the request and value numbers here exactly in this context?

I read found that they are vendor specific. So then I looked through WebUSB code on arduino side but could't find anything resembling these values from there. Could you please shed some light what are these and are they required? Event point to further reading would be helpful! Thanks you a lot!

jpliew commented 2 years ago

Hi @Kazhuu this link will provide you more information https://www.beyondlogic.org/usbnutshell/usb6.shtml

Kazhuu commented 2 years ago

This looks like a good resource to read. Thank you a lot!

reillyeon commented 2 years ago

The code which handles these SET_CONTROL_LINE_STATE requests is here: https://github.com/webusb/arduino/blob/gh-pages/library/WebUSB/WebUSB.cpp#L242