Using adb sendevent in python
Question: I am running into a strange issue, running `adb shell sendevent x x x`
commands from commandline works fine, but when I use any of the 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 all fail - the simulated touch even that works in a shell script does not
work properly when called through python. Furthermore I tried `adb push` the
shell script to the device, and using `adb shell /system/sh /sdcard/script.sh`
I was able to run it successfully, but when I try to run that commandline
through python, the script fails.

What's even stranger, is that he script runs, but for example, it does not
seem to execute the command `sleep 1` half way through the script, `echo`
commands work, `sendevent` commands don't seem to work.

Doesn't even seem possible, but there it is. How do I run a set of `adb shell
sendevent x x x` commands through python?


Answer:   * `sendevent` takes 4 parameters
  * `args` for `Popen` should be `['adb', 'shell', 'sendevent /dev/input/eventX type code value']` \- do not split the remote command
  * timings are important for `sendevent` sequences and `adb shell` call itself is kind of expensive - so using shell script on the device works better
  * pay attention to the newline characters in your shell scripts - make sure it's unix style (single `\n` instead of the `\r\n`)

