Ralink-based wifi access point in Linux - frequent dropouts on Windows clients

Some specifics of the system:
Distribution: Debian 7.1 (wheezy) (with minor modifications)
Kernel used: 3.2.46

lsusb identifies the stick in use as "ID 0846:9041 NetGear, Inc. WNA1000M 802.11bgn [Realtek RTL8188CUS]"

When using the wireless stick in access point mode, Windows systems would frequently drop the wireless connection. What exactly happened was never clear to me, but hostapd seemed to indicate that the windows system was requesting a re-key.

After some investigation I became aware that the used kernel builds a driver for the RAlink chip. The source for this driver is found in the linux source under
drivers/net/wireless/rtl* (there are a few folders, and I don't know exactly which ones contain the code for the exact chip in my stick). This is the driver that will be used by default, and that is the one that gave me problems.

On RaLink's web site is a different driver. The one I downloaded is in a zip file with the name of RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip.
That's the one that worked for me.

In order to replace the first driver with the second, follow these steps:

1. compile the new driver.
For this you must
* unzip the file RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip,
* cd into folder RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911/driver/
* untar the file rtl8188C_8192C_usb_linux_v4.0.2_9000.20130911.tar.gz
* cd into folder rtl8188C_8192C_usb_linux_v4.0.2_9000.20130911
* edit the Makefile and add a target for your specific system (see the patch for the change that I made further below).
* once the Makefile is ready, run make as follows: "make CONFIG_PLATFORM_mymodule=y modules"
* this will result in a file "8192cu.ko" being produced. This is your new driver.

difference that shows the changes to the Makefile for the driver

diff --git a/Makefile b/Makefile
index c399011..46dd9cf 100755
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,8 @@ CONFIG_RTL8192CU_REDEFINE_1X1 = n
+CONFIG_PLATFORM_mymodule = y
@@ -236,6 +237,17 @@ ifeq ($(CONFIG_INTEL_WIDI), y)
+ifeq ($(CONFIG_PLATFORM_mymodule), y)
+SUBARCH := i386
+KVER := 3.2.46-rt67 (modify this to match your kernel version)
+KSRC := /export/berm2/dev/staging/lib/modules/$(KVER)/build
+MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
ifeq ($(CONFIG_PLATFORM_I386_PC), y)
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)

__________________ end of diff ______________________

2. install the driver into your target. blacklist the old driver
* take the file "8192cu.ko" and put it into the following folder on your target: /lib/modules//kernel/drivers/net/wireless
* edit (or create if needed) the file /etc/modprobe.d/blacklist.conf and add the following line:
blacklist rtl8192cu

3. compile a replacement for the executable hostapd and place into target
* on the system that you unzipped the Ralink driver source, cd back into the folder RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911/wpa_supplicant_hostapd
* untar the file wpa_supplicant_hostapd-0.8_rtw_r7475.20130812.tar.gz, and cd into the folder wpa_supplicant_hostapd-0.8_rtw_r7475.20130812
* run make.
* copy the file found in hostapd/hostapd to your target, replacing the existing hostapd file (for me it was in /usr/sbin).

4. update the file /etc/hostapd/hostapd.conf.
* I took the file "rtl_hostapd_2G.conf" in folder RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911/wpa_supplicant_hostapd as the basis. Make sure to replace the identifying features like ssid, password, etc, and use this new file to replace the existing /etc/hostapd/hostapd.conf in your target system.