1
0
mirror of https://github.com/mik3y/usb-serial-for-android synced 2025-06-07 16:06:10 +00:00

Added DTR and RTS support for cp21xx driver

This commit is contained in:
Tim Vahlbrock 2019-10-28 13:20:34 +01:00
parent e20b3cc913
commit 7eaea45068

View File

@ -362,6 +362,14 @@ public class Cp21xxSerialDriver implements UsbSerialDriver {
@Override @Override
public void setDTR(boolean value) throws IOException { public void setDTR(boolean value) throws IOException {
mConnection.controlTransfer(
UsbConstants.USB_DIR_OUT | UsbConstants.USB_TYPE_VENDOR | 0x01,
0x07,
value ? 0x101 : 0x100,
0,
null,
0,
2000);
} }
@Override @Override
@ -376,6 +384,14 @@ public class Cp21xxSerialDriver implements UsbSerialDriver {
@Override @Override
public void setRTS(boolean value) throws IOException { public void setRTS(boolean value) throws IOException {
mConnection.controlTransfer(
0x41,
0x07,
value ? 0x202 : 0x200,
0,
null,
0,
2000);
} }
@Override @Override