Debian – How to keep USB device (action cam) from going to sleep

debianusbusb device

I've got an action cam (iON Air Pro Lite WiFi). It uses an SD card and can be connected to the PC via USB cable. It comes with only Windows and Mac support. However, once connected via USB and turned on, the cam does show up as a 32 GB Volume (size of the SD) in Nautilus, which let's me edit the cam's config via a simple file and, most importantly, view, copy and delete the actual video files. That's all I need. It works the same on Windows, basically.

While connected and powered on, lsusb shows the cam as:

Bus 003 Device 013: ID 4255:1000 GoPro 9FF2 [Digital Photo Display]

The problem is: connected to my Linux (Debian 9) machine, the cam turns itself off again after only 1 to 10 seconds. If I manage to navigate to the video files folder and start copying a file, then the cam will stay on as long as the copy process is doing its work. Once the file is copied, the cam powers itself off after just a few moments. This does not happen when connected to a Windows machine.

My question is, what can I do to keep the device from turning itself off?
Seeing how this does not happen when connected to Windows and also not while keeping the device busy, I assume there should be a way. However, I really have no idea where to start. My line of thought currently is:

  • Could be a driver issue. As I have no knowledge about drivers, I wouldn't know how to go from here, unless someone would be holding my hand or could point me to amazing sources.
  • Maybe there is a way to poll/ping a USB device in some generic way and maybe that would be enough to keep it alive. If so, this sounds like something that could be solved with some code. My current research led me to the GET_STATUS Standard Device Request but that doesn't seem to do the trick (see below).
  • Worst case, a script that constantly copies dummy files from and/or to the device (or even just renames/moves files on the device) should probably do the trick. I would need to find a way to have it auto-run when this particular device is connected. This option seems feasible, but not very clean (after all, constant read/writes do shorten an SD card's lifetime, and given that a few moments of inactivity can lead to a power-off, these operations would need to run constantly).

EDIT 1: I found PyUSB and wrote a simple script that would send a GET_STATUS to the camera every 2 ms (via the ctrl_transfer function). This did not keep the cam from powering off at all.

EDIT 2: I still haven't found a solution. Also, in about one out of 5 cases, the cam turns off even while copying a file from it. Please share any ideas regarding possible causes and/or solutions.

Best Answer

It may be USB autosuspend.

Look at /sys/fs:

find /sys/devices/ -name autosuspend

And see if the relevant sysfs file contains "1"

Related Question