wifi(rtl8188eu)移植及调试笔记
2017-08-01 20:56
309 查看
/*
* Dave/nova_wangwenbo@126.com
*/
1.修改设备树:
添加wifi ap电源控制引脚
2.修改文件:include/linux/rfkill-wlan.h
增加gpio资源:
3.修改文件:linux-3.10.0-rk32xx/net/rfkill/rfkill-wlan.c
<1>.申请gpio资源,修改函数如下:
4.在/sys/class/rkwifi/下添加控制节点
添加节点1. /sys/class/rkwifi/power_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)函数中注释
7.启动dnsmasq服务
修改配置文件dnsmasq.conf:
8.配置wlan0的IP地址
ifconfig wlan0 192.16.1.111
9.配置hostapd.conf
* Dave/nova_wangwenbo@126.com
*/
wifi移植及调试笔记
一.rtl8188eu1.修改设备树:
添加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_ap echo 1 > /sys/class/rfwifi/ap ifconfig wlan0 up ifconfig
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
相关文章推荐
- TQIMAX6q调试笔记三:EETI的egalax-i2c触摸屏移植
- android WIFI/BT调试笔记
- Android KitKat 4.4 Wifi移植之AP模式与网络共享功能调试记录
- linux内核移植-内核调试工具KGBD、DDD、GDB移植笔记
- [RK3288][Android6.0] 移植笔记 --- 固件无法下载到eMMC调试
- Android KitKat 4.4 Wifi移植AP模式和网络共享的调试日志
- android TP驱动移植调试笔记(转)
- (wifi)wifi移植之命令行调试driver和supplicant
- WINCE系统下2440的SDIO WIFI驱动移植笔记
- U-Boot-2009-03移植笔记(调试篇)
- TQIMAX6q调试笔记一:lvds屏的移植
- android TP驱动移植调试笔记
- STM32开发板移植88W8686 WIFI驱动笔记
- USB wifi调试笔记
- android 学习笔记(五) 调试相关 5.1 android使用wifi进行程序调试
- APxxx系列wifi驱动芯片移植笔记
- [RK3288][Android6.0] 移植笔记 --- RK818配置不正确导致无法开机调试
- Linux-3.4.2内核移植调试笔记
- [IMX6Q][Android5.1]移植笔记 --- 调试串口只能输出不能输入
- USB WIFI 移植笔记