Working on the Raspberry Pi® project, I was able to fix the wireless disconnect issue I was experiencing.
The problem was that every time I wanted to ssh into the unit after leaving it idle for some hours/days, I could log in.
I originally thought it was the Pi itself that was sleeping, but I found out it was the power management settings of the usb wireless dongle itself. I have a Ralink unit.
First you need to find out the type of wireless chip you are using. See your connected usb devices.
$ lsusb Bus 001 Device 006: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
This gave me an idea of the name to look for in the modules. It had to have RT of 5370 somewhere.
$ ls /sys/module