title: How can I detect a USB port being used for charging in Linux?
body: <p>I'm using a USB port on the Raspberry Pi 3 Model B to charge an accessory via a USB magnetic charging cable. I want to detect when the cable is plugged in and removed <em>from the Pi</em>.</p>
  
  <p>I've been plugging in and removing this cable and looking for any traces of this being detected on Linux. So far, I've tried:</p>
  
  <ul>
  <li>monitoring udev events by <code>udevadm monitor</code>.</li>
  <li>tailing the system logs in <code>/var/log</code> etc.</li>
  <li>running an inotify watch on the <code>/dev</code> directory for new devices</li>
  <li>looking around in <code>/sys/bus/usb/devices</code> for any clues</li>
  </ul>
  
  <p>Is it possible to detect my simple charging cable being inserted/removed? By intuition I would think no (since the cable is purely for charging, and doesn't have drivers), however I observe that the RPI flashes its builtin LED red when I insert the cable.</p>