This post won’t be Greek to you if you found it by googling your error. Our office network has been very unreliable as of late. Working in a terminal is hell when your latency is 15 seconds. I decided to setup my phone to work as a wifi router. After compiling the rtl8187 module in my 2.6.34 kernel I tried the following command with the resulting error.
root@miar:~# iwconfig wlan1 essid AndroidTether mode ad-hoc
Error for wireless request “Set Mode” (8B06) :
SET failed on device wlan1 ; Operation not supported.
After a bit of looking around I found that the in-kernel rtl8187 module is compiled against the mac80211 library. The new library is apparently more generic and implementation is a bit different. The bottom line is there is no Ad Hoc support for the rtl8187 module. Other modules get around this by implementing adhoc-demo. The adhoc-demo has some limitations too. For example it doesn’t send out beacons. Because of that you have to configure the channel and other settings that would normally be detected in those beacons. To me this is way better than not working at all.
The real root of the problem was that they deprecated the IEEE80211 library that the older drivers used. The newer driver based on the aforementioned mac80211 library may have some limitations too but I’m really only
discussing rtl8187. The older drivers based off the IEEE80211 also require WIRELESS_EXT which is also deprecated. I tried enabling the deprecated kernel modules with success however the older kernel module source would still not compile against the newer kernel. I believe there are other elements that were changed or removed in the more modern 2.6.34 kernel. My recommendation for anyone experiencing these problems may want to voice their concerns in existing bug tickets or if none exist open a bug to get Ad Hoc support officially added in to the module.
On the same page that discussed adhoc-demo
a patch was produced to specifically implement Ad Hoc support to the rtl8187 in-kernel module. There was another interesting patch to add mesh support but I wasn’t really interested in that functionality at the time. Below is the patch I applied that worked to get Ad Hoc support for my (Trend Micro) rtl8187B usb network adapter. Please bare in mind that this patch was taken from a newsgroup posting I found and is a band aid patch to the real problem.
— linux-2.6.x/drivers/net/wireless/rtl818x/rtl8187_dev.c.orig 2010-07-29 14:40:09.000000000 +0300
+++ linux-2.6.x/drivers/net/wireless/rtl818x/rtl8187_dev.c 2010-07-29 14:59:39.000000000 +0300
@@ -1032,6 +1032,7 @@ static int rtl8187_add_interface(struct
switch (vif->type) {
case NL80211_IFTYPE_STATION:
+ case NL80211_IFTYPE_ADHOC:
break;
default:
goto exit;
@@ -1178,7 +1179,10 @@ static void rtl8187_bss_info_changed(str
reg
= 0;
if (is_valid_ether_addr(info->bssid)) {
– reg |= RTL818X_MSR_INFRA;
+ if (vif->type == NL80211_IFTYPE_ADHOC)
+ reg |= RTL818X_MSR_ADHOC;
+ else
+ reg |= RTL818X_MSR_INFRA;
rtl818x_iowrite8(priv, &priv->map->MSR, reg);
} else {
reg |= RTL818X_MSR_NO_LINK;
@@ -1502,7 +1506,8 @@ static int __devinit rtl8187_probe(struc
* XXX: Once this driver supports anything that requires
* beacons it must implement IEEE80211_TX_CTL_ASSIGN_SEQ.
*/
– dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
+ dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
+ BIT(NL80211_IFTYPE_ADHOC);
if ((id->driver_info == DEVICE_RTL8187) && priv->is_rtl8187b)
printk(KERN_INFO “rtl8187: inconsistency between id with OEM”
Once patched my commands executed properly. Remember if you insmoded the rtl8187 module before recompiling with the patch it will remain resident in memory until you rmmod it and insmod it again. I hope you
find this information as useful as I did. Thank you to the original author of the patch!