usb-serial-for-android icon indicating copy to clipboard operation
usb-serial-for-android copied to clipboard

React Native Adapter?

Open dougbradbury opened this issue 3 years ago • 10 comments

Has anyone built a react native adapter for this library?

I have been using https://github.com/melihyarikkaya/react-native-serialport, which is backed by https://github.com/felHR85/UsbSerial.

felHR85 has fallen out of maintenance and I am seeing some bugs with prolonged use.

This driver seems like it's got a good contributor group and fairly active work. I am thinking about building a RN adapter but just wanted to make sure I wouldn't be duplicating someone else's effort.

dougbradbury avatar Feb 20 '22 13:02 dougbradbury

I am not aware of a wrapper. If you implement it, please add to usb-serial-for-android wiki.

kai-morich avatar Feb 21 '22 07:02 kai-morich

@dougbradbury hey I am working a project with react native serial port it seems the module can not handle a large string, I want to send a file to a firmware, it seems some line of codes are missing after I check the file, have you found a good package for react native , especially flushing data from android to a pyboard ?

arwys avatar Jul 29 '22 20:07 arwys

@dougbradbury hey I am working a project with react native serial port it seems the module can not handle a large string, I want to send a file to a firmware, it seems some line of codes are missing after I check the file, have you found a good package for react native , especially flushing data from android to a firmware ?

@arwys - I have not found one. Would you have any interest in working on one together?

dougbradbury avatar Jul 29 '22 20:07 dougbradbury

bulkTransfer has a size limit on older Android versions, so you have to send in smaller chunks. to prevent partial data loss on timeout, should be send in native USB packet size chunks as done here

kai-morich avatar Jul 29 '22 21:07 kai-morich

@dougbradbury that's a good idea 👌

arwys avatar Aug 01 '22 07:08 arwys

@kai-morich thank you Kai , I will try that one first, actually I have no knowledges about serial port protocol, and try to combine your method with my module, don't know will work or not, but I will try it and thank you

arwys avatar Aug 01 '22 07:08 arwys

@kai-morich hi Kai , i tested App (“Serial USB Terminal “) from playstore and tried to send raw data to my pyboard , but when i check it in my pyboard ESP 8266 , there is no data sent. Do you have an idea what is the problem, i used react native serial for from USB Serial by fehr and some line of codes are missing, i think thats happen because of asynchronous process , and i remembered that you taught me to use a bulkTransfer, it seem this methods are exist to at there ,but may i know what timeout value that i should set if i want to send a file up 120 kB ? Thank you

arwys avatar Aug 05 '22 22:08 arwys

I am going to start on this today. @dougbradbury I'd love your review if this issue is still relevant for you. Also, if you have already put some work into this let me know and I'll do my best to integrate it. Thanks!

joshua-smith4 avatar Dec 11 '23 15:12 joshua-smith4

@joshua-smith4 I have not put any work into. I've been limping along with react-native-serial port with limited success. Thanks for picking it up!

dougbradbury avatar Dec 11 '23 17:12 dougbradbury

Hi everyone. I'm working in a project that I use ESP32 to send jsons to a android device using USB (for now i'm using firebase). The problem is: I have an app that was not made by me (I'm learning RN just for this project), it was made using PWA and EXPO, but I'll only receive data from ESP32 in android devices and wanna know the best way to do that (if its possible). I've seen that I could create a module API or third part app just to include USB, is this the best way? Is it possible? Anyone knows if there's a lib that works with expo? The main problem is obviously that I cannot access manifest.xml or gradle in EXPO, and I don't know if I eject the expo the project could break

VictorBarth avatar Jul 29 '24 14:07 VictorBarth