BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 09-29-2007, 12:29 PM   #1 (permalink)
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Posts: 2,166
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Enable/disable CONFIG_USB_SUSPEND's autosuspend mode

Please Login to Remove!

(from the original barry-devel email posting by Chris Frey, barry author)
http://sourceforge.net/mailarchive/f...me=barry-devel

Kernels:
========

Version 2.6.21 behaves with autosuspend=0 meaning off, while 2.6.22 and higher needs autosuspend=-1 to turn it off. In 2.6.22, a value of 0 means "immediate" instead of "never".

Version 2.6.22 adds variables internal to the system called autosuspend_disabled and autoresume_disabled. These are controlled by the /sys/class/usb_device/*/device/power/level file. (See below)

Here's a summary of files under device/power. These may or may not exist on your system depending on your kernel version and configuration.

autosuspend
-1 or 0 means off, depending on kernel, otherwise it is the number of seconds to autosuspend level with the settings:

on - suspend is disabled, device is fully powered
auto - suspend is controlled by the kernel (default)
suspend - suspend is enabled permanently

You can write these strings to the file to control behaviour on a per-device basis.

echo on > /sys/usb_device/.../device/power/level
state
current state of device
0 - fully powered
2 - suspended

You can write these numbers to control behaviour, but any change you make here might change automatically if autosuspend is on.

echo -n 0 > /sys/usb_device/.../device/power/state
wakeup
unknown
Based on the feedback from Chuck Ebbert, it is possible to disable autosuspend on a system wide basis as well. This is either done on the kernel boot command line if usbcore is compiled into the kernel, or on the module command line, if not.

Here are some practical notes for various distros:


Debian / Ubuntu systems:
========================

Comes with usbcore (CONFIG_USB) compiled as a module and CONFIG_USB_SUSPEND enabled (at least on Ubuntu).

Therefore, to disable autosuspend you either:

- recompile kernel without CONFIG_USB_SUSPEND

- configure /etc/modprobe.d/ with a file containing
"options usbcore autosuspend=-1"
or set to 0 depending on your kernel
If your system needs the modprobe configuration file above, and if your
system uses initrd (probably does) then you will need to rebuild the
initrd for your kernel for this to take effect. For example:
dpkg-reconfigure linux-image-2.6.22.1

Fedora 6 and 7 systems:
=======================

Comes with usbcore (CONFIG_USB) compiled into the the kernel, and CONFIG_USB_SUSPEND enabled on Fedora 7.

Therefore to disable autosuspend you either:

- recompile kernel without CONFIG_USB_SUSPEND

- boot with one of the following, depending on your kernel version (2.6.21 or 2.6.22 respectively):
usbcore.autosuspend=0
usbcore.autosuspend=-1

Summary:
========

It seems that bcharge could be coded to search for device/power/level, device/power/autosuspend, and device/power/state and use some heuristics to decide what best action to take.

Fortunately, the kernel gives an error if you write -1 to autosuspend and the kernel doesn't support it, in which case writing 0 seems to be the next step.

Unfortunately, the files under device/power do not always exist, even while autosuspend is enabled, from what I can tell. I'll update bcharge soon to try to handle this automatically, but I'm not sure it will work in every case.
__________________
[ Linux & BlackBerry ] http://www.blackberryforums.com/linux-users-corner/
Offline  
Old 10-11-2007, 11:24 PM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2005
Model: 8320
PIN: Up
Carrier: t-mobile
Posts: 188
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Rivviepop,

What about the usb suspend workaround patch? I've patched my 2.6.22.9 kernel with that patch and it still works fine. Basically, it tells the usb port not to autospend when blackberry devices are connected.

As far as I know, this is pretty much the laziest, no brainer way to get the bb's charged at the correct amp, no messing with the kernel or module lines and no scripts needed either. Who wouldn't want that?
Offline  
Old 10-12-2007, 12:17 PM   #3 (permalink)
BlackBerry Extraordinaire
 
rivviepop's Avatar
 
Join Date: Dec 2006
Location: san francisco
Model: 8320
PIN: n/a
Carrier: t-mobile
Posts: 2,166
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check out the brand new barry 0.9 released, it's supposed to fix the issue with kernels that have it enabled using some voodoo, sleight of hand and a few magic tricks. I'll post a thread in a sec with the release announcement and changelog.
__________________
[ Linux & BlackBerry ] http://www.blackberryforums.com/linux-users-corner/
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.