简体   繁体   中英

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

是否可能像GPS坐标一样将假值传输到加速度传感器?

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!

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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM