aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/testing/sysfs-driver-hid-thingm7
-rw-r--r--drivers/hid/hid-thingm.c33
2 files changed, 0 insertions, 40 deletions
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-thingm b/Documentation/ABI/testing/sysfs-driver-hid-thingm
index abcffeedd20a..fda6185b9292 100644
--- a/Documentation/ABI/testing/sysfs-driver-hid-thingm
+++ b/Documentation/ABI/testing/sysfs-driver-hid-thingm
@@ -14,10 +14,3 @@ Description: This attribute allows to set a fade time in milliseconds for
14 the next color change. Read the attribute to know the current 14 the next color change. Read the attribute to know the current
15 fade time. The default value is set to 0 (no fade time). For 15 fade time. The default value is set to 0 (no fade time). For
16 instance, set a fade time of 2 seconds with: echo 2000 > fade 16 instance, set a fade time of 2 seconds with: echo 2000 > fade
17
18What: /sys/class/leds/blink1::<serial>/play
19Date: January 2013
20Contact: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
21Description: This attribute is used to play/pause the light patterns. Write 1
22 to start playing, 0 to stop. Reading this attribute returns the
23 current playing status.
diff --git a/drivers/hid/hid-thingm.c b/drivers/hid/hid-thingm.c
index a97c78845f7b..7e376b855632 100644
--- a/drivers/hid/hid-thingm.c
+++ b/drivers/hid/hid-thingm.c
@@ -28,7 +28,6 @@
28 * @rgb: 8-bit per channel RGB notation. 28 * @rgb: 8-bit per channel RGB notation.
29 * @fade: fade time in hundredths of a second. 29 * @fade: fade time in hundredths of a second.
30 * @brightness: brightness coefficient. 30 * @brightness: brightness coefficient.
31 * @play: play/pause in-memory patterns.
32 */ 31 */
33struct blink1_data { 32struct blink1_data {
34 struct hid_device *hdev; 33 struct hid_device *hdev;
@@ -36,7 +35,6 @@ struct blink1_data {
36 u32 rgb; 35 u32 rgb;
37 u16 fade; 36 u16 fade;
38 u8 brightness; 37 u8 brightness;
39 bool play;
40}; 38};
41 39
42static int blink1_send_command(struct blink1_data *data, 40static int blink1_send_command(struct blink1_data *data,
@@ -155,41 +153,10 @@ static ssize_t blink1_store_fade(struct device *dev,
155static DEVICE_ATTR(fade, S_IRUGO | S_IWUSR, 153static DEVICE_ATTR(fade, S_IRUGO | S_IWUSR,
156 blink1_show_fade, blink1_store_fade); 154 blink1_show_fade, blink1_store_fade);
157 155
158static ssize_t blink1_show_play(struct device *dev,
159 struct device_attribute *attr, char *buf)
160{
161 struct blink1_data *data = dev_get_drvdata(dev->parent);
162
163 return sprintf(buf, "%d\n", data->play);
164}
165
166static ssize_t blink1_store_play(struct device *dev,
167 struct device_attribute *attr, const char *buf, size_t count)
168{
169 struct blink1_data *data = dev_get_drvdata(dev->parent);
170 u8 cmd[BLINK1_CMD_SIZE] = { 1, 'p', 0, 0, 0, 0, 0, 0, 0 };
171 long unsigned int play;
172 int ret;
173
174 ret = kstrtoul(buf, 10, &play);
175 if (ret)
176 return ret;
177
178 data->play = !!play;
179 cmd[2] = data->play;
180 ret = blink1_send_command(data, cmd);
181
182 return ret ? ret : count;
183}
184
185static DEVICE_ATTR(play, S_IRUGO | S_IWUSR,
186 blink1_show_play, blink1_store_play);
187
188static const struct attribute_group blink1_sysfs_group = { 156static const struct attribute_group blink1_sysfs_group = {
189 .attrs = (struct attribute *[]) { 157 .attrs = (struct attribute *[]) {
190 &dev_attr_rgb.attr, 158 &dev_attr_rgb.attr,
191 &dev_attr_fade.attr, 159 &dev_attr_fade.attr,
192 &dev_attr_play.attr,
193 NULL 160 NULL
194 }, 161 },
195}; 162};