Skip to content

Instantly share code, notes, and snippets.

@sepfy
Created October 3, 2020 12:05
Show Gist options
  • Save sepfy/d43a22080cf99e008cce4af377398dd6 to your computer and use it in GitHub Desktop.
Save sepfy/d43a22080cf99e008cce4af377398dd6 to your computer and use it in GitHub Desktop.
static ssize_t attr_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
printk("[%s][%d]\n", __func__, __LINE__);
buzzer_trigger = simple_strtoul(buf, NULL, 10);
gpio_set_value(BUZZER, buzzer_trigger);
return count;
}
static ssize_t attr_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
int val = 0;
printk("[%s][%d]\n", __func__, __LINE__);
val = sprintf(buf, "%d\n", buzzer_trigger);
return val;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment