title: Recycling sensors from a broken android device using adb
body: <p>I just broke my s3. 3 years ago it was one of the best smartphones.</p>
  <p><strong>Question</strong> How can I get the values from the inertial sensors of the phone via usb?</p>
  <p>I would like to use the accelerometer, gyroscope, magnetometer, barometer and gps sensors of the device.</p>
  <p>Let's say that we want to get:</p>
  <ul>
  <li>the raw acceleration's data along the three axes.</li>
  </ul>
  <p>I connected the usb cable and ran <code>adb root</code> and <code>adb shell</code>. Ok.</p>
  <pre><code>root@android:/ # find / -type d -iname &quot;sensors&quot;                           
  /sys/devices/virtual/sensors
  /sys/class/sensors
  </code></pre>
  <p>The '/sys/class/sensors' directory contains:</p>
  <pre><code>root@android:/ # ls sys/class/sensors                                          
  accelerometer_sensor
  barometer_sensor
  gyro_sensor
  light_sensor
  magnetic_sensor
  proximity_sensor
  </code></pre>
  <p><strong>The problem</strong></p>
  <p>The <strong>raw measurements do not change</strong> even if I tilt the phone. The sensor is in <em>standby mode</em>. It always displays the same values.</p>
  <pre><code>root@android:/sys/class/sensors/accelerometer_sensor # cat raw_data            
  -74,121,1016
  </code></pre>
  <p>I have noticed the folder power/control which controls the power state of the sensor.</p>
  <pre><code>root@android:/sys/class/sensors/accelerometer_sensor # cat power/control       
  auto
  </code></pre>
  <p>I tried with <code>echo on/yes/ok/yeah/wtf &gt; power/control</code> but nothing changed.</p>
  <p>I remember that when I had the screen of the phone working, it was sufficient to open an Android application with sensors' permissions, like Google Maps with the compass feature, to Enable the sensors and get the values refreshed at a constant rate.
  The Java application probably writes something in a file to activate the sensors and reads the raw values.</p>
  <p>How can I activate the sensors from the shell?</p>