We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to read data from Barcode, which is set to CDC Mode. Tested on Linux with cat /dev/ttyACM0 which it gives me proper output. Android code:
cat /dev/ttyACM0
ProbeTable customTable = new ProbeTable(); customTable.addProduct(0x0525, 0xa4a7, CdcAcmSerialDriver.class); customTable.addProduct(0x1eab, 0x1D06, CdcAcmSerialDriver.class); UsbSerialProber prober = new UsbSerialProber(customTable); List<UsbSerialDriver> availableDrivers = prober.findAllDrivers(manager); UsbSerialDriver driver = availableDrivers.get(0); UsbDeviceConnection connection = manager.openDevice(driver.getDevice()); UsbSerialPort usbSerialPort = driver.getPorts().get(0); usbSerialPort.open(connection); usbSerialPort.setParameters(9600, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE); // whatever speed I set I get zeros bellow byte[] response = new byte[6]; while (!Thread.interrupted() && active) { int len = usbSerialPort.read(response, READ_WAIT_MILLIS); // response byte content is 0x000000000000 }
Available driver device=UsbDevice[mName=/dev/bus/usb/001/007,mVendorId=7851,mProductId=7430,mClass=2,mSubclass=0,mProtocol=0,mManufacturerName=Newland Auto-ID,mProductName=NLS-FM430MD-SR-U USB CDC,mVersion=0.01,mSerialNumberReader=android.hardware.usb.IUsbSerialReader$Stub$Proxy@43902ce, mHasAudioPlayback=false, mHasAudioCapture=false, mHasMidi=false, mHasVideoCapture=false, mHasVideoPlayback=false, mConfigurations=[ UsbConfiguration[mId=1,mName=USB CDC mode,mAttributes=128,mMaxPower=250,mInterfaces=[ UsbInterface[mId=0,mAlternateSetting=0,mName=CDC ACM Comm,mClass=2,mSubclass=2,mProtocol=1,mEndpoints=[ UsbEndpoint[mAddress=131,mAttributes=3,mMaxPacketSize=16,mInterval=8]] UsbInterface[mId=1,mAlternateSetting=0,mName=CDC ACM Data,mClass=10,mSubclass=0,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=64,mInterval=0] UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=64,mInterval=0]]]] ports=[<CdcAcmSerialPort device_name=/dev/bus/usb/001/007 device_id=1007 port_number=0>]
It always reads zeros, regardless of setRTS/setDTR/setParameters values.
The text was updated successfully, but these errors were encountered:
please try with a larger read buffer as explained here
Sorry, something went wrong.
No branches or pull requests
I am trying to read data from Barcode, which is set to CDC Mode. Tested on Linux with
cat /dev/ttyACM0
which it gives me proper output. Android code:It always reads zeros, regardless of setRTS/setDTR/setParameters values.
The text was updated successfully, but these errors were encountered: