Comments (8)
look this
https://blog.csdn.net/jspping/article/details/131852570?spm=1001.2014.3001.5501
from android-serialport.
Right, cannot open /dev/tty: Permission denied. As mentioned above, #FAQ This library does not provide ROOT permissions, please open the serial port '666' permissions yourself. I think it's because you have broken permissions for that device file.
I suggest you should just double-check if you are have permissions.
See which UARTs are detected in /proc/tty/driver/serial
. Lines with uart:unknown
meaning: Nothing detected (probably not present).
# cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:0 rx:0
1: uart:16550A port:000002F8 irq:3 tx:111780 rx:1321 RTS|DTR|DSR
2: uart:unknown port:000003E8 irq:4
3: uart:unknown port:000002E8 irq:3
If something is connected and driving the CTS, DSR or CD lines (those are input lines), you can even be sure that something is there... same goes for rx-byte-count.
There is also a command setserial
which uses /proc/tty/driver/serial
get its data.
# setserial -g /dev/ttyS[0123]
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: 16550A, Port: 0x02f8, IRQ: 3
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
You can confirm that this device file is accessible like this.
crw-rw-rw- system system 4, 64 1970-01-01 08:00 ttyS0
crw-rw-rw- system system 4, 65 1970-01-01 08:00 ttyS1
from android-serialport.
Hi @xmaihh
The cat /proc/tty/driver/serial does show two UARTs, so they are already available there as well as the permission is also changed to "rwx" for any user type but still it doesn't work.
Also, the test is done in Android 11 as per mentioned in the title of the issue but generated the permission denied error in android 11 and working in Android version 7 (SDK 25).
The same reference code is tested in a device having Android 7 and the device is not rooted. The device is logging the detected drivers as below:-
- Found new driver g_serial on /dev/ttyGS
- Found new driver mtk-uart on /dev/ttyMT
The detection of drivers is done in the older version of Android (7.0 – Nougat) but not detecting the drivers in Android 11 which we need to do. Detection of the driver is possible only till Android SDK version 25 (Android version 7 - Nougat). After Android SDK version 26 (Android version 8.0 - Oreo), it’s not working and generating the permission denied error. I also tried the commands by making the app a system app, but I still, have the same permission issue in Android 11.
Are there any known issues with Android 11?
from android-serialport.
Thank you for sharing @NikhilUsadadiya, I didn't find the proper solution yet, I didn't test in Android 11 environment now.
On an Android 11 device your app only has access to its own files and to general mediafies in public directories. You have options to read the file. Request MANAGE_EXTERNAL_STORAGE
in manifest and let the user confirm.
Regards,
X.
from android-serialport.
Yes, @xmaihh, I have added the request permission in the manifest file also and tried to change the permission and detection of drivers in android 11, but fails to do so. Also, the Request MANAGE_EXTERNAL_STORAGE in the manifest will only allow the user to access the public directories right. It will not allow access or change the value in the root directories right?
from android-serialport.
@NikhilUsadadiya I'm facing the same issue. Did you solve it?
from android-serialport.
请问下,这个有啥简单的解决方法不?
from android-serialport.
https://github.com/Deemonser/AndroidSerialPort
from android-serialport.
Related Issues (20)
- Custom baud rate support HOT 1
- 串口关闭 HOT 1
- Open串口成功,可以发送数据,但接受不到数据 HOT 1
- 你好我想问一下,咱们这个支持 ModBus通讯协议,RTU模式 吗? HOT 1
- 运行demo,从demo发送数据正常,但是接收不到从pc发送的数据 HOT 11
- 能打开串口,但是接收不到消息! HOT 4
- 粘包处理求助 HOT 7
- 安卓设备发送大数据问题求助 HOT 1
- 在连接状态,拔了usb 串口,日志一直警告的报错,能监听usb串口连接状态吗 HOT 1
- ANR in com.ex.serialport (com.ex.serialport/.MainActivity) 点击了两次开启报ANR异常 HOT 1
- 串口发送正常,但接收数据单次超过9个数字类型长度app就会卡死。 HOT 6
- 我遇到了丢数据的问题 HOT 1
- 在Android 10.0版本上报错:Cannot run program "/system/bin/su": error=2, No such file or directory HOT 3
- Class 'FileDescriptor' has no field named 'descriptor'. HOT 2
- file not found and Use of undeclared identifier 'ioctl' HOT 3
- 多串口同时接收和发送数据怎样做? HOT 2
- java.lang.NullPointerException: println needs a message at android.util.Log.println_native(Native Method) at android.util.Log.e(Log.java:236) at tp.xmaihh.serialport.SerialHelper$ReadThread.run(SerialHelper.java:114) HOT 8
- 串口发送正常,但接收数据单次超过9个数字类型长度app就会卡死
- 串口发送成功了,硬件已响应,但是程序不会收到结果(如果用其他串口软件开启一下串口后,用此项目就能显示到接收的结果) HOT 2
- serialHelper.close() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-serialport.