termux / termux-api

Termux add-on app which exposes device functionality as API to command line programs.
https://f-droid.org/en/packages/com.termux.api/
2.3k stars 454 forks source link

Termux-api on Huawei phone - not working #168

Open ThinkMaster opened 6 years ago

ThinkMaster commented 6 years ago

I have done everything according to Wiki and still cannot get termux-api working on my phone. Every API just returns me nothing, and I have to ctrl-c.

This is the output of termux-info on my phone: $ termux-info Updatable packages: All packages up to date System information: Linux localhost 4.1.18-g725239a #1 SMP PREEMPT Wed Jan 17 03:18:54 CST 2018 aarch64 Android Termux-packages arch: aarch64 Android version: 7.0 Device manufacturer: HUAWEI Device model: EDI-AL10 Terminated $

And this is what I have installed: *$ apt list term Listing... Done termux-am/stable,now 0.2 all [installed] termux-api/stable,now 0.28 aarch64 [installed] termux-apt-repo/stable 0.2 all termux-create-package/stable 0.4 all termux-elf-cleaner/stable 1.2 aarch64 termux-exec/stable,now 0.3 aarch64 [installed] termux-tools/stable,now 0.53 all [installed]**

I have used two termux sessions and use logcat to capture the output from "termu-camera-info".

Please kindly help.

Thanks Brian


$ logcat
int logctl_get(): open '/dev/hwlog_switch' fail -1, 13. Permission denied

