Beispiel #1
0
static ssize_t store_control(struct device *d,
		struct device_attribute *attr, const char *buf, size_t count)
{
	struct modemctl *mc = dev_get_drvdata(d);

	if (!strncmp(buf, "on", 2)) {
		modem_on(mc);
		return count;
	}

	if (!strncmp(buf, "off", 3)) {
		modem_off(mc);
		return count;
	}

	if (!strncmp(buf, "reset", 5)) {
		modem_reset(mc);
		return count;
	}

	if (!strncmp(buf, "boot", 4)) {
		modem_boot(mc);
		return count;
	}

	if (!strncmp(buf, "daolpu", 6)) {
		kernel_upload(mc);
		return count;
	}

	return count;
}
static ssize_t store_control(struct device *d,
		struct device_attribute *attr, const char *buf, size_t count)
{
	struct modemctl *mc = dev_get_drvdata(d);

	if (!strncmp(buf, "on", 2)) {
		modem_on(mc);
		return count;
	}

	if (!strncmp(buf, "off", 3)) {
		modem_off(mc);
		return count;
	}

	if (!strncmp(buf, "reset", 5)) {
		modem_reset(mc);
		return count;
	}

	if (!strncmp(buf, "boot", 4)) {
		modem_boot(mc);
		return count;
	}

	if (!strncmp(buf, "renum", 6)) {
		enumeration(mc);
		return count;
	}
	if (!strncmp(buf, "phon", 4)) {
		gpio_set_value(mc->gpio_phone_on, 0);
		mdelay(1);
		gpio_set_value(mc->gpio_phone_on, 1);
		return count;
	}
	if (!strncmp(buf, "gsw=0", 5)) {
		gpio_set_value(mc->gpio_ipc_slave_wakeup, 0);
		return count;
	}
	if (!strncmp(buf, "gsw=1", 5)) {
		gpio_set_value(mc->gpio_ipc_slave_wakeup, 1);
		return count;
	}
	if (!strncmp(buf, "gat=0", 5)) {
		gpio_set_value(mc->gpio_active_state, 0);
		return count;
	}
	if (!strncmp(buf, "gat=1", 5)) {
		gpio_set_value(mc->gpio_active_state, 1);
		return count;
	}	
	return count;
}