wifi(rtl8188eu)移植及调试笔记
来源:互联网 发布:阿里云创建快照 编辑:程序博客网 时间:2024/05/24 05:59
/*
* Dave/nova_wangwenbo@126.com
*/
wifi移植及调试笔记
一.rtl8188eu
1.修改设备树:
添加wifi ap电源控制引脚
WIFI,power_ap_gpio = <&gpio3 GPIO_B5 GPIO_ACTIVE_LOW>;
2.修改文件:include/linux/rfkill-wlan.h
增加gpio资源:
struct rksdmmc_iomux { char *name; //set the MACRO of gpio int fgpio; int fmux; };
struct rksdmmc_gpio { int io; //set the address of gpio char name[64]; // int enable; // disable = !enable //set the default value,i.e,GPIO_HIGH or GPIO_LOW struct rksdmmc_iomux iomux; };
struct rksdmmc_pmu { bool power_ctrl_by_pmu; char pmu_regulator[20]; int enable; };
struct rksdmmc_gpio_wifi_moudle { int sdio_vol; //sdio reference voltage bool vref_ctrl_enble; bool wifi_power_remain; struct rksdmmc_pmu mregulator; struct rksdmmc_pmu ioregulator; struct rksdmmc_gpio power_n; //PMU_EN struct rksdmmc_gpio reset_n; //SYSRET_B, DAIRST struct rksdmmc_gpio vddio; struct rksdmmc_gpio bgf_int_b; struct rksdmmc_gpio wifi_int_b; struct rksdmmc_gpio gps_sync; struct rksdmmc_gpio ANTSEL2; //pin5--ANTSEL2 struct rksdmmc_gpio ANTSEL3; //pin6--ANTSEL3 struct rksdmmc_gpio GPS_LAN; //pin33--GPS_LAN struct regmap *grf; struct rksdmmc_gpio power_ap; //add };
3.修改文件:linux-3.10.0-rk32xx/net/rfkill/rfkill-wlan.c
<1>.申请gpio资源,修改函数如下:
static int wlan_platdata_parse_dt(struct device *dev, struct rksdmmc_gpio_wifi_moudle *data) gpio = of_get_named_gpio_flags(node, "WIFI,power_ap_gpio", 0, &flags); if (gpio_is_valid(gpio)){ data->power_ap.io = gpio; data->power_ap.enable = (flags == GPIO_ACTIVE_HIGH)? 1:0; LOG("%s: get property: WIFI,power_ap_gpio = %d, flags = %d.\n", __func__, gpio, flags); } else data->power_ap.io = -1;
<2>.power控制函数:
int rockchip_wifi_power_ap(int on) { struct rfkill_wlan_data *mrfkill = g_rfkill; LOG("%s: %d\n", __func__, on); if (mrfkill == NULL) { LOG("%s: rfkill-wlan driver has not Successful initialized\n", __func__); return -1; } poweron = &mrfkill->pdata->power_ap; if (on){ if (gpio_is_valid(poweron->io)) { gpio_set_value(poweron->io, poweron->enable); msleep(100); } if (gpio_is_valid(reset->io)) { gpio_set_value(reset->io, reset->enable); msleep(100); } wifi_power_state = 1; LOG("wifi turn on power. %d\n", poweron->io); }else{ if (gpio_is_valid(poweron->io)) { gpio_set_value(poweron->io, !(poweron->enable)); msleep(100); } if (gpio_is_valid(reset->io)) { gpio_set_value(reset->io, !(reset->enable)); } wifi_power_state = 0; LOG("wifi shut off power.\n"); } return 0; } EXPORT_SYMBOL(rockchip_wifi_power_ap);
<3>.匹配函数修改添加:
int rfkill_wlan_probe(struct platform_device *pdev) if (gpio_is_valid(pdata->power_p.io)) { gpio_direction_output(pdata->power_ap.io, !pdata->power_ap.enable); } { -rockchip_wifi_power(1); //原有 +rockchip_wifi_power_ap(1);//add }
<4>.移除函数修改与添加
static int rfkill_wlan_remove(struct platform_device *pdev) +if (gpio_is_valid(rfkill->pdata->power_ap.io)) +gpio_free(rfkill->pdata->power_ap.io);
4.在/sys/class/rkwifi/下添加控制节点
添加节点1. /sys/class/rkwifi/power_ap
+static ssize_t wifi_power_write_ap(struct class *cls, struct class_attribute *attr, const char *_buf, size_t _count) { int poweren = 0; poweren = simple_strtol(_buf, NULL, 10); printk("%s: poweren = %d\n", __func__, poweren); if(poweren > 0) { rockchip_wifi_power_ap(1); } else { rockchip_wifi_power_ap(0); } return _count; } +static CLASS_ATTR(power_ap, 0660, NULL, wifi_power_write_ap);
在入口函数rkwifi_sysif_init(void)添加:
+ret = class_create_file(rkwifi_class, &class_attr_power_ap);
在出口函数rkwifi_sysif_exit(void)添加:
+class_remove_file(rkwifi_class, &class_attr_power_ap);
添加节点2. /sys/class/rkwifi/ap
+static ssize_t wifi_driver_ap(struct class *cls, struct class_attribute *attr, const char *_buf, size_t _count) { int enable = 0, ret = 0; down(&driver_sem); enable = simple_strtol(_buf, NULL, 10); //printk("%s: enable = %d\n", __func__, enable); if (ap_driver_insmod == enable) { printk("%s: wifi driver already %s\n", __func__, enable? "insmod":"rmmod"); up(&driver_sem); return _count; } if(enable > 0) { ret = ap_init_exit_module(enable); if (ret >= 0) ap_driver_insmod = enable; } else { ap_init_exit_module(enable); ap_driver_insmod = enable; } up(&driver_sem); return _count; } static CLASS_ATTR(ap, 0660, NULL, wifi_driver_ap);
在入口函数rkwifi_sysif_init(void)添加:
ret = class_create_file(rkwifi_class, &class_attr_ap)
在出口函数rkwifi_sysif_exit(void)添加:
class_remove_file(rkwifi_class, &class_attr_ap);
5.将power gpio与rtl8188eu驱动进行关联
rockchip_wifi_init_module_rtkwifi()函数中注-if (type < WIFI_AP6XXX_SERIES || type == WIFI_ESP8089) return 0;
-rockchip_wifi_power(1);
+rockchip_wifi_power_ap(1);rockchip_wifi_exit_module_rtkwifi(void)函数中注释
-if (type < WIFI_AP6XXX_SERIES || type == WIFI_ESP8089) return; -rockchip_wifi_power(0); +rockchip_wifi_power_ap(0);6.启动rtl8188eu ap模式
echo 1 > /sys/class/rfwifi/power_apecho 1 > /sys/class/rfwifi/apifconfig wlan0 upifconfig
7.启动dnsmasq服务
修改配置文件dnsmasq.conf:
interface=wlan0 listen-address=192.168.1.1 dhcp-range=192.168.1.50,192.168.1.150,12h server=/google/8.8.8.8
启动dnsmasq服务:dnsmasq &
8.配置wlan0的IP地址
ifconfig wlan0 192.16.1.111
9.配置hostapd.conf
interface=wlan0 driver=nl80211 ssid=ProUHD_Wifi channel=6 hw_mode=g ignore_broadcast_ssid=0 auth_algs=1 wpa=3 wpa_passphrase=novastar wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
启动hostapd:hostapd -dd hostapd.conf
阅读全文
1 0
- wifi(rtl8188eu)移植及调试笔记
- zz-rtl8188eu的linux-usb-wifi调试及驱动编译150210
- RTL8188EU 移植
- 关于Realtek RTL8188EU wifi移植要知道的
- wifi 调试常用命令及rtl8192的移植
- (wifi)wifi移植之命令行调试driver和supplicant
- (wifi)wifi移植之命令行调试driver和supplicant
- 树莓派 rtl8188eu 芯片wifi驱动
- USB WIFI 移植笔记
- rtl8188eu无线网卡驱动移植
- USB wifi调试笔记
- UCOS + LWIP + USB WIFI(rtl8188eu) <一>
- UCOS + LWIP + USB WIFI(rtl8188eu) <二>
- UCOS + LWIP + USB WIFI(rtl8188eu) <三>
- 新唐N32926调试--wifi模块移植
- wifi移植(转)
- 移植UCGUI 调试笔记
- android WIFI/BT调试笔记
- 汇编语言入门
- 使用HashSet方法实现多个对象的遍历
- File类 文件入门 IO流
- 个人宏工作簿PERSONAL.XLSB 保存位置 启动加载项
- 在Android Studio中如何安装Genymotion模拟器插件
- wifi(rtl8188eu)移植及调试笔记
- MySQL数据库优化
- Android 彻底弄懂Activity四大启动模式 和taskAffinity属性详解 intentFlag 图文解析
- 关于轮播图中Handler迭代延时调用自己应用退出无法销毁问题
- reduce函数python
- 爬虫编码问题
- 循环的总结
- Xfce安装与移植
- 关于c++中的scanf函数中的一些不易发现的注意点