FreeBSD: USB working after suspend/resume


One thing stopping me to use FreeBSD in my laptop during so much time is suspend/resume. I can’t understand why this is a not well supported feature in a mature OS as FreeBSD. It used to work fine with APM in my old T21 and T23.

In FreeBSD 8.1 (maybe in 8.0 too) amd64 my Thinkpad R61 is able to resume without problems only once. Second time the system resume usb devices don’t work. It seems like the usb ports were disabled: no kernel messages when an usb device is attached or detached.

I found the solution in this post:

http://permalink.gmane.org/gmane.os.freebsd.devel.usb/7243

And it works!

First you need to compile the usb stuff as modules in your kernel. In mine (8.1) I commented the following lines:

/usr/src/sys/amd64/conf/MYCONF_USB_MODULE

#device uhci # UHCI PCI->USB interface
#device ohci # OHCI PCI->USB interface
#device ehci # EHCI PCI->USB interface (USB 2.0)
#device usb # USB Bus (required)
#device udbp # USB Double Bulk Pipe devices
#device uhid # “Human Interface Devices”
#device ukbd # Keyboard
#device ulpt # Printer
#device umass # Disks/Mass storage – Requires scbus and da
#device ums # Mouse
#device urio # Diamond Rio 500 MP3 player
# USB Serial devices
#device uark # Technologies ARK3116 based serial adapters
#device ubsa # Belkin F5U103 and compatible serial adapters
#device uftdi # For FTDI usb serial adapters
#device uipaq # Some WinCE based devices
#device uplcom # Prolific PL-2303 serial adapters
#device uslcom # SI Labs CP2101/CP2102 serial adapters
#device uvisor # Visor and Palm devices
#device uvscom # USB serial support for DDI pocket’s PHS
# USB Ethernet, requires miibus
#device aue # ADMtek USB Ethernet
#device axe # ASIX Electronics USB Ethernet
#device cdce # Generic USB over Ethernet
#device cue # CATC USB Ethernet
#device kue # Kawasaki LSI USB Ethernet
#device rue # RealTek RTL8150 USB Ethernet
#device udav # Davicom DM9601E USB
# USB Wireless
#device rum # Ralink Technology RT2501USB wireless NICs
#device uath # Atheros AR5523 wireless NICs
#device ural # Ralink Technology RT2500USB wireless NICs
#device zyd # ZyDAS zb1211/zb1211b wireless NICs

Then make all usb modules are loaded when your computer boot:

/boot/loader.conf:

usb_load=”YES”
ehci_load=”YES”
uhci_load=”YES”
u3g_load=”YES”
umass_load=”YES”
ukbd_load=”YES”
ums_load=”YES”
uhid_load=”YES”
ucom_load=”YES”
umct_load=”YES”
uplcom_load=”YES”

Finally, make uhci module be unloaded before suspend, and loaded when resume:

/etc/rc.suspend:

kldunload uhci

/etc/rc.resume:

kldload uhci

That’s all… simple!

About jjjesss

I'm a guy interested in technology, bsd fan and concerned about the world around.
This entry was posted in BSD, FreeBSD, Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s