コード例 #1
0
}

static ssize_t apds9130_store_enable(struct device *dev,
				struct device_attribute *attr, const char *buf, size_t count)
{
	struct i2c_client *client = to_i2c_client(dev);
	unsigned long val = simple_strtoul(buf, NULL, 10);

	printk(KERN_INFO"%s: enable ps senosr ( %ld)\n", __func__, val);

	if (val)
		apds9130_enable_ps_sensor(client, APDS9130_ENABLE_PS_WITH_INT);
	else
		apds9130_enable_ps_sensor(client, APDS9130_DISABLE_PS);
コード例 #2
0
static ssize_t apds9130_store_enable_ps_sensor(struct device *dev,
				struct device_attribute *attr, const char *buf, size_t count)
{
	struct i2c_client *client = to_i2c_client(dev);
	unsigned long val = simple_strtoul(buf, NULL, 10);
	
	printk("[ProximitySensor] %s(%ld)\n", __func__, val);
	
	if ((val != 0) && (val != 1)) {
		printk("[ProximitySensor] %s : invalid value(%ld)\n", __func__, val);
		return count;
	}

	apds9130_enable_ps_sensor(client, val);	
	
	return count;
}