melihyarikkaya / react-native-serialport

React Native - Usb Serial Port Communication For Android Platform
MIT License
106 stars 105 forks source link

Questions #8

Open ovidius72 opened 5 years ago

ovidius72 commented 5 years ago

Thank you for this library, I'm new on react-native, so I have a few questions, that hopefully you can help me to clarify:

I need a way to send data from and android device to a PC. I'm using this library and I can see usb devices only when i enable OTG in the system settings, otherwise nothing is detected.

Doing so tough, the PC is not able to detected the attached android device.

I've set up screen that uses the same code as in the documentation and did some test wit OTG enabled, trying to send data with RNSerialport.writeString('test') but i get a Device Not Supported error.

Can you please help me to understand how to set it up so that I can get usb devices without enabling OTG ? And regarding the "device not supported" error, does it means that perhaps the library is not compatible with the usb chip integrated with the tablet ? Thanks.

melihyarikkaya commented 5 years ago

Hi, I've never tried this. I'm not sure if the COM ports on the computer behave like a serial port by default. If you have received a device not supported error, the device you are trying to connect to is not supported. I can't test for today because I don't have the proper equipment. I'il try to find information tomorrow.

ovidius72 commented 5 years ago

@melihyarikkaya That would be very helpful. Thank you

melihyarikkaya commented 5 years ago

Hi, This library connects with the serialport (serial device) module. Computer and android device USB input is USB host by default and is not USB device. See link I hope I understand the problem.

ovidius72 commented 5 years ago

Hi @melihyarikkaya You are right, I've also seen that page and that is indeed a problem for my use case. However the tests I've done were with devices like a printer and a USB stick. As I said I can detect these devices only when in OTG mode. When detected I try to connect with RNSerialport.connect(deviceName, 9600) but i always get unsupported device. Do you know what the problem could be ? Maybe because the device drivers are required ? Thanks.

melihyarikkaya commented 5 years ago

This indicates that the device driver is not supported by the library. I didn't update felHR85/UsbSerial. I plan to make the uptade soon. Maybe the new version can support the device. Which device are you using?

allan-cornet-eove commented 5 years ago

This indicates that the device driver is not supported by the library. I didn't update felHR85/UsbSerial. I plan to make the uptade soon. Maybe the new version can support the device. Which device are you using?

This could be great to update felHR85/UsbSerial but beware it will require some new dependencies (Java 1.8 need and others) and this will be reflected on calling projects.

ovidius72 commented 5 years ago

@melihyarikkaya I've tested connecting an HP Deskjet Printer 3520, a SanDisk Pen Drive, an Android Phone. All of them are detected, meaning that when i call getDevices they are listened. But when i try to connect it give me the Not Supported Error.

allan-cornet-eove commented 5 years ago

To debug, you can try to use droidterm app on android store based on USbSerial, if you can see some frames (communication between your android device and others device) you have a trouble with your code.

ovidius72 commented 5 years ago

Thanks @allan-cornet-eove From droidterm UsbVirtualSerial Port i see: Usb device not supported: unknown device Vendor HP Inc. From USB Viewer I can see 1 interface with 3 endpoints when no device is connected. The tablet has 2 usb port and 1 serial port. When I connect the printer it shows 5 interfaces, each of them has 2/3 endpoints.

Maybe I'm using the wrong interface ? If i have my printer listed at the inteface 5, endpoint 1, how should i set RNSerialport.setInterface ? Thanks

allan-cornet-eove commented 5 years ago

"From droidterm UsbVirtualSerial Port i see: Usb device not supported: unknown device Vendor HP Inc." so, react-native-serialport can not support this device. @melihyarikkaya, your opinion ?

melihyarikkaya commented 5 years ago

An error message occurs when the interface is incorrect. If you see the message device not supported, there is no driver for this device.

ovidius72 commented 5 years ago

That happens event with a USB stick, is a driver required for it ? I'm start thinking something with the Tablet ports might be wrong.

melihyarikkaya commented 5 years ago

I can't find information on the internet for your printer serial port support.

ItaloSa commented 5 years ago

How can i read the payload as ASCII or string?

melihyarikkaya commented 5 years ago

Moved here

codegenuis commented 5 years ago

I have a PAX s90 pos system i am trying to establish communication with, but it keeps display device not supported. Any suggestions?

chrispop commented 4 years ago

Can I set the buffer size when I read the connected device?