Exemplo n.º 1
0
static int insmod_modules(char * buf)
{
        char * module_name;
        char insmod_name[128];
        char ko[] = ".ko";
        memset(insmod_name,0,sizeof(insmod_name));
        
        module_name = get_module_name(buf);
#ifdef DEBUG
        ALOGD("module_name:%s\n",module_name);
#endif
        if(module_name != NULL){
                sprintf(insmod_name,"%s%s%s",INSMOD_PATH,module_name,ko);
                
#ifdef  DEBUG
                ALOGD("start to insmod %s\n",insmod_name);
#endif                
                if (insmod(insmod_name, "") < 0) {
                        ALOGD(" %s insmod failed!\n",insmod_name);
                        rmmod(module_name);//it may be load driver already,try remove it and insmod again.
                        if (insmod(insmod_name, "") < 0){
                                ALOGD("%s,Once again fail to load!",insmod_name);
                                return 0;
                        }
                } 
        }
        return 1;
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
	char* chipVersion = NULL;
	int ret = -1;
	
  //Get the chipVersion
  chipVersion = getChipVersion();
  
#if 1
  if(NULL != chipVersion){
		strcat(DRIVER_MODULE_PATH, chipVersion);
		strcat(DRIVER_MODULE_PATH, ".ko");
	
	        ALOGD("DRIVER_MODULE_PATH is %s\n", DRIVER_MODULE_PATH);   
		if(0 == insmod(DRIVER_MODULE_PATH, DRIVER_MODULE_ARG)){  
  			ret = 0;
  			ALOGD("Success to insmod the %s\n", DRIVER_MODULE_PATH);
  		}else
  			ALOGD("Fail to insmod the %s\n", DRIVER_MODULE_PATH);	  
  		
  }else{
  	ALOGD("Fail to get the corroct combo chip version");
  }
#else

		if(0 == insmod("/system/lib/modules/wlan_mt.ko", DRIVER_MODULE_ARG)){  
  			ret = 0;
  			ALOGD("Success to insmod the %s\n", DRIVER_MODULE_PATH);
  		}else
  			ALOGD("Fail to insmod the %s\n", DRIVER_MODULE_PATH);	  
#endif

	return ret;
}
Exemplo n.º 3
0
static UINT32
audioInit(
	void
)
{
#ifdef SYSCONFIG_SPU
	if (insmod("gp_audio") != SP_OK) {
		DIAG_ERROR("insmod gp_audio error!\n");
		return SP_FAIL;
	}
	if (insmod("gp_mixer") != SP_OK) {
		DIAG_ERROR("insmod gp_mixer error!\n");
		return SP_FAIL;
	}
	if (insmod("gp_spu_module") != SP_OK) {
		DIAG_ERROR("insmod gp_spu_module error!\n");
		return SP_FAIL;
	}
#else 
#ifdef	SYSCONFIG_AUDIO
	if (insmod("gp_audio") != SP_OK) {
		DIAG_ERROR("insmod gp_audio error!\n");
		return SP_FAIL;
	}
	if (insmod("gp_mixer") != SP_OK) {
		DIAG_ERROR("insmod gp_mixer error!\n");
		return SP_FAIL;
	}
#endif
#endif
	return SP_OK;
}
Exemplo n.º 4
0
static UINT32
scalarInit(
	void
)
{
	if (insmod("gp_scale_module") != SP_OK) {
		DIAG_ERROR("insmod gp_scale_module error!\n");
		return SP_FAIL;
	}
	
	if( gp_ver.major == MACH_GPL32900 )
	{
		if (insmod("gp_scale2_module") != SP_OK) {
			DIAG_ERROR("insmod gp_scale_module error!\n");
			return SP_FAIL;
		}
	}

	if( gp_ver.major == MACH_GPL32900B )
	{	
		if (insmod("gp_scale2_module") != SP_OK) {
			DIAG_ERROR("insmod gp_scale_module error!\n");
			return SP_FAIL;
		}
	}

	return SP_OK;
}
Exemplo n.º 5
0
static UINT32
ppuInit(
	void
)
{
	
#ifdef SYSCONFIG_PPU
#if (SYSCONFIG_PPU == 1)
	if (insmod("gp_ppu_module") != SP_OK) {
		DIAG_ERROR("insmod gp_ppu_module error!\n");
		return SP_FAIL;
	}
#elif (SYSCONFIG_PPU == 2)
	if (insmod("gp_ppu_simple") != SP_OK) {
		DIAG_ERROR("insmod gp_ppu_simple error!\n");
		return SP_FAIL;
	}
#elif (SYSCONFIG_PPU == 3)
	if (insmod("gp_ppu_dma_module") != SP_OK) {
		DIAG_ERROR("insmod gp_ppu_dma_module error!\n");
		return SP_FAIL;
	}
#endif
#endif
	return SP_OK;
}
Exemplo n.º 6
0
int
start_rcamd(void)
{
	insmod("videodev", NULL);
	insmod("v4l2-common", NULL);
	insmod("input-core", NULL);
	insmod("uvcvideo", NULL);
	return 0;
}
Exemplo n.º 7
0
int wifi_load_p2p_driver()
{
#ifdef WIFI_DRIVER_MODULE_PATH
    char driver_status[PROPERTY_VALUE_MAX];
    int count = 100; /* wait at most 20 seconds for completion */

    if (is_wifi_driver_loaded()) {
        return 0;
    }

#if defined(IMX5X)
    if (insmod(DRIVER_COMPAT_MODULE_PATH, DRIVER_COMPAT_MODULE_ARG) < 0) {
        return -1;
	}
#endif

    if (insmod(DRIVER_SDIO_IF_MODULE_PATH, DRIVER_SDIO_IF_MODULE_ARG) < 0) {
        return -1;
    }

    if (insmod(DRIVER_MODULE_PATH, DRIVER_P2P_MODULE_ARG) < 0) {
        return -1;
    }

    if (strcmp(FIRMWARE_LOADER,"") == 0) {
	  //usleep(1.5*WIFI_DRIVER_LOADER_DELAY);
        property_set(DRIVER_PROP_NAME, "ok");
    }
    else {
        property_set("ctl.start", FIRMWARE_LOADER);
    }

    sched_yield();

    while (count-- > 0) {
        if (property_get(DRIVER_PROP_NAME, driver_status, NULL)) {
            if (strcmp(driver_status, "ok") == 0) {
                return 0;
            }
            else if (strcmp(DRIVER_PROP_NAME, "failed") == 0) {
                wifi_unload_driver();
                return -1;
            }
        }
        usleep(200000);
    }

    property_set(DRIVER_PROP_NAME, "timeout");
    wifi_unload_driver();

    return -1;
#else
    property_set(DRIVER_PROP_NAME, "ok");
    return 0;
#endif
}
Exemplo n.º 8
0
void start_sysinit(void)
{
	char buf[PATH_MAX];
	struct stat tmp_stat;
	time_t tm = 0;

	if (!nvram_match("disable_watchdog", "1"))
		eval("watchdog");
	/*
	 * Setup console 
	 */

	cprintf("sysinit() klogctl\n");
	klogctl(8, NULL, atoi(nvram_safe_get("console_loglevel")));
	cprintf("sysinit() get router\n");

	int brand = getRouterBrand();

	/*
	 * network drivers 
	 */
	insmod("ag7100_mod");
	int s;
	struct ifreq ifr;

	if ((s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW))) {
		char eabuf[32];

		strncpy(ifr.ifr_name, "eth0", IFNAMSIZ);
		ioctl(s, SIOCGIFHWADDR, &ifr);
		char macaddr[32];

		strcpy(macaddr,
		       ether_etoa((unsigned char *)ifr.ifr_hwaddr.sa_data,
				  eabuf));
		nvram_set("et0macaddr", macaddr);
		nvram_set("et0macaddr_safe", macaddr);
		close(s);
	}
