mik3y / usb-serial-for-android

Android USB host serial driver library for CDC, FTDI, Arduino and other devices.
MIT License
4.72k stars 1.57k forks source link

UsbRequest queue(buffer, length) is was deprecated in API level 26 #553

Closed joshua-smith4 closed 7 months ago

joshua-smith4 commented 7 months ago

In CommonUsbSerialPort.java in the read function there is a call to UsbRequest.queue with both the buffer and length parameters. Unfortunately this method was deprecated in API level 26. I am quite confident that removing the length parameter from the call will avoid the deprecated method overload and behave functionally the same. I'll provide a merge request and link to this issue.

https://github.com/mik3y/usb-serial-for-android/blob/573c7e41ca687a26293fd111b18df7cf40dd3cd1/usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/CommonUsbSerialPort.java#L209

kai-morich commented 7 months ago

queue with single argument was added with API level 26. Moving to that function would break the library for older APIs. If the method really gets removed, a version switch can be added, but for now lets keep as is