From: Alexander Holler <holler@ahsoftware.de>
To: Alexandre Relange <alexandre@relange.org>
Cc: Jonathan Cameron <jic23@cam.ac.uk>, linux-iio@vger.kernel.org
Subject: Re: [PATCH 4/5] iio: mechanical: new HID sensor boolean switch
Date: Fri, 12 Jul 2013 21:34:34 +0200 [thread overview]
Message-ID: <51E05A4A.2000306@ahsoftware.de> (raw)
In-Reply-To: <1370962336-20739-4-git-send-email-alexandre@relange.org>
Am 11.06.2013 16:52, schrieb Alexandre Relange:
> Implements the Boolean Switch sensor from the USB sensor usage tables
> http://www.usb.org/developers/hidpage/HUTRR39b.pdf
>
> This code is based on drivers/iio/light/hid-sensor-als.c
>
> Signed-off-by: Alexandre Relange <alexandre@relange.org>
> ---
...
> +
> +/*Format: HID-SENSOR-usage_id_in_hex*/
> +/*Usage ID from spec for Boolean-Switch: 0x200061*/
> +#define DRIVER_NAME "HID-SENSOR-200061"
> +
...
> +static struct platform_driver hid_switch_platform_driver = {
> + .driver = {
> + .name = DRIVER_NAME,
> + .owner = THIS_MODULE,
> + },
> + .probe = hid_switch_probe,
> + .remove = hid_switch_remove,
> +};
> +module_platform_driver(hid_switch_platform_driver);
> +
You already might add the fix I've recently posted for all the other iio
HID drivers to let the module automatically loaded. It gives a nicier
driver name too.
I've pasted the patch for the als-driver for your reference below.
Be sure to change the usage id to the one for your driver.
Regards,
Alexander Holler
--------
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -30,10 +30,6 @@
#include <linux/iio/triggered_buffer.h>
#include "../common/hid-sensors/hid-sensor-trigger.h"
-/*Format: HID-SENSOR-usage_id_in_hex*/
-/*Usage ID from spec for Ambiant-Light: 0x200041*/
-#define DRIVER_NAME "HID-SENSOR-200041"
-
#define CHANNEL_SCAN_INDEX_ILLUM 0
struct als_state {
@@ -355,9 +351,19 @@ static int hid_als_remove(struct platform_device *pdev)
return 0;
}
+static struct platform_device_id hid_als_ids[] = {
+ {
+ /* Format: HID-SENSOR-usage_id_in_hex_lowercase */
+ .name = "HID-SENSOR-200041",
+ },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, hid_als_ids);
+
static struct platform_driver hid_als_platform_driver = {
+ .id_table = hid_als_ids,
.driver = {
- .name = DRIVER_NAME,
+ .name = KBUILD_MODNAME,
.owner = THIS_MODULE,
},
.probe = hid_als_probe,
-- 1.8.1.5
next prev parent reply other threads:[~2013-07-12 19:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-11 14:52 [PATCH 1/5] iio: ABI doc: update scan_elements sysfs paths Alexandre Relange
2013-06-11 14:52 ` [PATCH 2/5] iio: mechanical: new category of sensors Alexandre Relange
2013-07-07 15:29 ` Jonathan Cameron
2013-07-08 15:01 ` Alexandre Relange
2013-07-09 18:05 ` Jonathan Cameron
2013-06-11 14:52 ` [PATCH 3/5] iio: new type of channel: STATE Alexandre Relange
2013-06-11 14:52 ` [PATCH 4/5] iio: mechanical: new HID sensor boolean switch Alexandre Relange
2013-06-11 17:13 ` Lars-Peter Clausen
2013-06-11 20:18 ` Jonathan Cameron
2013-07-07 15:36 ` Jonathan Cameron
2013-07-08 15:17 ` Alexandre Relange
2013-07-09 18:06 ` Jonathan Cameron
2013-07-12 19:34 ` Alexander Holler [this message]
2013-06-11 14:52 ` [PATCH 5/5] iio: mechanical: switch sensor: add ID table Alexandre Relange
2013-06-11 17:07 ` [PATCH 1/5] iio: ABI doc: update scan_elements sysfs paths Lars-Peter Clausen
2013-06-11 20:10 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51E05A4A.2000306@ahsoftware.de \
--to=holler@ahsoftware.de \
--cc=alexandre@relange.org \
--cc=jic23@cam.ac.uk \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).