#ifdef HAVE_MADWIFI_MIMO
	// insmod("ath_pci", "autocreate=none");
	insmod("ath_mimo_pci");
#endif

	// eval ("ifconfig", "wifi0", "up");

	/*
	 * Set a sane date 
	 */
	stime(&tm);
	nvram_set("wl0_ifname", "ath0");

	return;
	cprintf("done\n");
}
int wifi_load_hotspot_driver()
{
#ifndef WIFI_AP_DRIVER_MODULE_PATH
    return wifi_load_driver();
#else
    char driver_status[PROPERTY_VALUE_MAX];
    int count = 100; /* wait at most 20 seconds for completion */
    char module_arg[PROPERTY_VALUE_MAX];

    if (is_wifi_hotspot_driver_loaded()) {
        property_set(AP_DRIVER_PROP_NAME, "ok");
        return 0;
    }

    property_set(AP_DRIVER_PROP_NAME, "loading");

#ifdef WIFI_EXT_MODULE_PATH
    if (insmod(EXT_MODULE_PATH, EXT_MODULE_ARG) < 0)
        return -1;
    usleep(200000);
#endif

    property_get(AP_DRIVER_PROP_MODULE_ARG, module_arg, AP_DRIVER_MODULE_ARG);
    if (insmod(AP_DRIVER_MODULE_PATH, module_arg) < 0) {
#ifdef WIFI_EXT_MODULE_NAME
        rmmod(EXT_MODULE_NAME);
#endif
        return -1;
    }

    if (strcmp(AP_FIRMWARE_LOADER,"") == 0) {
        /* usleep(WIFI_DRIVER_LOADER_DELAY); */
        property_set(AP_DRIVER_PROP_NAME, "ok");
    }
    else {
        property_set("ctl.start", AP_FIRMWARE_LOADER);
    }
    sched_yield();
    while (count-- > 0) {
        if (property_get(AP_DRIVER_PROP_NAME, driver_status, NULL)) {
            if (strcmp(driver_status, "ok") == 0)
                return 0;
            else if (strcmp(AP_DRIVER_PROP_NAME, "failed") == 0) {
                wifi_unload_hotspot_driver();
                return -1;
            }
        }
        usleep(200000);
    }
    property_set(AP_DRIVER_PROP_NAME, "timeout");
    wifi_unload_hotspot_driver();
    return -1;
#endif
}
Exemplo n.º 10
0
int hotspot_load_driver()
{
    char driver_status[PROPERTY_VALUE_MAX];
    int count = 100; /* wait at most 20 seconds for completion */

    if (check_hotspot_driver_loaded()) {
        return 0;
    }

    if (!strcmp(PRELOADER,"") == 0) {
        LOGW("Starting WIFI pre-loader");
        property_set("ctl.start", PRELOADER);
    }

#ifdef WIFI_EXT_MODULE_PATH
    if (insmod(EXT_MODULE_PATH, EXT_MODULE_ARG) < 0)
        return -1;
    usleep(200000);
#endif

    if (insmod(AP_DRIVER_MODULE_PATH, AP_DRIVER_MODULE_ARG) < 0){
#ifdef WIFI_EXT_MODULE_NAME
        rmmod(EXT_MODULE_NAME);
#endif
        return -1;
    }

    if (strcmp(AP_FIRMWARE_LOADER,"") == 0) {
        usleep(WIFI_DRIVER_LOADER_DELAY);
        property_set(AP_DRIVER_PROP_NAME, "ok");
    }
    else {
        property_set("ctl.start", AP_FIRMWARE_LOADER);
        usleep(WIFI_DRIVER_LOADER_DELAY);
    }
    sched_yield();
    while (count-- > 0) {
        if (property_get(AP_DRIVER_PROP_NAME, driver_status, NULL)) {
            if (strcmp(driver_status, "ok") == 0)
                return 0;
            else if (strcmp(AP_DRIVER_PROP_NAME, "failed") == 0) {
                hotspot_unload_driver();
                return -1;
            }
        }
        usleep(200000);
    }
    property_set(AP_DRIVER_PROP_NAME, "timeout");
    hotspot_unload_driver();
    return -1;
}
Exemplo n.º 11
0
s32 wifi_qsap_load_driver(void)
{
    s32    size;
    s32        ret = 0;
    s32        retry;

    /* Unload the station mode driver first */
    wifi_qsap_unload_wifi_sta_driver();

    if (system(SDIO_POLLING_ON)) {
        LOGE("Could not turn on the polling...");
    }

    if (sizeof(WIFI_SDIO_IF_DRIVER_MODULE_PATH) > 0) {
       ret = insmod(WIFI_SDIO_IF_DRIVER_MODULE_PATH, WIFI_SDIO_IF_DRIVER_MODULE_ARG, WIFI_SDIO_IF_DRIVER_MODULE_NAME " ");

       if ( ret != 0 ) {
          LOGE("init_module failed sdioif\n");
          ret = eERR_LOAD_FAILED_SDIOIF;
          goto end;
      }

      sched_yield();
    }

    ret = insmod(WIFI_DRIVER_MODULE_PATH, WIFI_DRIVER_MODULE_ARG, WIFI_DRIVER_MODULE_NAME " ");

    if ( ret != 0 ) {
        if (sizeof(WIFI_SDIO_IF_DRIVER_MODULE_PATH) > 0) {
            if ( check_driver_loaded(WIFI_SDIO_IF_DRIVER_MODULE_NAME " ") ) {
                    if ( rmmod(WIFI_SDIO_IF_DRIVER_MODULE_NAME) ) {
                        LOGE("Unable to unload the station mode librasdioif driver\n");
              }
            }
        }
        LOGE("init_module failed libra_softap\n");
        ret = eERR_LOAD_FAILED_SOFTAP;
		goto end;
    }

    sched_yield();
    
	ret = eSUCCESS;

end:
    if(system(SDIO_POLLING_OFF)) {
        LOGE("Could not turn off the polling...");
    }

    return ret;
}
Exemplo n.º 12
0
static UINT32
usbWifiInit(
	void
)
{
	if (strcmp(SYSCONFIG_USB_WIFI, "None") != 0) {
		if (strcmp(SYSCONFIG_USB_WIFI, "AR9271") == 0) {
			system("insmod /lib/modules/common/compat.ko");
			system("insmod /lib/modules/common/compat_firmware_class.ko");
			system("insmod /lib/modules/common/kfifo.ko");
			system("insmod /lib/modules/common/cfg80211.ko");
			system("insmod /lib/modules/common/mac80211.ko");
			system("insmod /lib/modules/common/ath.ko");
			system("insmod /lib/modules/common/ath9k_hw.ko");
			system("insmod /lib/modules/common/ath9k_common.ko");
			system("insmod /lib/modules/common/ath9k_htc.ko");
		}
		else
			system("modprobe cfg80211");
			system("modprobe mac80211");
			system("modprobe sunrpc");
			if (strcmp(SYSCONFIG_PRODUCT, "gplus.microwindowsUI__gplus.evm32900b") != 0) {
				insmod("/lib/modules/common/%s.ko", SYSCONFIG_USB_WIFI);
			}
	}

	return SP_OK;
}
Exemplo n.º 13
0
int main(void)
{
	int ret;

	LOGD("WLAN MAC checker is working......");

	ret = check_wlan_mac();
	if (ret == 0)
		return 0;

	/* Or we try to get MAC via WiFi driver. */
	ret = insmod(DRIVER_MODULE_PATH);	
	if (ret < 0)
	{
		LOGD("Install wifi driver failed.");
		rmmod(DRIVER_MODULE_NAME);
		return -1;
	}

	system("busybox ifconfig wlan0 up");

	/* We can try to store MAC to file. */
	store_wlan_mac();

	rmmod(DRIVER_MODULE_NAME);

	return 0;
}
Exemplo n.º 14
0
static int gsensor_load_driver(struct sensors_poll_context_t *dev)
{
    int ret = -1; 
    char buffer[20];
    int bytes = 0;
    int values = 0;
    load_driver_value = 0;
    if(detect_value[0] < ( SENSORS_NUMBER + 1)) {
             ALOGD("start to isnmod %s.ko\n",sensors[detect_value[0]-1].name);
            if (insmod(driver_path[detect_value[0]-1].name, "") < 0) {
                          ALOGD("insmod %s.ko failed!",sensors[detect_value[0]-1].name);
                          rmmod(sensors[detect_value[0]-1].name);//it may be load driver already,try remove it.
                          return 0;
                     } 
           if(!(ret = sensor_init(dev))){
                 
                 ALOGD("sensor_init error !\n"); 
                 return 0;              
           }
    }else{
         ALOGD("detect_value isn't valid!\n");
         return 0;
    }
        
    return 1;
    
}
Exemplo n.º 15
0
int main(void)
{
	int ret;

	LOGD("BT MAC acquire is working......");
#if 0
	ret = check_wlan_mac();
	if (ret == 0)
		return 0;
#endif

	/* Or we try to get MAC via WiFi driver. then +1 as BT's MAC address */
	ret = insmod(DRIVER_MODULE_PATH);	
	if (ret < 0)
	{
		LOGD("Install wifi driver failed.");
		rmmod(DRIVER_MODULE_NAME);
		return -1;
	}
        
        usleep(500000);  //delay 500ms
	/* We can try to store MAC to file. */
	//store_wlan_mac();

	rmmod(DRIVER_MODULE_NAME);

	return 0;
}
Exemplo n.º 16
0
void modulerehash() {
  int i;
  sstring **mods;
  array *autoloads;
  
  if (moddir!=NULL)
    freesstring(moddir);
  
  if (modsuffix!=NULL)
    freesstring(modsuffix);

  clearmoduledeps();
  
  moddir=getcopyconfigitem("core","moduledir",".",100);
  modsuffix=getcopyconfigitem("core","modulesuffix",".so",5);  

  initmoduledeps();

  /* Check for auto-load modules */
  autoloads=getconfigitems("core","loadmodule");
  if (autoloads!=NULL) {
    mods=(sstring **)(autoloads->content);
    for (i=0;i<autoloads->cursi;i++) {
      insmod(mods[i]->content);
    }
  }
}
Exemplo n.º 17
0
int init_sdcard_driver(void)
{
    s_driver *driver = kmalloc(sizeof (s_driver));
    if (!driver)
        return 0;

    klog("[", 1, WHITE);
    klog("...", 3, RED);
    klog("]", 1, WHITE);

    driver->init = init_sdcard;
    driver->write = write_sdcard;
    driver->read = read_sdcard;
    driver->ioctl = ioctl_sdcard;

    int ret = insmod("/dev/sdcard", (void *)EMMC_BASE, driver);
    if (ret < 0)
    {
        klog("\b\b\b\bKO", 6, RED);
        klog("]\tSD card driver initialization failed.\n", 40, WHITE);
    }
    else
    {
        klog("\b\b\b\bOK", 6, GREEN);
        klog("]\tSD card driver initialized!\n", 30, WHITE);
    }

    return ret;
}
Exemplo n.º 18
0
int load_driver()
{
	poweron();
	insmod(0, 0);
	sleep(1);
	return 0;
}
Exemplo n.º 19
0
static int insmod_by_path (char *nameBuf, char * modulePath, char *preFix, char *postFix )
{
	int iRet = -1;
	int len = 0;
	int path_len = 0;

	/*no need to check, upper layer API will makesure this condition fullfill*/
	strcat (nameBuf, modulePath);
	strcat (nameBuf, preFix);
	strcat (nameBuf, postFix);
	strcat (nameBuf, WMT_MODULES_SUFF);

	insmod_retry:
	iRet = insmod(nameBuf, DRIVER_MODULE_ARG);
	if(iRet)
	{
		ALOGI("insert <%s> failed, len(%d), iret(%d), retrying\n", nameBuf, sizeof(nameBuf), iRet);
		/*break;*/
		usleep(800000);
		goto insmod_retry;
	}else
	{
		ALOGI("insert <%s> succeed,len(%d)\n", nameBuf, len);
		iRet = 0;
	}
	return 0;
}
Exemplo n.º 20
0
int wifi_load_driver()
{
    char driver_status[PROPERTY_VALUE_MAX];
    int count = 100; /* wait at most 20 seconds for completion */

    if (check_driver_loaded()) {
        return 0;
    }

    if (insmod(DRIVER_MODULE_PATH) < 0)
        return -1;
      
//    property_set("ctl.start", FIRMWARE_LOADER);
    sched_yield();
    while (count-- > 0) {
        if (property_get(DRIVER_PROP_NAME, driver_status, NULL)) {
            if (strcmp(driver_status, "ok") == 0)
                return 0;
            else if (strcmp(DRIVER_PROP_NAME, "failed") == 0)
                return -1;
        }
        usleep(200000);
    }
    property_set(DRIVER_PROP_NAME, "timeout");
    return -1;
}
Exemplo n.º 21
0
/* reloadmarked: this function loads all the modules marked for reloading. 
 * The way the array is ordered means we will do this in the "right" order. 
 * This means we won't do an isloaded() check for each one - we shouldn't
 * get any "already loaded" warnings so let them come out if they happen.
 */
