kopia lustrzana https://github.com/mik3y/usb-serial-for-android
remove redundant parameter
rodzic
6ffb666b33
commit
8d3326ed66
|
@ -8,7 +8,6 @@ package com.hoho.android.usbserial.driver;
|
|||
|
||||
import android.hardware.usb.UsbConstants;
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.hardware.usb.UsbDeviceConnection;
|
||||
import android.hardware.usb.UsbEndpoint;
|
||||
import android.hardware.usb.UsbInterface;
|
||||
import android.util.Log;
|
||||
|
@ -95,7 +94,7 @@ public class CdcAcmSerialDriver implements UsbSerialDriver {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void openInt(UsbDeviceConnection connection) throws IOException {
|
||||
protected void openInt() throws IOException {
|
||||
if (mPortNumber == -1) {
|
||||
Log.d(TAG,"device might be castrated ACM device, trying single interface logic");
|
||||
openSingleInterface();
|
||||
|
|
|
@ -7,7 +7,6 @@ package com.hoho.android.usbserial.driver;
|
|||
|
||||
import android.hardware.usb.UsbConstants;
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.hardware.usb.UsbDeviceConnection;
|
||||
import android.hardware.usb.UsbEndpoint;
|
||||
import android.hardware.usb.UsbInterface;
|
||||
import android.util.Log;
|
||||
|
@ -80,7 +79,7 @@ public class Ch34xSerialDriver implements UsbSerialDriver {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void openInt(UsbDeviceConnection connection) throws IOException {
|
||||
protected void openInt() throws IOException {
|
||||
for (int i = 0; i < mDevice.getInterfaceCount(); i++) {
|
||||
UsbInterface usbIface = mDevice.getInterface(i);
|
||||
if (!mConnection.claimInterface(usbIface, true)) {
|
||||
|
|
|
@ -118,7 +118,7 @@ public abstract class CommonUsbSerialPort implements UsbSerialPort {
|
|||
}
|
||||
mConnection = connection;
|
||||
try {
|
||||
openInt(connection);
|
||||
openInt();
|
||||
if (mReadEndpoint == null || mWriteEndpoint == null) {
|
||||
throw new IOException("Could not get read & write endpoints");
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public abstract class CommonUsbSerialPort implements UsbSerialPort {
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract void openInt(UsbDeviceConnection connection) throws IOException;
|
||||
protected abstract void openInt() throws IOException;
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
|
|
@ -8,7 +8,6 @@ package com.hoho.android.usbserial.driver;
|
|||
|
||||
import android.hardware.usb.UsbConstants;
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.hardware.usb.UsbDeviceConnection;
|
||||
import android.hardware.usb.UsbEndpoint;
|
||||
import android.hardware.usb.UsbInterface;
|
||||
|
||||
|
@ -126,7 +125,7 @@ public class Cp21xxSerialDriver implements UsbSerialDriver {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void openInt(UsbDeviceConnection connection) throws IOException {
|
||||
protected void openInt() throws IOException {
|
||||
mIsRestrictedPort = mDevice.getInterfaceCount() == 2 && mPortNumber == 1;
|
||||
if(mPortNumber >= mDevice.getInterfaceCount()) {
|
||||
throw new IOException("Unknown port number");
|
||||
|
|
|
@ -9,7 +9,6 @@ package com.hoho.android.usbserial.driver;
|
|||
|
||||
import android.hardware.usb.UsbConstants;
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.hardware.usb.UsbDeviceConnection;
|
||||
import android.util.Log;
|
||||
|
||||
import com.hoho.android.usbserial.util.MonotonicClock;
|
||||
|
@ -99,8 +98,8 @@ public class FtdiSerialDriver implements UsbSerialDriver {
|
|||
|
||||
|
||||
@Override
|
||||
protected void openInt(UsbDeviceConnection connection) throws IOException {
|
||||
if (!connection.claimInterface(mDevice.getInterface(mPortNumber), true)) {
|
||||
protected void openInt() throws IOException {
|
||||
if (!mConnection.claimInterface(mDevice.getInterface(mPortNumber), true)) {
|
||||
throw new IOException("Could not claim interface " + mPortNumber);
|
||||
}
|
||||
if (mDevice.getInterface(mPortNumber).getEndpointCount() < 2) {
|
||||
|
@ -123,7 +122,7 @@ public class FtdiSerialDriver implements UsbSerialDriver {
|
|||
}
|
||||
|
||||
// mDevice.getVersion() would require API 23
|
||||
byte[] rawDescriptors = connection.getRawDescriptors();
|
||||
byte[] rawDescriptors = mConnection.getRawDescriptors();
|
||||
if(rawDescriptors == null || rawDescriptors.length < 14) {
|
||||
throw new IOException("Could not get device descriptors");
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ package com.hoho.android.usbserial.driver;
|
|||
|
||||
import android.hardware.usb.UsbConstants;
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.hardware.usb.UsbDeviceConnection;
|
||||
import android.hardware.usb.UsbEndpoint;
|
||||
import android.hardware.usb.UsbInterface;
|
||||
import android.util.Log;
|
||||
|
@ -265,10 +264,10 @@ public class ProlificSerialDriver implements UsbSerialDriver {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void openInt(UsbDeviceConnection connection) throws IOException {
|
||||
public void openInt() throws IOException {
|
||||
UsbInterface usbInterface = mDevice.getInterface(0);
|
||||
|
||||
if (!connection.claimInterface(usbInterface, true)) {
|
||||
if (!mConnection.claimInterface(usbInterface, true)) {
|
||||
throw new IOException("Error claiming Prolific interface 0");
|
||||
}
|
||||
|
||||
|
@ -290,7 +289,7 @@ public class ProlificSerialDriver implements UsbSerialDriver {
|
|||
}
|
||||
}
|
||||
|
||||
byte[] rawDescriptors = connection.getRawDescriptors();
|
||||
byte[] rawDescriptors = mConnection.getRawDescriptors();
|
||||
if(rawDescriptors == null || rawDescriptors.length < 14) {
|
||||
throw new IOException("Could not get device descriptors");
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue