mikeweib / android-serialport-api

Automatically exported from code.google.com/p/android-serialport-api
0 stars 0 forks source link

Not receiving in SerialPort Console #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Connect the Android Phone to something that sends bytes over the serial
port occasionally, e.g. a sensor or another Android.
2. Start the Console in the SerialPort activity.
3. Wait for reception of the incoming bytes on the Android.

What is the expected output? What do you see instead?
- Most bytes do not appear on the Console in the Recepton field. Only
occasionally one appears, without a defined pattern in what comes through
or not.

What version of the product are you using? On what operating system?
- Android Dev Phone, with Cyanogenmod (both on 4.1.999 and 4.2.5), using
the SerialPort_0.7.apk. No other apps installed.

Please provide any additional information below.
- I have checked that the phone is capable of receiving messages by using
the Loopback test, and by sending messages to itself using the Console. It
seems like the phone is only listening when it is sending something itself.

Original issue reported on code.google.com by steven.m...@gmail.com on 26 Nov 2009 at 9:28

GoogleCodeExporter commented 8 years ago
just wondering... has this problem been fixed yet?

Original comment by jpan8...@gmail.com on 13 Jan 2010 at 6:24

GoogleCodeExporter commented 8 years ago
The issue stopped being an immediate problem when I started sending messages 
with
length longer than 1 byte, and incorporated some control signals. Somehow it 
seems to
have problems initializing reception, perhaps a buffer needs to be filled 
somewhere?

Original comment by steven.m...@gmail.com on 14 Jan 2010 at 8:14

GoogleCodeExporter commented 8 years ago
Sorry guys, I just discoverd this "issues" section :s (I do not receive email
notification when new issues are submitted).
I will take a look on this issue !

Original comment by cedric.p...@gmail.com on 22 Feb 2010 at 10:38

GoogleCodeExporter commented 8 years ago
Hi,
I have just built a usb-serial cable for my android and am experiencing this 
problem. 
My setup is: HTC Magic (MT3G) running cyanogenmod 4.2.15.1 with the kernel 
changed to 
this one: http://www.allthingsgeek.com/gcms/index.php?mod=article&id=22. The 
USB to 
Serial adapter is a cp210x based nokia usb data cable from ebay, it works well 
on 
other devices.

Note that serial I/O did not work *at all* with the stock cyanogenmod kernel. 
AFAIK 
the one linked above is identical but with CONFIG_HTC_HEADSET unset.

Looking forward to hearing of any progress :)

Original comment by david.co...@gmail.com on 27 Mar 2010 at 12:22

GoogleCodeExporter commented 8 years ago
Issue is confirmed (identical symptoms) on Vodafone Magic (32B) with CyanogenMod
4.2.15.1 and a build of android-2.6.29-donut from cyanogen's git repo with
CONFIG_HTC_HEADSET unset.

Additionally, some of the received bytes appear scrambled, not what has been 
sent to
the port.

Original comment by kik...@gmail.com on 11 May 2010 at 5:25

GoogleCodeExporter commented 8 years ago
Hi, 
This is Laxman Dodda. When i build directly this apk on android2.2. Giving 
error in cosole. Error is "You dont have read/write permisions to the serial 
prot". And in Log the msg is 

12-09 12:14:20.665: WARN/System.err(5899): java.io.IOException: Error running 
exec(). Command: [sudo] Working Directory: null Environment: null
12-09 12:14:20.665: WARN/System.err(5899):     at 
java.lang.ProcessManager.exec(ProcessManager.java:226)
12-09 12:14:20.665: WARN/System.err(5899):     at 
java.lang.Runtime.exec(Runtime.java:196)
12-09 12:14:20.665: WARN/System.err(5899):     at 
java.lang.Runtime.exec(Runtime.java:285)

Original comment by laxmanb...@gmail.com on 9 Dec 2010 at 3:13

GoogleCodeExporter commented 8 years ago
@laxmanbalu: You should at least make sure that you have access to the root 
account in the phone. According to the Log, you don't.

Original comment by stevenmu...@almende.org on 9 Dec 2010 at 8:27

GoogleCodeExporter commented 8 years ago
sometimes may receive data,sometimes don't receive data from uart port!as 
follow system errs:
W/System.err(  768): java.io.InterruptedIOException: Read timed out
W/System.err(  768):    at 
org.apache.harmony.luni.platform.OSFileSystem.readImpl(Native Method)
W/System.err(  768):    at 
org.apache.harmony.luni.platform.OSFileSystem.read(OSFileSystem.java:118)
W/System.err(  768):    at 
java.io.FileInputStream.read(FileInputStream.java:312)
W/System.err(  768):    at 
java.io.FileInputStream.read(FileInputStream.java:267)
W/System.err(  768):    at 
android.serialport.sample.SerialPortActivity$2.handleMessage(SerialPortActivity.
java:119)
W/System.err(  768):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(  768):    at android.os.Looper.loop(Looper.java:123)
W/System.err(  768):    at 
android.app.ActivityThread.main(ActivityThread.java:4627)
W/System.err(  768):    at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(  768):    at java.lang.reflect.Method.invoke(Method.java:521)
W/System.err(  768):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
W/System.err(  768):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
W/System.err(  768):    at dalvik.system.NativeStart.main(Native Method)

Original comment by lit...@gmail.com on 27 Dec 2010 at 10:16

GoogleCodeExporter commented 8 years ago
Hello!

I have the same problem, but I suspect that debug daemon steals symbols from 
the serial port. It is not easily killed, so I can't say exactly right now. 
Didn't have enough time to dig in.
Has everybody ever got receiving working (console or loopback) on any device?
Great project, anyway:-)

Original comment by Yuriy.Kulikov.87@gmail.com on 14 Mar 2011 at 9:13

GoogleCodeExporter commented 8 years ago
Hi! 

I think I had the same problem (scrambled and missing bytes).. and. I got it to 
work on a HTC G1. The problem seems to have something to do with with interrupt 
handling and sleep behaviour in android. 

Serial input started to work in the console when I touched the screen. See if 
this happens to you too...

I "solved" it by adding an empty thread that just loops forever -- without 
sleeping.(Initial solution was a metal clamp that triggered touch-events on the 
screen. :-) )

Good luck! :)

Original comment by HaraldL...@gmail.com on 14 Mar 2011 at 9:28

GoogleCodeExporter commented 8 years ago
I have read wiki carefully and found this: "headset detection and debug console 
code in the kernel must be disable".

Harald,
thanks for the tip, I will give it a try as well :-)

Original comment by Yuriy.Kulikov.87@gmail.com on 14 Mar 2011 at 9:44

GoogleCodeExporter commented 8 years ago
Hi Everyone,

I am trying to read data from a serial port in the below given opencv
link, I have no problem with
sending bytes. Everything works fine. There is a problem when i
receive bytes. Every time a read a byte from ttymxc0 something happens
and the byte is not only read for the first time it is sending some
junk data  but after pressing the the two enter keys it is able to
read the data correctly but my concern to read the data without
pressing any enter keys in the beginning only.

http://code.google.com/p/android-serialport-api/source/checkout

So could any body provide sme corrected code to get rid of this
annoying serial port read problem,

Am new to this android applications development, pls help me.

Advanced Thanks,
Srinivasan S

Original comment by srinivas...@gmail.com on 5 Dec 2011 at 9:48

GoogleCodeExporter commented 8 years ago
   There is a problem when i receive bytes.
   It just receive data when enter the receiving data activy at the firt time. ReadThread in SerialPortActivity just executes 5 or 10 times. then stop when code work here "size = mInputStream.read(buffer);"

   need help. who knows? thanks ahead.

Original comment by luckyang...@gmail.com on 10 Jan 2012 at 2:32

GoogleCodeExporter commented 8 years ago
I come here again.
my problem is solved about "fail to continue to receive after first aquire 
data".
That's because my console is occupying serial port which my app would like to 
use. More infomation, please 
http://code.google.com/p/android-serialport-api/wiki/Htc

Thanks cedric.p...@gmail.com for his code shareing. Thank you very much.

Original comment by luckyang...@gmail.com on 18 Jan 2012 at 2:15

GoogleCodeExporter commented 8 years ago
Hi everybody,

I built the code and installed in my tablet, I entered the device and baudrate 
in the setup, but next in the when I tried to enter to the Console, Loopback or 
Send 010101 activity, the app show me the following message:

"Sorry!
The application ... (process ...) has stopped unexpectedly. Please try again." 
and apears the only botton "Force close" and leave the app.

What happens?

In the other, I have the same problem (when I only installed the the downloaded 
.apk) when I recevied bytes.

Thanks,

Andres.

Original comment by AndresHC...@gmail.com on 20 Jan 2012 at 10:50

GoogleCodeExporter commented 8 years ago
Andres, you should provide a logcat

Original comment by cedric.p...@gmail.com on 25 Jan 2012 at 5:27

GoogleCodeExporter commented 8 years ago
According to comments, the origin of the bug is:
* either an hardware sleep problem
* either an other application which has opened the port at the same time

Sorry guys but in both cases I cannot fix the problem in the API.

Original comment by cedric.p...@gmail.com on 25 Jan 2012 at 5:32

GoogleCodeExporter commented 8 years ago
Hi Cedric,

I resolved the first problem, I didn't compile de jni with the NDK. I build the 
code and works, but I still have the problem when I receive bytes. Yes, the bug 
are probably  origins in these 2, however could you bring me suggestions for 
fix this, about the code. I try some solutions because Im doing a little 
project that do the Android like a master and the microcontroller a slave, like 
a interface for other peripherics. I send commands since the Android and then a 
wait for a response, but I have problems in the response. I tested with the 
loopback, changing the value to send (0 to 64), and works but then the program 
not receive and lost bytes appears. In the fact, for stablish the first fluid 
comunication, I had to open and close (re-enter to the loopbackActivity) 4 or 5 
times, then recent works, Its like some kind of sincronization at first, but 
its not that, or maybe, I dont know. I read about other codes, like GNUIOtest, 
but it is more complex, but the part for receiving bytes is almost the same, in 
java code part.

So, could you bring some advices or suggestions for do what I try to do?. I 
appreciate a lot any help. 

Sorry for my english, I try to avoid use Google translate, I do my best.

Greetings.

Andres.   

Original comment by AndresHC...@gmail.com on 7 Feb 2012 at 3:57

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi Friends

Using this API am communicating with one Embedded device, here my problem is 
whenever
I'll send 20 bytes of data that device send it back 20 bytes sometimes am 
receiving properly but some time it is not coming please provide any solution 
for this

Original comment by vmpid...@gmail.com on 17 Oct 2012 at 5:05