Thursday, April 5, 2012

Realtek Wireless RTL8187B fix for suspending

Basically the problem I experience was that if I suspended this laptop and resumed it, the wireless would not be available at all. I even tried a couple tricks to kick it active again which didn't work. Finally one of the gurus on our forums fixed my problem. Before the fix, I would have to reboot. Which meant instead of suspending, I'd simply shutdown. Thankfully the systemd booting made that a much shorter wait than in 11.4. But now, I can use it normally and am very satisfied.

As root, you need to create a file named /etc/pm/sleep.d/66_rtl8187. That is to say create a file called 66_rtl8187 without any file extension, and save it to the directory /etc/pm/sleep.d/. I did this using gedit run as root. To run gedit as root simply hit the hotkey alt+F2 and type in "gnomesu gedit". Then simply paste the following and save it to the /etc/pm/sleep.d directory. The code for the file is as follows:

#!/bin/bash
case $1 in
hibernate)
echo "Suspending to disk!"
/sbin/modprobe -r rtl8187
;;
suspend)
echo "Suspending to RAM!"
/sbin/modprobe -r rtl8187
;;
thaw)
echo "Resuming from disk..."
/sbin/modprobe rtl8187
;;
resume)
echo "Resuming from RAM..."
/sbin/modprobe rtl8187
;;
*)  echo "somebody is calling me totally wrong."
;;
esac

If I understand the code here, it simply removes the driver on suspending, then reloads it when the system resumes. So simple its no wonder I didn't think of it! LOL.

This may not work for you as it seems to be a very particular issue with my hardware, but you should be able to adapt the script. If it doesn't work that would eliminate your driver as being the cause of the issue at least. My laptop being a Gateway T1200 if I recall. But if you have similar hardware, this fix may do the trick. I hope you find it as helpful as I did!

Special thanks to lwfinger, our wireless forum ninja.