void reload_modem_modules(int modem_type, int reload) { unlink(QMI_CLIENT_ID); #if (BOARD_NUM_USB_PORTS > 0) int ret = 0; if (modem_type == 3) { ret |= module_smart_unload("cdc_acm", 1); ret |= module_smart_unload("option", 1); if (ret) sleep(1); module_smart_load("rndis_host", NULL); module_smart_load("qmi_wwan", NULL); module_smart_load("cdc_mbim", NULL); module_smart_load("cdc_ncm", NULL); module_smart_load("sierra_net", NULL); } else { ret |= module_smart_unload("rndis_host", 1); ret |= module_smart_unload("qmi_wwan", 1); ret |= module_smart_unload("cdc_mbim", 1); ret |= module_smart_unload("cdc_ncm", 1); ret |= module_smart_unload("cdc_ether", 1); ret |= module_smart_unload("sierra_net", 1); if (ret) sleep(1); module_smart_load("cdc_acm", NULL); } module_smart_load("option", NULL); module_smart_load("sierra", NULL); if (reload) sleep(1); #endif }
void restart_watchdog_cpu(void) { if (nvram_get_int("watchdog_cpu") == 0) module_smart_unload("rt_timer_wdg", 0); else module_smart_load("rt_timer_wdg", NULL); }
void reload_modem_modules(int modem_type, int reload) { unlink(QMI_CLIENT_ID); int ret = 0; if (modem_type == 3) { ret |= module_smart_unload("cdc_acm", 1); ret |= module_smart_unload("option", 1); if (ret) sleep(1); module_smart_load("rndis_host"); module_smart_load("qmi_wwan"); module_smart_load("cdc_mbim"); module_smart_load("cdc_ncm"); } else { ret |= module_smart_unload("rndis_host", 1); ret |= module_smart_unload("qmi_wwan", 1); ret |= module_smart_unload("cdc_mbim", 1); ret |= module_smart_unload("cdc_ncm", 1); ret |= module_smart_unload("cdc_ether", 1); if (ret) sleep(1); module_smart_load("cdc_acm"); } module_smart_load("option"); if (reload) sleep(1); }
int mdev_sg_main(int argc, char **argv) { int isLock; const char *device_name, *action; if(argc < 3){ printf("Usage: %s [device_name] [action]\n", argv[0]); return 0; } device_name = argv[1]; action = argv[2]; usb_dbg("(%s): action=%s.\n", device_name, action); if(get_device_type_by_device(device_name) != DEVICE_TYPE_SG) return 0; // If remove the device? if(!check_hotplug_action(action)){ usb_dbg("(%s): Remove sg device.\n", device_name); return 0; } // Check Lock. if((isLock = file_lock((char *)device_name)) == -1){ usb_dbg("(%s): Can't set the file lock!\n", device_name); return 0; } if (nvram_get_int("modem_zcd") != 0) { if (module_smart_load("sr_mod")) sleep(1); } else { char vid[8] = {0}, pid[8] = {0}; char usb_port_id[64] = {0}; if (get_usb_port_by_device(device_name, usb_port_id, sizeof(usb_port_id))) { if (get_usb_vid(usb_port_id, vid, sizeof(vid)) && get_usb_pid(usb_port_id, pid, sizeof(pid))) perform_usb_modeswitch(vid, pid); } } usb_dbg("(%s): Success!\n", device_name); file_unlock(isLock); return 1; }
void reload_modem_modules(int modem_type, int reload) { unlink(QMI_CLIENT_ID); int ret = 0; ret |= module_smart_unload("option", 1); ret |= module_smart_unload("sierra", 1); ret |= module_smart_unload("qcserial", 1); ret |= module_smart_unload("cdc_acm", 1); if (modem_type == 3) { if (ret) sleep(1); module_smart_load("cdc_ether", NULL); module_smart_load("rndis_host", NULL); module_smart_load("qmi_wwan", NULL); module_smart_load("cdc_ncm", "prefer_mbim=0"); module_smart_load("huawei_cdc_ncm", NULL); module_smart_load("cdc_mbim", NULL); module_smart_load("sierra_net", NULL); } else { ret |= module_smart_unload("sierra_net", 1); ret |= module_smart_unload("cdc_mbim", 1); ret |= module_smart_unload("huawei_cdc_ncm", 1); ret |= module_smart_unload("cdc_ncm", 1); ret |= module_smart_unload("qmi_wwan", 1); ret |= module_smart_unload("rndis_host", 1); ret |= module_smart_unload("cdc_ether", 1); if (ret) sleep(1); module_smart_load("cdc_acm", NULL); } module_smart_load("qcserial", NULL); module_smart_load("sierra", NULL); module_smart_load("option", NULL); if (reload) sleep(1); }
void start_watchdog_cpu(void) { if (nvram_get_int("watchdog_cpu") != 0) module_smart_load("rt_timer_wdg", NULL); }