switch (buf[0]) {
case LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST:
switch (buf[1]) {
- case VARIAXMIDI_volume:
- variax->volume = buf[2];
- break;
-
case VARIAXMIDI_tone:
variax->tone = buf[2];
}
}
/*
- "read" request on "volume" special file.
-*/
-static ssize_t variax_get_volume(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct usb_line6_variax *variax =
- usb_get_intfdata(to_usb_interface(dev));
- return sprintf(buf, "%d\n", variax->volume);
-}
-
-/*
- "write" request on "volume" special file.
-*/
-static ssize_t variax_set_volume(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct usb_line6_variax *variax =
- usb_get_intfdata(to_usb_interface(dev));
- u8 value;
- int ret;
-
- ret = kstrtou8(buf, 10, &value);
- if (ret)
- return ret;
-
- if (line6_transmit_parameter(&variax->line6, VARIAXMIDI_volume,
- value) == 0)
- variax->volume = value;
-
- return count;
-}
-
-/*
"read" request on "active" special file.
*/
static ssize_t variax_get_active(struct device *dev,
#endif
/* Variax workbench special files: */
-static DEVICE_ATTR(volume, S_IWUSR | S_IRUGO, variax_get_volume,
- variax_set_volume);
static DEVICE_ATTR(tone, S_IWUSR | S_IRUGO, variax_get_tone, variax_set_tone);
static DEVICE_ATTR(name, S_IRUGO, variax_get_name, line6_nop_write);
static DEVICE_ATTR(bank, S_IRUGO, variax_get_bank, line6_nop_write);
static int variax_create_files2(struct device *dev)
{
int err;
- CHECK_RETURN(device_create_file(dev, &dev_attr_volume));
CHECK_RETURN(device_create_file(dev, &dev_attr_tone));
CHECK_RETURN(device_create_file(dev, &dev_attr_name));
CHECK_RETURN(device_create_file(dev, &dev_attr_bank));
if (dev != NULL) {
/* remove sysfs entries: */
line6_variax_remove_files(0, 0, dev);
- device_remove_file(dev, &dev_attr_volume);
device_remove_file(dev, &dev_attr_tone);
device_remove_file(dev, &dev_attr_name);
device_remove_file(dev, &dev_attr_bank);