void reloadmarked(void) {
  unsigned int i;
  
  for (i=0;i<knownmodules;i++) {
    if (moduledeps[i].reloading) {
      insmod(moduledeps[i].name->content);
    }
  }
}
Exemplo n.º 22
0
static UINT32
rtcInit(
	void
)
{
#ifdef SYSCONFIG_INTERNAL_RTC
	if (insmod("gp_rtc_module") != SP_OK) {
		DIAG_ERROR("insmod external_rtc error!\n");
		return SP_FAIL;
	}
#else
	if (insmod("/lib/modules/external_rtc.ko") != SP_OK) {
		DIAG_ERROR("insmod external_rtc error!\n");
		return SP_FAIL;
	}
#endif
	return SP_OK;
}
Exemplo n.º 23
0
static UINT32
timerInit(
	void
)
{
	if (insmod("gp_timer_module") != SP_OK) {
		DIAG_ERROR("insmod gp_tc_module error!\n");
		return SP_FAIL;
	}
}
Exemplo n.º 24
0
static UINT32
pwmInit(
	void
)
{
	if (insmod("gp_pwm_module") != SP_OK) {
		DIAG_ERROR("insmod gp_pwm_module error!\n");
		return SP_FAIL;
	}
}
Exemplo n.º 25
0
static UINT32
ti2cInit(
	void
)
{
	if(insmod("gp_ti2c_bus_module") != SP_OK){
		DIAG_ERROR("insmod TI2C bus error!\n");
		return SP_FAIL;
	}
}
Exemplo n.º 26
0
static UINT32
aesInit(
	void
)
{
	if (insmod("gp_aes_module") != SP_OK) {
		DIAG_ERROR("insmod gp_aes_module error!\n");
		return SP_FAIL;
	}
	return SP_OK;
}
Exemplo n.º 27
0
static UINT32
gpFastBootInit(
	void
)
{
	if(insmod("snapshot") != SP_OK) {
		DIAG_ERROR("insmod snapshot driver error!\n");
		return SP_FAIL;
	}
	return SP_OK;
}
Exemplo n.º 28
0
static UINT32
lineBufferInit(
	void
)
{
	if (insmod("gp_line_buffer_module") != SP_OK) {
		DIAG_ERROR("insmod gp_line_buffer_module error!\n");
		return SP_FAIL;
	}

	return SP_OK;
}
Exemplo n.º 29
0
static UINT32
boardInit(
	void
)
{
	if (insmod("/lib/modules/board_config.ko") != SP_OK) {
		DIAG_ERROR("insmod board_config error!\n");
		return SP_FAIL;
	}

	return SP_OK;
}
Exemplo n.º 30
0
static UINT32
boardCoreInit(
	void
)
{
	if (insmod("gp_board") != SP_OK) {
		DIAG_ERROR("insmod gp_board error!\n");
		return SP_FAIL;
	}

	return SP_OK;
}