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