Android Question AsyncStreams with ttyCOM0

Blueforcer

Well-Known Member
Licensed User
Longtime User
I wonder why AsyncStreams doesnt work but writing directly to the outputstream works.
I want to use AsyncStreams to avoid blocking my mainthread with a fast timer to look for available bytes.

B4X:
    Dim su As SuCommand
    su.SuCommand("stty -F ttyCOM0 9600 cs8 -parenb -cstopb -crtscts")
    sinp = File.OpenInput("","/dev/ttyCOM0" )           'open serial input
    sout = File.OpenOutput("","/dev/ttyCOM0",True) ' open serial output
    'Works
    sout.WriteBytes(buffer,0,buffer.Length)
    sout.Flush
    'Doesnt Works
    AStream.Initialize(sinp,sout, "astream")
    AStream.Write(Buffer)
 
Last edited:

Blueforcer

Well-Known Member
Licensed User
Longtime User
neither nor. With AsyncStreams my RS485 Busdevices doesnt receive any bytes. But will do while writing directly to the OutputStream.

But i just found some lines in the unfiltered logs (Wich belongs to both variants):

B4X:
type=1400 audit(0.0:117): avc: denied { getattr } for path="/sys/devices/platform/display-subsystem/drm/card0/card0-HDMI-A-1/audioformat" dev="sysfs" ino=20013 scontext=u:r:audioserver:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
type=1400 audit(0.0:118): avc: denied { read } for name="ttyCOM0" dev="tmpfs" ino=8101 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:tty_device:s0 tclass=chr_file permissive=1
type=1400 audit(0.0:119): avc: denied { open } for path="/dev/ttyCOM0" dev="tmpfs" ino=8101 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:tty_device:s0 tclass=chr_file permissive=1
vncUpdateFramebuffer: copy took 3.059 ms
type=1400 audit(0.0:120): avc: denied { getattr } for path="/dev/ttyCOM0" dev="tmpfs" ino=8101 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:tty_device:s0 tclass=chr_file permissive=1
type=1400 audit(0.0:121): avc: denied { append } for name="ttyCOM0" dev="tmpfs" ino=8101 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:tty_device:s0 tclass=chr_file permissive=1
type=1400 audit(0.0:122): avc: denied { execute } for name="su" dev="dm-0" ino=3146 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:su_exec:s0 tclass=file permissive=1
type=1400 audit(0.0:123): avc: denied { read open } for path="/system/xbin/su" dev="dm-0" ino=3146 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:su_exec:s0 tclass=file permissive=1
type=1400 audit(0.0:124): avc: denied { execute_no_trans } for path="/system/xbin/su" dev="dm-0" ino=3146 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:su_exec:s0 tclass=file permissive=1
type=1400 audit(0.0:125): avc: denied { write } for name="server" dev="tmpfs" ino=8343 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:device:s0 tclass=sock_file permissive=1
type=1400 audit(0.0:126): avc: denied { connectto } for path="/dev/com.koushikdutta.superuser.daemon/server" scontext=u:r:platform_app:s0:c512,c768 tcontext=u:r:sudaemon:s0 tclass=unix_stream_socket permissive=1
image available
type=1400 audit(0.0:127): avc: denied { sys_ptrace } for capability=19 scontext=u:r:sudaemon:s0 tcontext=u:r:sudaemon:s0 tclass=capability permissive=1
vncUpdateFramebuffer: copy took 3.027 ms
type=1400 audit(0.0:128): avc: denied { read } for scontext=u:r:sudaemon:s0 tcontext=u:r:platform_app:s0:c512,c768 tclass=file permissive=1
type=1400 audit(0.0:129): avc: denied { search } for name="1945" dev="proc" ino=23405 scontext=u:r:sudaemon:s0 tcontext=u:r:platform_app:s0:c512,c768 tclass=dir permissive=1
type=1400 audit(0.0:130): avc: denied { read } for name="exe" dev="proc" ino=30181 scontext=u:r:sudaemon:s0 tcontext=u:r:platform_app:s0:c512,c768 tclass=lnk_file permissive=1
type=1400 audit(0.0:131): avc: denied { use } for path="pipe:[27783]" dev="pipefs" ino=27783 scontext=u:r:sudaemon:s0 tcontext=u:r:platform_app:s0:c512,c768 tclass=fd permissive=1
type=1400 audit(0.0:132): avc: denied { read } for path="pipe:[27783]" dev="pipefs" ino=27783 scontext=u:r:sudaemon:s0 tcontext=u:r:platform_app:s0:c512,c768 tclass=fifo_file permissive=1
type=1400 audit(0.0:133): avc: denied { write } for path="pipe:[27784]" dev="pipefs" ino=27784 scontext=u:r:sudaemon:s0 tcontext=u:r:platform_app:s0:c512,c768 tclass=fifo_file permissive=1
type=1400 audit(0.0:134): avc: denied { open } for path="/proc/1882/cmdline" dev="proc" ino=25004 scontext=u:r:sudaemon:s0 tcontext=u:r:platform_app:s0:c512,c768 tclass=file permissive=1
type=1400 audit(0.0:135): avc: denied { setuid } for capability=7 scontext=u:r:sudaemon:s0 tcontext=u:r:sudaemon:s0 tclass=capability permissive=1
image available
type=1400 audit(0.0:136): avc: denied { setgid } for capability=6 scontext=u:r:sudaemon:s0 tcontext=u:r:sudaemon:s0 tclass=capability permissive=1
vncUpdateFramebuffer: copy took 2.767 ms
type=1400 audit(0.0:137): avc: denied { execute } for name="sh" dev="dm-0" ino=516 scontext=u:r:sudaemon:s0 tcontext=u:object_r:shell_exec:s0 tclass=file permissive=1
type=1400 audit(0.0:138): avc: denied { read open } for path="/system/bin/sh" dev="dm-0" ino=516 scontext=u:r:sudaemon:s0 tcontext=u:object_r:shell_exec:s0 tclass=file permissive=1
type=1400 audit(0.0:139): avc: denied { execute_no_trans } for path="/system/bin/sh" dev="dm-0" ino=516 scontext=u:r:sudaemon:s0 tcontext=u:object_r:shell_exec:s0 tclass=file permissive=1
type=1400 audit(0.0:140): avc: denied { execute } for name="app_process64" dev="dm-0" ino=253 scontext=u:r:sudaemon:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file permissive=1
type=1400 audit(0.0:141): avc: denied { read open } for path="/system/bin/app_process64" dev="dm-0" ino=253 scontext=u:r:sudaemon:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file permissive=1
type=1400 audit(0.0:142): avc: denied { execute_no_trans } for path="/system/bin/app_process64" dev="dm-0" ino=253 scontext=u:r:sudaemon:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file permissive=1
P20 bus with 22 devices started (Serial)
type=1400 audit(0.0:143): avc: denied { getattr } for path="/system/bin/sh" dev="dm-0" ino=516 scontext=u:r:sudaemon:s0 tcontext=u:object_r:shell_exec:s0 tclass=file permissive=1
type=1400 audit(0.0:144): avc: denied { getattr } for path="/vendor" dev="rootfs" ino=7856 scontext=u:r:sudaemon:s0 tcontext=u:object_r:rootfs:s0 tclass=lnk_file permissive=1
type=1400 audit(0.0:145): avc: denied { getattr } for path="/system/bin/app_process64" dev="dm-0" ino=253 scontext=u:r:sudaemon:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file permissive=1
type=1400 audit(0.0:146): avc: denied { ioctl } for path="pipe:[27783]" dev="pipefs" ino=27783 ioctlcmd=5401 scontext=u:r:sudaemon:s0 tcontext=u:r:platform_app:s0:c512,c768 tclass=fifo_file permissive=1
type=1400 audit(0.0:147): avc: denied { getattr } for path="pipe:[27783]" dev="pipefs" ino=27783 scontext=u:r:sudaemon:s0 tcontext=u:r:platform_app:s0:c512,c768 tclass=fifo_file permissive=1
image available
vncUpdateFramebuffer: copy took 2.869 ms
dlopen vpu lib failed
>>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
CheckJNI is OFF
type=1400 audit(0.0:148): avc: denied { getattr } for path="/data/dalvik-cache/arm64" dev="dm-1" ino=233394 scontext=u:r:sudaemon:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=dir permissive=1
type=1400 audit(0.0:149): avc: denied { getattr } for path="/data/dalvik-cache/arm64/system@[email protected]" dev="dm-1" ino=233409 scontext=u:r:sudaemon:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=file permissive=1
type=1400 audit(0.0:150): avc: denied { read } for name="system@[email protected]" dev="dm-1" ino=233409 scontext=u:r:sudaemon:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=file permissive=1
type=1400 audit(0.0:151): avc: denied { open } for path="/data/dalvik-cache/arm64/system@[email protected]" dev="dm-1" ino=233409 scontext=u:r:sudaemon:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=file permissive=1
type=1400 audit(0.0:152): avc: denied { lock } for path="/data/dalvik-cache/arm64/system@[email protected]" dev="dm-1" ino=233409 scontext=u:r:sudaemon:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=file permissive=1
No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
Couldn't load memtrack module (No such file or directory)
failed to load memtrack module: -2
register_android_hardware_Radio DONE
Calling main entry com.android.commands.am.Am
Sending non-protected broadcast null from system uid 0 pkg null
java.lang.Throwable
    at com.android.server.am.ActivityManagerService.checkBroadcastFromSystem(ActivityManagerService.java:18156)
    at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:18723)
    at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:18814)
 
Upvote 0
Top