android - Using adb sendevent in python -


i running strange issue, running adb shell sendevent x x x commands commandline works fine, when use of following:

subprocess.popen(['adb', 'shell', 'sendevent', 'x', 'x','x'])
subprocess.popen('adb shell sendevent x x x', shell=true)
subprocess.call(['adb', 'shell', 'sendevent', 'x', 'x','x'])

they fail - simulated touch works in shell script not work when called through python. furthermore tried adb push shell script device, , using adb shell /system/sh /sdcard/script.sh able run successfully, when try run commandline through python, script fails.

what's stranger, script runs, example, not seem execute command sleep 1 half way through script, echo commands work, sendevent commands don't seem work.

doesn't seem possible, there is. how run set of adb shell sendevent x x x commands through python?

  • sendevent takes 4 parameters
  • args popen should ['adb', 'shell', 'sendevent /dev/input/eventx type code value'] - not split remote command
  • timings important sendevent sequences , adb shell call kind of expensive - using shell script on device works better
  • pay attention newline characters in shell scripts - make sure it's unix style (single \n instead of \r\n)

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -