int main(int argc, char *argv[])
{
    long value = 0;
    if(argc != 2) {
        printf("wrong number of arguments\n");
        return -1;
    }
    value = strtol(argv[1], NULL, 10);
    set_wifi_power(value);
    return 0;
}
예제 #2
0
static int insmod(const char *filename, const char *args)
{
    void *module;
    unsigned int size;
    int ret;

    /* Use rfkill if "module" is 'rfkill' */
    if (!strncmp(DRIVER_MODULE_PATH, "rfkill", 6)) {
        return set_wifi_power(1);
    }

    module = load_file(filename, &size);
    if (!module)
        return -1;

    ret = init_module(module, size, args);

    free(module);

    return ret;
}
예제 #3
0
static int rmmod(const char *modname)
{
    int ret = -1;
    int maxtry = 10;

    /* Use rfkill if "module" is 'rfkill' */
    if (!strncmp(DRIVER_MODULE_PATH, "rfkill", 6)) {
        return set_wifi_power(0);
    }

    while (maxtry-- > 0) {
        ret = delete_module(modname, O_NONBLOCK | O_EXCL | O_TRUNC);
        if (ret < 0 && errno == EAGAIN)
            usleep(500000);
        else
            break;
    }

    if (ret != 0)
        LOGD("Unable to unload driver module \"%s\": %s\n",
             modname, strerror(errno));
    return ret;
}