Note: log switch off, only log_main and log_events will have logs!
--------- beginning of system
05-01 13:29:58.126 30387 30387 I ActivityManager_activity: Resuming ActivityRecord{5fd7dba token=android.os.BinderProxy@7c26f57 {com.termux/com.termux.app.TermuxActivity}} with isForward=true,forwardBitChanged=true onlyLocalRequest=false
05-01 13:29:58.200 30387 30387 I ActivityManager_activity: Reporting idle of ActivityRecord{5fd7dba token=android.os.BinderProxy@7c26f57 {com.termux/com.termux.app.TermuxActivity}} finished=false
05-01 14:50:21.540 30387 30387 I ActivityManager_activity: Resuming ActivityRecord{5fd7dba token=android.os.BinderProxy@7c26f57 {com.termux/com.termux.app.TermuxActivity}} with isForward=true,forwardBitChanged=true onlyLocalRequest=false
05-01 14:50:21.605 30387 30387 I ActivityManager_activity: Reporting idle of ActivityRecord{5fd7dba token=android.os.BinderProxy@7c26f57 {com.termux/com.termux.app.TermuxActivity}} finished=false
05-01 18:04:40.543 30387 30387 I ActivityManager_activity: Resuming ActivityRecord{5fd7dba token=android.os.BinderProxy@7c26f57 {com.termux/com.termux.app.TermuxActivity}} with isForward=true,forwardBitChanged=true onlyLocalRequest=false
05-01 18:04:40.639 30387 30387 I ActivityManager_activity: Reporting idle of ActivityRecord{5fd7dba token=android.os.BinderProxy@7c26f57 {com.termux/com.termux.app.TermuxActivity}} finished=false
05-01 18:05:35.933 30387 30387 I ActivityManager_activity: Resuming ActivityRecord{5fd7dba token=android.os.BinderProxy@7c26f57 {com.termux/com.termux.app.TermuxActivity}} with isForward=true,forwardBitChanged=true onlyLocalRequest=false
05-01 18:05:36.000 30387 30387 I ActivityManager_activity: Reporting idle of ActivityRecord{5fd7dba token=android.os.BinderProxy@7c26f57 {com.termux/com.termux.app.TermuxActivity}} finished=false
05-01 18:05:43.781 30387 30387 D ActivityThread: Remove activity client record, r= ActivityRecord{5fd7dba token=android.os.BinderProxy@7c26f57 {com.termux/com.termux.app.TermuxActivity}} token= android.os.BinderProxy@7c26f57
05-01 18:05:45.325 30387 30387 V ActivityThread: ActivityThread,callActivityOnCreate
05-01 18:05:45.346 30387 30387 D ActivityThread: add activity client record, r= ActivityRecord{878f28e token=android.os.BinderProxy@2f6e5d5 {com.termux/com.termux.app.TermuxActivity}} token= android.os.BinderProxy@2f6e5d5
05-01 18:05:45.353 30387 30387 I ActivityManager_activity: Resuming ActivityRecord{878f28e token=android.os.BinderProxy@2f6e5d5 {com.termux/com.termux.app.TermuxActivity}} with isForward=true,forwardBitChanged=false onlyLocalRequest=false
05-01 18:05:45.509 30387 30387 I ActivityManager_activity: Reporting idle of ActivityRecord{878f28e token=android.os.BinderProxy@2f6e5d5 {com.termux/com.termux.app.TermuxActivity}} finished=false
05-01 18:11:39.077 30387 30387 I ActivityManager_activity: Resuming ActivityRecord{878f28e token=android.os.BinderProxy@2f6e5d5 {com.termux/com.termux.app.TermuxActivity}} with isForward=false,forwardBitChanged=false onlyLocalRequest=false
--------- beginning of main
05-01 18:11:39.087 30387 30410 D mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
05-01 18:11:39.185 30387 30387 I ActivityManager_activity: Reporting idle of ActivityRecord{878f28e token=android.os.BinderProxy@2f6e5d5 {com.termux/com.termux.app.TermuxActivity}} finished=false
05-01 18:11:57.987 30387 30387 V AudioManager: playSoundEffect   effectType: 0
05-01 18:11:57.987 30387 30387 V AudioManager: querySoundEffectsEnabled...
05-01 18:11:58.048 30387 30387 D HwRTBlurUtils: check blur style for HwToast-Toast, themeResId : 0x7f0c0006, context : com.termux.app.TermuxActivity@bcbd990, Nhwext : 5, get Blur : disable with , null
05-01 18:11:58.139 30387 30410 D mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
05-01 18:12:06.757 30387 30387 V AudioManager: playSoundEffect   effectType: 0
05-01 18:12:06.757 30387 30387 V AudioManager: querySoundEffectsEnabled...
05-01 18:12:06.760 30387 30387 D HwRTBlurUtils: check blur style for HwToast-Toast, themeResId : 0x7f0c0006, context : com.termux.app.TermuxActivity@bcbd990, Nhwext : 5, get Blur : disable with , null
05-01 18:12:06.840 30387 30410 D mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:resource user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:group user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:id user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:id user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:name user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:name user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:define user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:define user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:description user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:description user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:group user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:group user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:id user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:id user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:name user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:name user:455708712
05-01 18:12:23.345 31758 31758 E XmlParser: startElement mResult:1024
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:define user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:description user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:description user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:group user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:group user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:id user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:id user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:name user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:name user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:define user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:define user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:description user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:description user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:group user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:resource user:455708712
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:resource user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:group user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:id user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:id user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:name user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:name user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:define user:0
05-01 18:12:23.345 31758 31758 E XmlParser: startElement mResult:2097152
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:define user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:description user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:description user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:group user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:group user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:id user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:id user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:name user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:name user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:define user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:define user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:description user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:description user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:group user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:group user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:id user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:id user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:name user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:name user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:define user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:define user:0
05-01 18:12:23.345 31758 31758 I XmlParser: startElement itemName:description user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:description user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:group user:0
05-01 18:12:23.345 31758 31758 I XmlParser: endElement itemName:resource user:0
05-01 18:12:23.345 31758 31758 I libEGL  : egl_cache_t() maxKeySize:1024  maxTotalSize:2097152
05-01 18:12:23.345 31758 31758 D libfingersense_wrapper: Initializing libfingersense_wrapper...
05-01 18:12:23.356 31758 31758 D libfingersense_wrapper: libfingersense_wrapper initialized
05-01 18:12:23.415 31758 31758 I appproc : CLASSPATH=/data/data/com.termux/files/usr/libexec/termux-am/am.apk
05-01 18:12:23.415 31758 31758 I appproc : Command=/system/bin/app_process / com.example.termuxam.Am broadcast --user 0 -n com.termux.api/.TermuxApiReceiver --es socket_input 8e46ba0be9c492e2-7c0d-44a0-a1fe-b835d805a3b2e963bde47dc9 --es socket_output d5ba696ca52bed63-7c0d-498a-bbc2-c270bb2c105e8b9d36457300 --es api_method CameraInfo
05-01 18:12:23.415 31758 31758 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 10478 <<<<<<
05-01 18:12:23.428 31758 31758 D AndroidRuntime: CheckJNI is OFF
05-01 18:12:23.429 31758 31758 I AndroidRuntime: readDownloadBoosterConfig: 'false'
05-01 18:12:23.722 31758 31758 D ICU     : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
05-01 18:12:23.766 31758 31758 I art     : Reinit property: dalvik.vm.checkjni= false
05-01 18:12:23.783 31758 31758 V HwFrameworkFactory: : successes to get AllImpl object and return....
05-01 18:12:23.811 31758 31758 I HWSERVICES: hwnative_get_component_register:libdrmbitmap,JNI
05-01 18:12:23.828 31758 31758 I Radio-JNI: register_android_hardware_Radio DONE
05-01 18:12:23.842 31758 31758 I android_hardware_fm.cpp: register_android_hardware_fm_fmradio
05-01 18:12:23.842 31758 31758 I android_hardware_fm.cpp: ========64bit long size = 8
05-01 18:12:23.842 31758 31758 I android_hardware_fm.cpp: FM: get chip type = bcm43xx
05-01 18:12:23.847 31758 31758 E fm_if.c : find the id:fm and begins to open the devices
05-01 18:12:23.847 31758 31758 D fm_if.c : device open sucess, func:fm_device_open,line:1949,ret:0
05-01 18:12:23.850 31758 31758 I android_hardware_fm.cpp: register_android_hardware_fm_fmradio, ret is 0
05-01 18:12:23.922 31758 31758 D AndroidRuntime: Calling main entry com.example.termuxam.Am
05-01 18:12:23.924 31758 31765 E SchedPolicy: open of dev/cpuctl/limit_fg/tasks failed: No such file or directory
05-01 18:12:23.924 31758 31765 E SchedPolicy: open of dev/cpuctl/bg_non_interactive/limit_bg/tasks failed: No such file or directory
05-01 18:12:24.013 31758 31758 D AndroidRuntime: Shutting down VM
05-01 18:12:25.193 30387 30387 V AudioManager: playSoundEffect   effectType: 0
05-01 18:12:25.193 30387 30387 V AudioManager: querySoundEffectsEnabled...
05-01 18:12:25.195 30387 30387 D HwRTBlurUtils: check blur style for HwToast-Toast, themeResId : 0x7f0c0006, context : com.termux.app.TermuxActivity@bcbd990, Nhwext : 5, get Blur : disable with , null
05-01 18:12:25.287 30387 30410 D mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
05-01 18:13:46.920 30387 30387 E ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
05-01 18:13:46.920 30387 30387 E ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
05-01 18:13:46.920 30387 30387 E ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
05-01 18:13:46.920 30387 30387 E ViewDragHelper: Ignoring pointerId=0 because ACTION_DOWN was not received for this pointer before ACTION_MOVE. It likely happened because  ViewDragHelper did not receive all the events in the event stream.
05-01 18:13:46.920 30387 30387 I Choreographer: Skipped 37 frames!  The application may be doing too much work on its main thread.
05-01 18:13:47.072 30387 30410 D mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
05-01 18:13:48.440 30387 30410 D mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
05-01 18:13:48.574 30387 30410 D mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
05-01 18:13:48.892 30387 30410 D mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
05-01 18:13:49.026 30387 30410 D mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
05-01 18:13:50.564 30387 30387 V AudioManager: playSoundEffect   effectType: 0
05-01 18:13:50.564 30387 30387 V AudioManager: querySoundEffectsEnabled...
05-01 18:13:50.704 30387 30410 D OpenGLRenderer: endAllActiveAnimators on 0x7e70f2c180 (RippleDrawable) with handle 0x7e70f12ec0
05-01 18:13:52.375 30387 30387 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
05-01 18:13:52.390 30387 30387 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
05-01 18:13:52.390 30387 30387 W IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
05-01 18:13:52.390 30387 30387 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
read: unexpected EOF!
$
Grimler91 commented 6 years ago

Have you installed the termux-api app?

ThinkMaster commented 6 years ago

Yes, I have installed termux-api app on the phone

Grimler91 commented 6 years ago

Have you granted the app necessary permissions?

ThinkMaster commented 6 years ago

Yes, I have.

..as attached

On Wed, May 2, 2018, 12:42 PM Henrik Grimler notifications@github.com wrote:

Have you granted the app necessary permissions?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/termux/termux-api/issues/168#issuecomment-385863146, or mute the thread https://github.com/notifications/unsubscribe-auth/AJgEHhyAM8OSqGaWDlO1CD8slLM7cycOks5tuTkxgaJpZM4Tt_Xi .

ThinkMaster commented 6 years ago

I have a close look into the log. Is it anything relating to the spawning of process to execute AM with regards to these messages: 05-01 18:12:23.922 31758 31758 D AndroidRuntime: Calling main entry com.example.termuxam.Am 05-01 18:12:23.924 31758 31765 E SchedPolicy: open of dev/cpuctl/limit_fg/tasks failed: No such file or directory 05-01 18:12:23.924 31758 31765 E SchedPolicy: open of dev/cpuctl/bg_non_interactive/limit_bg/tasks failed: No such file or directory 05-01 18:12:24.013 31758 31758 D AndroidRuntime: Shutting down VM

