-
Notifications
You must be signed in to change notification settings - Fork 48
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
webserial return wrong data but other methods works fine #151
Comments
What is the structure of the 103 bytes of data returned? Is it the expected 48 bytes followed by garbage? Is it two or more 48 byte chunks concatenated together? When |
when 103 bytes returned, it's totally wrong data. the first 48 bytes of the 103 bytes are different than the correct data. even rebooting the PC doesn't work if i run javascript in crhome console with the computer which works fine
the result is
However on the problem computer, there is 90% of time i will get data like this
the result is
if i run
|
If this is only happening on some Linux systems try disabling the "ModemManager" service. This service is known to try to open and communicate with serial devices and cause problems. |
it doesn't work even i run
and it cannot explain why minicom works fine, because it also works on serial port.
|
What are the differences between the working PC and the problem PC? Processor type, kernel version, Linux distribution, etc. |
nearly same. it's our company Dell PC for business. the only difference is the problem PC is newer. And both of them are installed ubuntu 20.04 with linux 5.11.0-40 and latest chrome. Details are listed below Good PC: Bad PC: I also tried another pc which has exactly same hardware and software. also works fine. it feels like one of userspace program problem or bug. |
Is there any further debug or experiment i can do? i run out of my methods |
I use auditd to check if someone else is using /dev/ttyUSB
|
for normal real serial port it may be true. However for virtual serial port from USB. i don't think there should be garbege. |
I'd like to try to reproduce this myself but haven't had time. Something else I'd look at to see if anything is unexpectedly communicating with the device before Chrome opens it is to collect a USB packet trace with Wireshark. You can then line up the USB packets with the data returned by the Web Serial API. That could at least show whether or not something is being corrupted within Chrome. |
Here is the info i captured from wireshark. which indeed provide some information.
with filter
So , now i have 2 questions here.
|
There's no reason why Web Serial would send any data not written to the You can see from the auditd log in your previous comment that My guess is that when you disable the serial driver in order to WebUSB instead it means that the Something you can test is performing a Wireshark capture when Chrome isn't running to see if this communication still happens. |
Basically, i have 2 proofs point to chrome:
If it's really something who read the first 9 bytes, it's really strange that it always read just after i call webserial API. |
I upload a screencast as evidence.
cast.mp4 |
That screen capture is interesting because it looks like the full 112 bytes are received by Chrome this time. |
emmmm. i didn't notice it. strange. normally chrome cannot receive everything. Let me try again |
I've been reading through |
I didn't install any qualcomm driver manually. It should come with my ubuntu distribution.
|
This time, the crhome receive wrong data. cast.mp4 |
Is this issue solved? while i cannot get the correct data. I tried another way: just reset the device state machine by sending a Now we really run out of ways. So we just tell our users to set a udev rule, run a script to detach qcserial driver every time they plug the device in |
That's the best workaround I have for now as I haven't had time to dive into what is going on with this particular device and driver combination. |
Well. Understood. Thanks for you help :) |
Similar to Linux, you can manually replace the Qualcomm serial driver with the WinUSB driver so that Chrome can get low-level access to the USB device. The tool for that on Windows is called Zadig. This may not be necessary however and I would check first to see whether you observe the same problem you encountered on Linux when using Windows. |
I'will take a look at windows and make sure. Then feedback ASAP. |
Per "#166". So far, we tell our users to modify /etc/udev/rules.d to remove qcserial driver. We found on mac, WebUSB can work directly. Maybe there is no qcserial driver on it. |
BTW. This issue is a little bit similar with #166 .
when i encouter issue in #166 , the device also sends me "end packet". Which means the device thinks i finish the communication and my response is wrong. Also , in this issue, the device thinks i send something wrong. Though i didn't send anything. Just read from the device. So the problem above is
|
We decide to download chronium and build ourselves to check where is the problem. |
The data read path for Linux and macOS is implemented in serial_port_underlying_source.cc (in the renderer), serial_port_impl.cc and serial_io_handler_posix.cc. The data write path is the same but starts with serial_port_underlying_sink.cc (in the renderer). Windows is the same but ends with serial_io_handler_win.cc |
I'm trying to use webserial to connect android phone with Qualcomm chips. It's EDL mode is a serial port with 0x9008 product ID.
the port is supposed to send 48 bytes data at first time. When i communicate it with python or
sudo minicom --device /dev/ttyUSB0
. i always have 48 bytes data.however when i use code snippet below on chrom console. sometimes it return 103 bytes wrong data. And if i tried on another computer everything works fine.
I'm not sure if i provide enough information, if anything i can provide, please feel free to ask.
The text was updated successfully, but these errors were encountered: