Is it possible to simulate accelerometer motion on a real (not emulated) device?

£可爱£侵袭症+ 提交于 2019-11-28 11:41:03

问题


Is it possible to transmit fake values to the accelerometer sensor like it is possible with GPS coordinates?


回答1:


If you mean the GPS location, then yes, you can fake that (look at the very bottom of the page): Android DDMS

Using the DDMS, you can simply tell your device its current GPS coordinates.

EDIT: I guess, this post answers your question Stackoverflow. It points out that SensorSimulator is capable of doing that. If you scroll down a little bit on the page, it explains you how to connect the tool with a real device. I myself have never used it, so just try it :)

Hope it helps!




回答2:


You can do that if you find the input event file, and write the values directly to the file. ls -l /dev/input/ and you will see the list of the events you may access. Not sure if you need to be root for that (which can be the case).




回答3:


I tried to follow the logic and reached this area of the code: https://github.com/mozilla-b2g/android-device-crespo/tree/master/libsensors which refers to gyros and whatnot in the various device builds

The code actually makes reference to chip-specific /dev files and paths like /sys/devices/platform/soc-audio.0/sound/card0/pcmC0D9p/dev which I could probably work out how to interpret, but fear I've already squandered too much time on.

It looks like if you're going to try this, you'd need to pretend to be a variety of accelerometer chips, but I suspect squirting data into them is unlikely to work the same way it does with the easier devices.



来源:https://stackoverflow.com/questions/17574111/is-it-possible-to-simulate-accelerometer-motion-on-a-real-not-emulated-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!