Skip to content
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

Pl2303UsbSubmitUrb fails #1

Open
mhanor opened this issue Nov 11, 2017 · 1 comment
Open

Pl2303UsbSubmitUrb fails #1

mhanor opened this issue Nov 11, 2017 · 1 comment

Comments

@mhanor
Copy link

mhanor commented Nov 11, 2017

Hello,

Can you think of any reason why this would happen? Are there any limitations with your driver? I'm using an older PL2303 USB-to-serial adapter (Acer brand), I've self-compiled the driver using Visual Studio 2017 Community. The OS is Windows 10 1703 64 bit and I'm trying to open the serial port with Putty 0.70, standard settings.

Pl2303: Pl2303SetBaudRate. DeviceObject=FFFFCC8C5B628D30, Irp=FFFFCC8C57B25010
Pl2303: Pl2303SetLine. DeviceObject=FFFFCC8C5B628D30
Pl2303: Pl2303UsbSetLine. DeviceObject=FFFFCC8C5B628D30, BaudRate=9600, StopBits=0, Parity=0, DataBits=0
Pl2303: Pl2303UsbSubmitUrb. DeviceObject=FFFFCC8C5B628D30, Urb=FFFFCC8C59404890
Pl2303: Pl2303UsbSetLine. Pl2303UsbSubmitUrb failed with c0000001, c0000004
Pl2303: Pl2303DispatchClose. DeviceObject=FFFFCC8C5B628D30, Irp=FFFFCC8C5D880440

@ThFabba
Copy link
Owner

ThFabba commented Nov 11, 2017

c0000004 is USBD_STATUS_STALL_PID, which seems to indicate the device didn't like the request it was sent.

It's possible that your device has a chip that I haven't tried before (I have 3 of them, which is probably more than most people, but far from all that's out there ;]), and there's a bug in the driver that prevents this version from working.

Looking at the debug output, the DataBits value of 0 seems odd, so does StopBits=0. Your device might be sensitive to this and refuse the request. You could try if changing the defaults in Pl2303StartDevice to be more sensible makes a difference:

    DeviceExtension->StopBits = 1;
    DeviceExtension->Parity = 0;
    DeviceExtension->DataBits = 8;

If this doesn't work, it might be sensible to issue a GET_LINE request to get the device's current settings instead of trying to initialize it with a default. Linux issues such a request here:
https://github.com/torvalds/linux/blob/master/drivers/usb/serial/pl2303.c#L496

I've also never tried the driver on Windows 10, as I haven't worked on it for a few years. That means there may be an incompatibility there.
Finally, please note that the driver is quite incomplete and only supports basic read/write and line settings changes -- no timeouts or most of the other ioctls a serial port is supposed to react to. So it may not work great even if you get it to work. Depending on your use case, it may of course be worth a try though.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants