Guter_Hirte
Posts: 9
Joined: Tue Mar 03, 2015 2:21 pm

suspend usb device but keep ssh connection on raspberry pi 2

Wed Mar 04, 2015 3:35 pm

When I try to suspend a USB camera connected to the raspberry pi by entering following code in my ssh console

Code: Select all

echo 1 > /sys/devices/platform/bcm2708_usb/bussuspend 
the ssh connection is disconnected immediately. Also keyboard and mouse plugged to the Pi are not responding anymore, of course. Is it possible to force an USB device in idle mode AND keep the lan connection?

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: suspend usb device but keep ssh connection on raspberry

Wed Mar 04, 2015 3:57 pm

Short answer: The LAN is connected via the USB module.

Longer answer, the chip being used for the USB ports (the LAN9512 on the older modules and the LAN9514 on the new modules) has 2 or 4 USB ports and one virtual USB-to-Ethernet adapter. The SoC on the Pi does not have an integrated Ethernet device so one is added to the pi on the single USB 2.0 bus via the LAN 951x chip.

So when you give the command listed above, which turns off the single USB 2.0 bus then obviously all USB attached devices are going to stop working.

Unfortunately, I'm not aware of anyway to target a specific USB device from a software standpoint, but maybe someone else has a good idea.

If you don't mind doing it via hardware you could always put in a small relay that breaks the +5v line going to a specific USB device, or conversely you could have a button connected to a GPIO pin, press the button and a script is triggered to turn the USB bus back on.
Dear forum: Play nice ;-)

Guter_Hirte
Posts: 9
Joined: Tue Mar 03, 2015 2:21 pm

Re: suspend usb device but keep ssh connection on raspberry

Thu Mar 05, 2015 10:16 am

Thank you abishur for your reply.

My actual problem is that my camera does not go into suspend mode at all on the raspberry pi, but does it on every other desktop PC with ubuntu. After some googling I found out, that the common way to put a USB device into suspend mode is by autosuspend, whitch is controlled by the file /sys/bus/usb/devices/x-x.x/power/autosuspend or /level or /control (https://searchcode.com/codesearch/view/37920475/). But when I go to this location, the only file existing is "persist". So I connected my USB mouse to the Pi and had a look there, and in this case some more "wakeup..." files appeared, but no autosuspend, level or control file.

So I connected the same devices to my desktop ubuntu PC and checked the files, and here all of them are existent. I thought maybe my Raspbian installation went wrong, so I deleted it and installed it again. But no progress. I have opencv and li4l packages installed.

Do you have an idea why my Pi does not create those files?

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: suspend usb device but keep ssh connection on raspberry

Thu Mar 05, 2015 3:03 pm

sorry that goes beyond my knowledge of linux :( , hopefully one of the other users of the forum with a little more down and dirty know how of linux will come by the thread and explain what's going on.

My best guess is that it has something to do with the LAN951x chip being used or the USB stack in the SoC itself, but beyond that I got nothing for ya.
Dear forum: Play nice ;-)

User avatar
RaTTuS
Posts: 10574
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: suspend usb device but keep ssh connection on raspberry

Thu Mar 05, 2015 3:10 pm

what is the usb camera - post a link
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Guter_Hirte
Posts: 9
Joined: Tue Mar 03, 2015 2:21 pm

Re: suspend usb device but keep ssh connection on raspberry

Thu Mar 05, 2015 3:51 pm

it is the one shown in the link
http://www.hbvcamera.com/productview-75.html
The camera owns the SiliconMotion SM3732 Camera Controller (http://www.usbdev.ru/glossary/gsmi/sm3732/), which should be able to work with linux/ubuntu.

Does it matter which camera it is? I think it is a driver or distribution matter, because it can be suspended in Ubuntu 14.x

rahlquist
Posts: 149
Joined: Tue Jan 21, 2014 1:02 pm

Re: suspend usb device but keep ssh connection on raspberry

Thu Mar 05, 2015 4:08 pm

The echo command you are using disables the USB chip, the Ethernet chip on the pi is connected to the USB bus, you are cutting off all USB and Ethernet when you issue that command. The only way you would be able to issue that command and stay connected is via serial connection over GPIO. There are also alternative devices that connect to GPIO which would let you connect a console as well. http://www.openelectrons.com/index.php? ... tion=13:13 shows several.

So youre not just putting the camera to sleep but everything on the USB side.

Found info on that echo command here http://www.element14.com/community/thre ... hread=true

Guter_Hirte
Posts: 9
Joined: Tue Mar 03, 2015 2:21 pm

Re: suspend usb device but keep ssh connection on raspberry

Thu Mar 05, 2015 4:18 pm

Thank you rahlquist for your reply.

It does not seem to be possible to suspend the USB bus and keep the LAN connection. But it should be possible to suspend the USB device itself. But I cannot find out how this is done with a raspberry pi, it does not matter if it is my camera or any other device.

Guter_Hirte
Posts: 9
Joined: Tue Mar 03, 2015 2:21 pm

Re: suspend usb device but keep ssh connection on raspberry

Thu Mar 05, 2015 4:47 pm

I moved this question to another topic because the problem shifted: http://www.raspberrypi.org/forums/viewt ... 3&t=102879

DirkS
Posts: 10417
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: suspend usb device but keep ssh connection on raspberry

Thu Mar 05, 2015 5:08 pm

Guter_Hirte wrote:I moved this question to another topic because the problem shifted: http://www.raspberrypi.org/forums/viewt ... 3&t=102879
Would have been better if you had asked a mod to move it (use report button)

Return to “General discussion”