mirror of
https://github.com/mik3y/usb-serial-for-android
synced 2025-06-08 00:16:13 +00:00
fix ch340 initialization
This commit is contained in:
parent
bbed92eafb
commit
2a77ebf8b9
@ -123,15 +123,15 @@ public class Ch34xSerialDriver implements UsbSerialDriver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int controlOut(int request, int value, int index) {
|
private int controlOut(int request, int value, int index) {
|
||||||
final int REQTYPE_HOST_TO_DEVICE = 0x41;
|
final int REQTYPE_HOST_TO_DEVICE = UsbConstants.USB_TYPE_VENDOR | UsbConstants.USB_DIR_OUT;
|
||||||
return mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, request,
|
return mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, request,
|
||||||
value, index, null, 0, USB_TIMEOUT_MILLIS);
|
value, index, null, 0, USB_TIMEOUT_MILLIS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private int controlIn(int request, int value, int index, byte[] buffer) {
|
private int controlIn(int request, int value, int index, byte[] buffer) {
|
||||||
final int REQTYPE_HOST_TO_DEVICE = UsbConstants.USB_TYPE_VENDOR | UsbConstants.USB_DIR_IN;
|
final int REQTYPE_DEVICE_TO_HOST = UsbConstants.USB_TYPE_VENDOR | UsbConstants.USB_DIR_IN;
|
||||||
return mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, request,
|
return mConnection.controlTransfer(REQTYPE_DEVICE_TO_HOST, request,
|
||||||
value, index, buffer, buffer.length, USB_TIMEOUT_MILLIS);
|
value, index, buffer, buffer.length, USB_TIMEOUT_MILLIS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user