I did a "ls -l /dev" on Termux and it says "ls: can't open '/dev': Permission denied". Will it be relating to the way that somehow my phone spawned the process successful but due to 'extra permission problem' and the fact that it could not access relevant files outside termux that it gets stuck?

BTW, I have given all permissions that are possible to termux and termux-api as attached last time.

Taguar258 commented 6 years ago

Same problem on Nougat.

Can't read /dev, because it's a system folder.

ghost commented 6 years ago

@Taguar258 On most devices with SELinux enabled you view content of /dev folder, but you still have access to some important files such as:

/dev/null
/dev/zero
/dev/random
/dev/urandom
/dev/tty

I have permission denied on ls /dev, but Termux API for me is working.

myownhost commented 6 years ago

Same issue with Neffox X1: All Termux:API scripts hang endless. No Log:

$ logcat -s termux:* termux-api:*                           
--------- beginning of main
$ termux-info                                               
Updatable packages:                                         
All packages up to date                                     
System information:                                         
Linux localhost 3.18.35+ #1 SMP PREEMPT Thu Jul 5 09:33:24 C
ST 2018 aarch64 Android                                     
Termux-packages arch:                                       
aarch64                                                     
Android version:                                            
7.0                                                         
Device manufacturer:                                        
TP-Link                                                     
Device model:                                               
Neffos X1                                                   
Terminated                                                  

$ apt list term*                                            
Listing... Done                                             
termux-am/stable,now 0.2 all [installed]                    
termux-api/stable,now 0.33 aarch64 [installed]              
termux-apt-repo/stable 0.2 all                              
termux-create-package/stable 0.4 all                        
termux-elf-cleaner/stable 1.2 aarch64                       
termux-exec/stable,now 0.3 aarch64 [installed]              
termux-tools/stable,now 0.56 all [installed]                
ghost commented 6 years ago

No Log:

logcat -s termux: termux-api:

Of course there no log - this is related more to Android OS itself than to Termux or Termux:API.

So you have to dump full log: Run any of termux-api commands and immediately dump log:

logcat -d > mylog.txt

Then post it here (as file attachment) or to github gist service.


Possible that this issue may be related to missing BOOTCLASSPATH environment variable (which is required by dalvikvm on some devices). Fix here: https://github.com/termux/termux-app/pull/811, but it is not merged to Termux currently.

You can try the following code to generate BOOTCLASSPATH variable:

for lib in $(find /system/framework -type f -iname \*.jar); do
    BOOTCLASSPATH=${lib}:${BOOTCLASSPATH};
done
BOOTCLASSPATH=${BOOTCLASSPATH%%:}
export BOOTCLASSPATH

Then try execute any of termux-api commands, e.g. termux-battery-status.

yuyuqp commented 5 years ago

Go to Huawei EMUI's settings. Under Apps > Termux:API > Set Individual Permissions, check trust this app and also check App auto-launch