remove redundant parameter

pull/521/head
kai-morich 2023-02-11 20:44:57 +01:00
rodzic 6ffb666b33
commit 8d3326ed66
6 zmienionych plików z 11 dodań i 16 usunięć

Wyświetl plik

@ -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();

Wyświetl plik

@ -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)) {

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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");

Wyświetl plik

@ -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");
}

Wyświetl plik

@ -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");
}