mik3y / usb-serial-for-android

Android USB host serial driver library for CDC, FTDI, Arduino and other devices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IOException for Prolific PL2303GT (prodId 9155 / 0x23c3)

elynden opened this issue · comments

Device in title is not recognized as the correct device type of HXN, but rather type T. This results in an IOException. It's because it does not do the TestHxStatus() check if deviceVersion == 0x300 & usbVersion ==0x200. The original Java code does do this check.

The following code in ProlificSerialDriver.cs needs to be replaced:
if (mDevice.DeviceClass == UsbClass.Comm || maxPacketSize0 != 64) { mDeviceType = DeviceType.DEVICE_TYPE_01; } **else if (deviceVersion == 0x300 && usbVersion == 0x200) { mDeviceType = DeviceType.DEVICE_TYPE_T; // TA }** else if (deviceVersion == 0x500) { mDeviceType = DeviceType.DEVICE_TYPE_T; // TB } else if (usbVersion == 0x200 && !TestHxStatus()) { mDeviceType = DeviceType.DEVICE_TYPE_HXN; } else { mDeviceType = DeviceType.DEVICE_TYPE_HX; }

Replace with:
if (mDevice.DeviceClass == UsbClass.Comm || maxPacketSize0 != 64) { mDeviceType = DeviceType.DEVICE_TYPE_01; } else if (usbVersion == 0x200) { if ((deviceVersion == 0x300 || deviceVersion == 0x500) && TestHxStatus()) { mDeviceType = DeviceType.DEVICE_TYPE_T; // TA & TB } else { mDeviceType = DeviceType.DEVICE_TYPE_HXN; } } else { mDeviceType = DeviceType.DEVICE_TYPE_HX; }

Method is Open(UsbDeviceConnection connection). Currently lines 373 to 392.

Sorry, wrong project.