Skip to content

Commit

Permalink
HID: thingm: remove the "play" sysfs attribute
Browse files Browse the repository at this point in the history
When the thingm driver registers an instance of LED class, it creates a
"play" sysfs attribute for this blink(1) specific feature.

Since this feature is not specific to the RGB chip but to the HID device
itself, let's remove this attribute from the LED instance and only
implement what is useful to switch on and off the LED.

This feature is still easily accessible through hidraw.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Vivien Didelot authored and Jiri Kosina committed Apr 15, 2014
1 parent 0f1b1e6 commit 21200ad
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 40 deletions.
7 changes: 0 additions & 7 deletions Documentation/ABI/testing/sysfs-driver-hid-thingm
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,3 @@ Description: This attribute allows to set a fade time in milliseconds for
the next color change. Read the attribute to know the current
fade time. The default value is set to 0 (no fade time). For
instance, set a fade time of 2 seconds with: echo 2000 > fade

What: /sys/class/leds/blink1::<serial>/play
Date: January 2013
Contact: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Description: This attribute is used to play/pause the light patterns. Write 1
to start playing, 0 to stop. Reading this attribute returns the
current playing status.
33 changes: 0 additions & 33 deletions drivers/hid/hid-thingm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@
* @rgb: 8-bit per channel RGB notation.
* @fade: fade time in hundredths of a second.
* @brightness: brightness coefficient.
* @play: play/pause in-memory patterns.
*/
struct blink1_data {
struct hid_device *hdev;
struct led_classdev led_cdev;
u32 rgb;
u16 fade;
u8 brightness;
bool play;
};

static int blink1_send_command(struct blink1_data *data,
Expand Down Expand Up @@ -155,41 +153,10 @@ static ssize_t blink1_store_fade(struct device *dev,
static DEVICE_ATTR(fade, S_IRUGO | S_IWUSR,
blink1_show_fade, blink1_store_fade);

static ssize_t blink1_show_play(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct blink1_data *data = dev_get_drvdata(dev->parent);

return sprintf(buf, "%d\n", data->play);
}

static ssize_t blink1_store_play(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct blink1_data *data = dev_get_drvdata(dev->parent);
u8 cmd[BLINK1_CMD_SIZE] = { 1, 'p', 0, 0, 0, 0, 0, 0, 0 };
long unsigned int play;
int ret;

ret = kstrtoul(buf, 10, &play);
if (ret)
return ret;

data->play = !!play;
cmd[2] = data->play;
ret = blink1_send_command(data, cmd);

return ret ? ret : count;
}

static DEVICE_ATTR(play, S_IRUGO | S_IWUSR,
blink1_show_play, blink1_store_play);

static const struct attribute_group blink1_sysfs_group = {
.attrs = (struct attribute *[]) {
&dev_attr_rgb.attr,
&dev_attr_fade.attr,
&dev_attr_play.attr,
NULL
},
};
Expand Down

0 comments on commit 21200ad

Please sign in to comment.