-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement support for Prolific virtual COM port over WebUSB #29
Comments
Had the same problem with a CH340 on an arduino connecting from Android. You could try:
|
now another issuse: when A send data to B. it's ok, B will receive data correctly |
This library only currently understands how to control a USB serial device that uses the standard USB CDC-ACM protocol, which is why it is looking for an interface with class 2. From my research many USB serial devices that use other non-standard protocols are still similar enough to this protocol that the library should work with only minor modifications. We will use this issue to track implementing support for such chips from Prolific Technologies. |
For my purposes I simply changed the SerialPort constructor code to look for interface types instead of interface class numbers: this.controlInterface_ = this.device_.configuration.interfaces.find(x => x.alternates.find(y => y.endpoints.find(z => z.type === 'interrupt'))); // findInterface(this.device_, this.polyfillOptions_.usbControlInterfaceClass);
this.transferInterface_ = this.device_.configuration.interfaces.find(x => x.alternates.find(y => y.endpoints.find(z => z.type === 'bulk'))); // findInterface(this.device_, this.polyfillOptions_.usbTransferInterfaceClass); Now it works the same as navigator.serial on desktop (serial.js and demo here: https://github.com/A-J-Bauer/asa) |
That's interesting. It looks like Prolific chips use protocol that is similar enough to the standard USB CDC-ACM protocol that it works for the subset of functionality currently used by this library. In particular it uses control transfers that appear identical to the standard SET_LINE_CODING and SET_CONTROL_LINE_STATE commands. |
I think it does, the device Info posted by liu-minjie looks similar (endpoints not unfolded) to that returned for the WCH CH340 chip (http://www.wch-ic.com/products/CH340.html) that is used for Arduino Nano clones and those are working with the modification mentioned above. |
device info:
the device works well with navigator.serial in crhome 89.
but it will not work with the polyfill code in lower version chrome. it will throw the errror: "Unable to find interface with class 2"
The text was updated successfully, but these errors were encountered: