8/24/2014

IPTIME n150ua Android WIFI HAL 기본설정

나의 장난감 ODROID위에 IPTIME n150ua의 기본 Linux Driver를  Porting 한 후 에기본적인 TEST가 진행된 후에 이일을 진행해야한다.

아래와 같이 Android의 HAL Interface의 설정을 수정해주면 Android에서도 문제없이 WIFI를 사용 할 수 있다. 
현재 이 부분은 기본적인 TEST를 마친 상황이다.

Odroid에서 IPTIME n150ua Porting 
  https://ahyuo79.blogspot.com/2014/08/android.html
Odroid  WIFI 관련 설정 및 테스트
  https://ahyuo79.blogspot.com/2014/03/dlna-upnp.html

  • vi device/hardkernel/odroidx2/BoardConfig.mk
새로 WIFI_DRIVER_MODULE를 추가하여 아래와 같이 넣어 모듈형태로 넣음 
BOARD_WIFI_VENDOR       := realtek
BOARD_WLAN_DEVICE       := rtl819xxu

WPA_SUPPLICANT_VERSION              := VER_0_8_X
BOARD_WPA_SUPPLICANT_DRIVER         := WEXT
BOARD_WPA_SUPPLICANT_PRIVATE_LIB    := lib_driver_cmd_rtl
WIFI_DRIVER_MODULE_NAME                 := "rtl8191su"
WIFI_DRIVER_MODULE_PATH             := "/system/lib/modules/rtl8191su.ko"
WIFI_DRIVER_MODULE_NAME2                := "rtl8192cu"
WIFI_DRIVER_MODULE_PATH2            := "/system/lib/modules/rtl8192cu.ko"
WIFI_DRIVER_MODULE_NAME3                    := "rt5370sta"
WIFI_DRIVER_MODULE_PATH3            := "/system/lib/modules/rt5370sta.ko"
WIFI_DRIVER_MODULE_NAME4                := "rt3070sta"
WIFI_DRIVER_MODULE_PATH4            := "/system/lib/modules/rt3070sta.ko" 

  • vi hardware/libhardware_legacy/wifi/wifi.c  
추가된 WIFI 모듈을 Load하기 위해서 HAL를 수정 
int wifi_load_driver()
{
#ifdef WIFI_DRIVER_MODULE_PATH
    char driver_status[PROPERTY_VALUE_MAX];
    int count = 100; /* wait at most 20 seconds for completion */

        char node[50] = {'\0',};
    char buf[5] = {'\0',};
        DIR *dir = opendir("/sys/bus/usb/devices/");
        struct dirent *dent;
        if (dir != NULL) {
                while ((dent = readdir(dir)) != NULL) {
            memset(node, '\0', 50);
                        sprintf(node, "/sys/bus/usb/devices/%s/idVendor", dent->d_name);
                        int vid_fd = open(node, O_RDONLY);
            memset(buf, '\0', 5);
            .... 

                                                } else if (strcmp(buf, "3070") == 0) { 
                                                        ALOGE("rt3070 Wi-Fi Module 4");
                                                        //wifi module 4 rt3070
                                                        strcpy(DRIVER_MODULE_NAME, WIFI_DRIVER_MODULE_NAME4);
                                                        strcpy(DRIVER_MODULE_TAG, WIFI_DRIVER_MODULE_NAME4 " ");
                                                        strcpy(DRIVER_MODULE_PATH, WIFI_DRIVER_MODULE_PATH4);
                                                        close(pid_fd);
                                                        close(vid_fd);
                                                        break;
                                                 }

  • vi hardware/libhardware_legacy/wifi/Android.mk
Build할 경우 동일하게 설정 
ifdef WIFI_DRIVER_MODULE_PATH
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_PATH=\"$(WIFI_DRIVER_MODULE_PATH)\"
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_PATH2=\"$(WIFI_DRIVER_MODULE_PATH2)\"
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_PATH3=\"$(WIFI_DRIVER_MODULE_PATH3)\"
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_PATH4=\"$(WIFI_DRIVER_MODULE_PATH4)\"
endif
...
ifdef WIFI_DRIVER_MODULE_NAME
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_NAME=\"$(WIFI_DRIVER_MODULE_NAME)\"
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_NAME2=\"$(WIFI_DRIVER_MODULE_NAME2)\"
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_NAME3=\"$(WIFI_DRIVER_MODULE_NAME3)\"
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_NAME4=\"$(WIFI_DRIVER_MODULE_NAME4)\"
endif


  • vi ./device/hardkernel/odroidx2/conf/init.odroidx2.rc
HAL 공유 Library만 변경
                libhardware_legacy.so

out/target/product/odroidx2/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates/wifi/wifi.o


./out/target/product/odroidx2/root/init.odroidx2.rc
./out/target/product/odroidx2/system/init.odroidx2.rc

cp rt3070sta.ko  to  device/hardkernel/odroidx2/drivers/

댓글 없음 :