A description of the PL2303HX USB protocol.
Read a device register value.
- bmRequestType: IN, VENDOR, DEVICE
- bRequest: 1
- wValue: 80h | registerNumber
- wLength: 1
Write a device register value.
- bmRequestType: OUT, VENDOR, DEVICE
- bRequest: 1
- wValue: registerNumber
- wIndex: registerValue
Sets flow control mode.
- 00h OFF
- 01h RFRCTS
- 08h DTRDSR
- 31h Unknown
- 41h RTSCTS
- C0h XONXOFF
Gets/sets GPIO.
- 08h Unknown
- 10h GP0 enable
- 20h GP1 enable
- 40h GP0 value
- 80h GP1 value
Unknown. Initialized to 44h.
Read/write while register 4 has an interesting address.
Set to address to read/write extended registers.
Enables/disables GPIO. May not be readable.
- 03h GP4/RI
- 0Ch GP5/DCD
- 30h GP6/DSR
- C0h GP7/CTS
Gets/sets GPIO values.
- 01h GP4/RI
- 02h GP5/DCD
- 04h GP6/DSR
- 08h GP7/CTS
Enables/disables GPIO.
- 03h GP2
- 0Ch GP3
Gets/sets GPIO values.
- 01h GP2
- 02h GP3
Device type. The value 123:6 is special.
Device type. The values 1:3 and 1:4 are special.
chipType = 0
if vendor:product != 067B:2303:
chipType = 4
writeRegister(0x00, 0x01)
writeRegister(0x01, 0x00)
writeRegister(0x02, 0x44)
for reg in range(0x00, 0x03):
readRegister(reg)
else:
readRegister(0x04)
writeRegister(0x04, 0x00)
readRegister(0x04)
v1 = readRegister(0x03)
readRegister(0x04)
writeRegister(0x04, 0x01)
readRegister(0x04)
v2 = readRegister(0x03)
if v1:v2 != 123:6:
writeRegister(0x00, 0x01)
writeRegister(0x01, 0x00)
writeRegister(0x02, 0x44)
for reg in range(0x00, 0x03):
readRegister(reg)
if bcdDevice >> 8 == 4:
chipType = 4
saved = readRegister(0x01)
writeRegister(0x01, 0xFF)
if readRegister(0x01) & 0x0F == 0x0F:
chipType = 4
readRegister(0x04)
writeRegister(0x04, 0xFA)
readRegister(0x04)
v1 = readRegister(0x03)
readRegister(0x04)
writeRegister(0x04, 0xFB)
readRegister(0x04)
v1 = readRegister(0x03)
if v1:v2 == 1:4 or v1:v2 == 1:3:
chipType = 2
else:
chipType = 2
writeRegister(0x01, saved)
if v1:v2 == 123:6:
if readRegister(0x01) & 0x08 == 0x08:
writeRegister(0x00, 0x31)
writeRegister(0x01, 0x08)
if chipType == 4:
for reg in range(0x00, 0x03):
readRegister(reg)
cdcSetLineCoding(...)
setFlowControl(...)