* [PATCH 0/4] add custom hinge sensor support
@ 2020-11-19 3:03 Ye Xiang
2020-11-19 3:03 ` [PATCH 1/4] HID: hid-sensor-custom: Add custom sensor iio support Ye Xiang
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Ye Xiang @ 2020-11-19 3:03 UTC (permalink / raw)
To: jikos, jic23, srinivas.pandruvada
Cc: linux-input, linux-iio, linux-kernel, Ye Xiang
Here three separate iio devices are presented which presents angle for
hinge, keyboard and screen.
This driver works on devices with Intel integrated sensor hub, where
hinge sensor is presented using a custom sensor usage id.
Here the angle is presented in degrees, which is converted to radians.
Ye Xiang (4):
HID: hid-sensor-custom: Add custom sensor iio support
iio: hid-sensor-trigger: Decrement runtime pm enable count on driver
removal
iio: hid-sensor-trigger: Use iio->trig instead trig field internal
structure
iio: hid-sensors: Add hinge sensor driver
drivers/hid/hid-sensor-custom.c | 169 +++++++
.../hid-sensors/hid-sensor-attributes.c | 2 +
.../common/hid-sensors/hid-sensor-trigger.c | 8 +-
drivers/iio/position/Kconfig | 16 +
drivers/iio/position/Makefile | 3 +
.../iio/position/hid-sensor-custom-hinge.c | 412 ++++++++++++++++++
include/linux/hid-sensor-ids.h | 39 ++
7 files changed, 646 insertions(+), 3 deletions(-)
create mode 100644 drivers/iio/position/hid-sensor-custom-hinge.c
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] HID: hid-sensor-custom: Add custom sensor iio support
2020-11-19 3:03 [PATCH 0/4] add custom hinge sensor support Ye Xiang
@ 2020-11-19 3:03 ` Ye Xiang
2020-11-19 6:56 ` kernel test robot
2020-11-19 3:03 ` [PATCH 2/4] iio: hid-sensor-trigger: Decrement runtime pm enable count on driver removal Ye Xiang
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Ye Xiang @ 2020-11-19 3:03 UTC (permalink / raw)
To: jikos, jic23, srinivas.pandruvada
Cc: linux-input, linux-iio, linux-kernel, Ye Xiang
Currently custom sensors properties are not decoded and it is up to
user space to interpret.
Some manufacturers already standardized the meaning of some custom sensors.
They can be presented as a proper IIO sensor. We can identify these sensors
based on manufacturer and serial number property in the report.
This change is identifying hinge sensor when the manufacturer is "INTEL".
This creates a platform device so that a sensor driver can be loaded to
process these sensors.
Signed-off-by: Ye Xiang <xiang.ye@intel.com>
---
drivers/hid/hid-sensor-custom.c | 169 ++++++++++++++++++++++++++++++++
include/linux/hid-sensor-ids.h | 39 ++++++++
2 files changed, 208 insertions(+)
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index 4d25577a8573..6ef8387405b3 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -4,6 +4,7 @@
* Copyright (c) 2015, Intel Corporation.
*/
+#include <linux/ctype.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -21,6 +22,7 @@
#define HID_CUSTOM_TOTAL_ATTRS (HID_CUSTOM_MAX_CORE_ATTRS + 1)
#define HID_CUSTOM_FIFO_SIZE 4096
#define HID_CUSTOM_MAX_FEATURE_BYTES 64
+#define HID_SENSOR_USAGE_LENGTH (4 + 1)
struct hid_sensor_custom_field {
int report_id;
@@ -50,6 +52,8 @@ struct hid_sensor_custom {
struct kfifo data_fifo;
unsigned long misc_opened;
wait_queue_head_t wait;
+ struct platform_device *custom_pdev;
+ bool custom_pdev_exposed;
};
/* Header for each sample to user space via dev interface */
@@ -746,11 +750,158 @@ static void hid_sensor_custom_dev_if_remove(struct hid_sensor_custom
}
+/*
+ * use sensors luid which is defined in FW, such as ISH,
+ * to identify sensor.
+ */
+static char *known_sensor_luid[] = { "020B000000000000" };
+
+static int get_luid_table_index(unsigned char *usage_str)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(known_sensor_luid); i++) {
+ if (!strncmp(usage_str, known_sensor_luid[i],
+ strlen(known_sensor_luid[i])))
+ return i;
+ }
+
+ return -1;
+}
+
+static int get_known_custom_sensor_index(struct hid_sensor_hub_device *hsdev)
+{
+ struct hid_sensor_hub_attribute_info sensor_manufacturer = { 0 };
+ struct hid_sensor_hub_attribute_info sensor_luid_info = { 0 };
+ int report_size;
+ int ret;
+ u16 *w_buf;
+ int w_buf_len;
+ char *buf;
+ int buf_len;
+ int i;
+ int index;
+
+ w_buf_len = sizeof(u16) * HID_CUSTOM_MAX_FEATURE_BYTES;
+ buf_len = sizeof(char) * HID_CUSTOM_MAX_FEATURE_BYTES;
+ w_buf = kzalloc(w_buf_len, GFP_KERNEL);
+ if (!w_buf)
+ return -1;
+
+ buf = kzalloc(buf_len, GFP_KERNEL);
+ if (!buf) {
+ kfree(w_buf);
+ return -1;
+ }
+
+ /* get manufacturer info */
+ ret = sensor_hub_input_get_attribute_info(
+ hsdev, HID_FEATURE_REPORT, hsdev->usage,
+ HID_USAGE_SENSOR_PROP_MANUFACTURER, &sensor_manufacturer);
+ if (ret < 0)
+ goto err_out;
+
+ report_size =
+ sensor_hub_get_feature(hsdev, sensor_manufacturer.report_id,
+ sensor_manufacturer.index, w_buf_len,
+ w_buf);
+ if (report_size <= 0) {
+ hid_err(hsdev->hdev,
+ "Failed to get sensor manufacturer info %d\n",
+ report_size);
+ goto err_out;
+ }
+
+ /* convert from wide char to char */
+ for (i = 0; i < buf_len - 1 && w_buf[i]; i++)
+ buf[i] = (char)w_buf[i];
+
+ /* ensure it's ISH sensor */
+ if (strncmp(buf, "INTEL", strlen("INTEL")))
+ goto err_out;
+
+ memset(w_buf, 0, w_buf_len);
+ memset(buf, 0, buf_len);
+
+ /* get real usage id */
+ ret = sensor_hub_input_get_attribute_info(
+ hsdev, HID_FEATURE_REPORT, hsdev->usage,
+ HID_USAGE_SENSOR_PROP_SERIAL_NUM, &sensor_luid_info);
+ if (ret < 0)
+ goto err_out;
+
+ report_size = sensor_hub_get_feature(hsdev, sensor_luid_info.report_id,
+ sensor_luid_info.index, w_buf_len,
+ w_buf);
+ if (report_size <= 0) {
+ hid_err(hsdev->hdev, "Failed to get real usage info %d\n",
+ report_size);
+ goto err_out;
+ }
+
+ /* convert from wide char to char */
+ for (i = 0; i < buf_len - 1 && w_buf[i]; i++)
+ buf[i] = (char)w_buf[i];
+
+ if (strlen(buf) != strlen(known_sensor_luid[0]) + 5) {
+ hid_err(hsdev->hdev, " %ld != %ld\n", strlen(buf),
+ strlen(known_sensor_luid[0]));
+ goto err_out;
+ }
+
+ /* get table index with luid (not matching 'LUID: ' in luid) */
+ index = get_luid_table_index(&buf[5]);
+ kfree(w_buf);
+ kfree(buf);
+ return index;
+
+err_out:
+ kfree(w_buf);
+ kfree(buf);
+ return -1;
+}
+
+static struct platform_device *
+register_platform_device(struct platform_device *pdev,
+ struct hid_sensor_hub_device *hsdev, int index)
+{
+ char real_usage[HID_SENSOR_USAGE_LENGTH] = { 0 };
+ struct platform_device *custom_pdev;
+ const char *dev_name;
+ char *c;
+ int ret;
+
+ /* copy real usage id */
+ memcpy(real_usage, known_sensor_luid[index], 4);
+
+ /* usage id are all lowcase */
+ for (c = real_usage; *c != '\0'; c++)
+ *c = tolower(*c);
+
+ /* HID-SENSOR-INT-REAL_USAGE_ID */
+ dev_name = kasprintf(GFP_KERNEL, "HID-SENSOR-INT-%s", real_usage);
+ if (!dev_name)
+ return NULL;
+
+ custom_pdev = platform_device_register_data(pdev->dev.parent, dev_name,
+ PLATFORM_DEVID_NONE, hsdev,
+ sizeof(*hsdev));
+ kfree(dev_name);
+ ret = PTR_ERR_OR_ZERO(custom_pdev);
+ if (ret) {
+ dev_err(&pdev->dev, "platform_device_register_data failed ret:%d\n", ret);
+ return NULL;
+ }
+
+ return custom_pdev;
+}
+
static int hid_sensor_custom_probe(struct platform_device *pdev)
{
struct hid_sensor_custom *sensor_inst;
struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
int ret;
+ int index;
sensor_inst = devm_kzalloc(&pdev->dev, sizeof(*sensor_inst),
GFP_KERNEL);
@@ -764,6 +915,19 @@ static int hid_sensor_custom_probe(struct platform_device *pdev)
sensor_inst->pdev = pdev;
mutex_init(&sensor_inst->mutex);
platform_set_drvdata(pdev, sensor_inst);
+
+ index = get_known_custom_sensor_index(hsdev);
+ if (index >= 0) {
+ sensor_inst->custom_pdev =
+ register_platform_device(pdev, hsdev, index);
+ if (sensor_inst->custom_pdev) {
+ sensor_inst->custom_pdev_exposed = true;
+ return 0;
+ }
+
+ dev_err(&pdev->dev, "register_platform_device failed\n");
+ }
+
ret = sensor_hub_register_callback(hsdev, hsdev->usage,
&sensor_inst->callbacks);
if (ret < 0) {
@@ -802,6 +966,11 @@ static int hid_sensor_custom_remove(struct platform_device *pdev)
struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev);
struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ if (sensor_inst->custom_pdev_exposed) {
+ platform_device_unregister(sensor_inst->custom_pdev);
+ return 0;
+ }
+
hid_sensor_custom_dev_if_remove(sensor_inst);
hid_sensor_custom_remove_attributes(sensor_inst);
sysfs_remove_group(&sensor_inst->pdev->dev.kobj,
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 530c09f3e64a..46db3056f04b 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -128,6 +128,10 @@
#define HID_USAGE_SENSOR_UNITS_DEGREES_PER_SECOND 0x15
/* Common selectors */
+#define HID_USAGE_SENSOR_PROP_DESC 0x200300
+#define HID_USAGE_SENSOR_PROP_FRIENDLY_NAME 0x200301
+#define HID_USAGE_SENSOR_PROP_SERIAL_NUM 0x200307
+#define HID_USAGE_SENSOR_PROP_MANUFACTURER 0x200305
#define HID_USAGE_SENSOR_PROP_REPORT_INTERVAL 0x20030E
#define HID_USAGE_SENSOR_PROP_SENSITIVITY_ABS 0x20030F
#define HID_USAGE_SENSOR_PROP_SENSITIVITY_RANGE_PCT 0x200310
@@ -159,4 +163,39 @@
#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x200840
#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x200841
+/* Custom Sensor (2000e1) */
+#define HID_USAGE_SENSOR_HINGE 0x20020B
+#define HID_USAGE_SENSOR_DATA_FIELD_LOCATION 0x200400
+#define HID_USAGE_SENSOR_DATA_FIELE_TIME_SINCE_SYS_BOOT 0x20052B
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_USAGE 0x200541
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE 0x200543
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_1 0x200544
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_2 0x200545
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_3 0x200546
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_4 0x200547
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_5 0x200548
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_6 0x200549
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_7 0x20054A
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_8 0x20054B
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_9 0x20054C
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_10 0x20054D
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_11 0x20054E
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_12 0x20054F
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_13 0x200550
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_14 0x200551
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_15 0x200552
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_16 0x200553
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_17 0x200554
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_18 0x200555
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_19 0x200556
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_20 0x200557
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_21 0x200558
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_22 0x200559
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_23 0x20055A
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_24 0x20055B
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_25 0x20055C
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_26 0x20055D
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_27 0x20055E
+#define HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_28 0x20055F
+
#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] iio: hid-sensor-trigger: Decrement runtime pm enable count on driver removal
2020-11-19 3:03 [PATCH 0/4] add custom hinge sensor support Ye Xiang
2020-11-19 3:03 ` [PATCH 1/4] HID: hid-sensor-custom: Add custom sensor iio support Ye Xiang
@ 2020-11-19 3:03 ` Ye Xiang
2020-11-19 3:03 ` [PATCH 3/4] iio: hid-sensor-trigger: Use iio->trig instead trig field internal structure Ye Xiang
2020-11-19 3:03 ` [PATCH 4/4] iio: hid-sensors: Add hinge sensor driver Ye Xiang
3 siblings, 0 replies; 6+ messages in thread
From: Ye Xiang @ 2020-11-19 3:03 UTC (permalink / raw)
To: jikos, jic23, srinivas.pandruvada
Cc: linux-input, linux-iio, linux-kernel, Ye Xiang
To avoid pm_runtime_disable called repeatedly by hid sensor drivers,
decrease runtime pm enable count after call it.
Signed-off-by: Ye Xiang <xiang.ye@intel.com>
---
drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index ff375790b7e8..30340abcbc8d 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -227,8 +227,10 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
void hid_sensor_remove_trigger(struct iio_dev *indio_dev,
struct hid_sensor_common *attrb)
{
- if (atomic_read(&attrb->runtime_pm_enable))
+ if (atomic_read(&attrb->runtime_pm_enable)) {
pm_runtime_disable(&attrb->pdev->dev);
+ atomic_dec(&attrb->runtime_pm_enable);
+ }
pm_runtime_set_suspended(&attrb->pdev->dev);
pm_runtime_put_noidle(&attrb->pdev->dev);
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] iio: hid-sensor-trigger: Use iio->trig instead trig field internal structure
2020-11-19 3:03 [PATCH 0/4] add custom hinge sensor support Ye Xiang
2020-11-19 3:03 ` [PATCH 1/4] HID: hid-sensor-custom: Add custom sensor iio support Ye Xiang
2020-11-19 3:03 ` [PATCH 2/4] iio: hid-sensor-trigger: Decrement runtime pm enable count on driver removal Ye Xiang
@ 2020-11-19 3:03 ` Ye Xiang
2020-11-19 3:03 ` [PATCH 4/4] iio: hid-sensors: Add hinge sensor driver Ye Xiang
3 siblings, 0 replies; 6+ messages in thread
From: Ye Xiang @ 2020-11-19 3:03 UTC (permalink / raw)
To: jikos, jic23, srinivas.pandruvada
Cc: linux-input, linux-iio, linux-kernel, Ye Xiang
Use iio->trig instead of attrb->trig as parameter of iio_trigger_unregister
and iio_trigger_free. This allows one HID sensor driver to create
multiple iio devices. In this case common attributes are shared and
there can be one instance for the structure containing common attributes
for all iio devices.
Signed-off-by: Ye Xiang <xiang.ye@intel.com>
---
drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index 30340abcbc8d..bb5e7c8ff15b 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -236,8 +236,8 @@ void hid_sensor_remove_trigger(struct iio_dev *indio_dev,
pm_runtime_put_noidle(&attrb->pdev->dev);
cancel_work_sync(&attrb->work);
- iio_trigger_unregister(attrb->trigger);
- iio_trigger_free(attrb->trigger);
+ iio_trigger_unregister(indio_dev->trig);
+ iio_trigger_free(indio_dev->trig);
iio_triggered_buffer_cleanup(indio_dev);
}
EXPORT_SYMBOL(hid_sensor_remove_trigger);
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] iio: hid-sensors: Add hinge sensor driver
2020-11-19 3:03 [PATCH 0/4] add custom hinge sensor support Ye Xiang
` (2 preceding siblings ...)
2020-11-19 3:03 ` [PATCH 3/4] iio: hid-sensor-trigger: Use iio->trig instead trig field internal structure Ye Xiang
@ 2020-11-19 3:03 ` Ye Xiang
3 siblings, 0 replies; 6+ messages in thread
From: Ye Xiang @ 2020-11-19 3:03 UTC (permalink / raw)
To: jikos, jic23, srinivas.pandruvada
Cc: linux-input, linux-iio, linux-kernel, Ye Xiang
The Hinge sensor is a common custom sensor on laptops. It calculates
the angle between the lid (screen) and the base (keyboard). In addition,
it also exposes screen and the keyboard angels with respect to the
ground. Applications can easily get laptop's status in space through
this sensor, in order to display appropriate user interface.
Signed-off-by: Ye Xiang <xiang.ye@intel.com>
---
.../hid-sensors/hid-sensor-attributes.c | 2 +
drivers/iio/position/Kconfig | 16 +
drivers/iio/position/Makefile | 3 +
.../iio/position/hid-sensor-custom-hinge.c | 412 ++++++++++++++++++
4 files changed, 433 insertions(+)
create mode 100644 drivers/iio/position/hid-sensor-custom-hinge.c
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
index 442ff787f7af..5b822a4298a0 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c
@@ -71,6 +71,8 @@ static struct {
{HID_USAGE_SENSOR_TEMPERATURE, HID_USAGE_SENSOR_UNITS_DEGREES, 1000, 0},
{HID_USAGE_SENSOR_HUMIDITY, 0, 1000, 0},
+ {HID_USAGE_SENSOR_HINGE, 0, 0, 17453293},
+ {HID_USAGE_SENSOR_HINGE, HID_USAGE_SENSOR_UNITS_DEGREES, 0, 17453293},
};
static void simple_div(int dividend, int divisor, int *whole,
diff --git a/drivers/iio/position/Kconfig b/drivers/iio/position/Kconfig
index eda67f008c5b..0346f6f2b422 100644
--- a/drivers/iio/position/Kconfig
+++ b/drivers/iio/position/Kconfig
@@ -16,4 +16,20 @@ config IQS624_POS
To compile this driver as a module, choose M here: the module
will be called iqs624-pos.
+config HID_SENSOR_CUSTOM_HINGE
+ depends on HID_SENSOR_HUB
+ select IIO_BUFFER
+ select IIO_TRIGGERED_BUFFER
+ select HID_SENSOR_IIO_COMMON
+ select HID_SENSOR_IIO_TRIGGER
+ tristate "HID Hinge"
+ help
+ This sensor present three angles, hinge angel, screen angles
+ and keyboard angle respect to horizon (ground).
+ Say yes here to build support for the HID SENSOR CUSTOM
+ HINGE.
+
+ To compile this driver as a module, choose M here: the
+ module will be called hid-sensor-custom-hinge.
+
endmenu
diff --git a/drivers/iio/position/Makefile b/drivers/iio/position/Makefile
index 3cbe7a734352..7a6225977a01 100644
--- a/drivers/iio/position/Makefile
+++ b/drivers/iio/position/Makefile
@@ -5,3 +5,6 @@
# When adding new entries keep the list in alphabetical order
obj-$(CONFIG_IQS624_POS) += iqs624-pos.o
+
+obj-$(CONFIG_HID_SENSOR_CUSTOM_HINGE) += hid-sensor-custom-hinge.o
+ccflags-y += -I$(srctree)/drivers/iio/common/hid-sensors
diff --git a/drivers/iio/position/hid-sensor-custom-hinge.c b/drivers/iio/position/hid-sensor-custom-hinge.c
new file mode 100644
index 000000000000..a91b333f36fa
--- /dev/null
+++ b/drivers/iio/position/hid-sensor-custom-hinge.c
@@ -0,0 +1,412 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * HID Sensors Driver
+ * Copyright (c) 2020, Intel Corporation.
+ */
+#include <linux/hid-sensor-hub.h>
+#include <linux/iio/buffer.h>
+#include <linux/iio/iio.h>
+#include <linux/platform_device.h>
+
+#include "hid-sensor-trigger.h"
+
+/* Channel definitions */
+static const struct iio_chan_spec hinge_channels[] = {
+ { .type = IIO_ANGL,
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+ .info_mask_shared_by_type =
+ BIT(IIO_CHAN_INFO_OFFSET) | BIT(IIO_CHAN_INFO_SCALE) |
+ BIT(IIO_CHAN_INFO_SAMP_FREQ) | BIT(IIO_CHAN_INFO_HYSTERESIS),
+ .scan_type.realbits = 16,
+ .scan_type.storagebits = 32,
+ .scan_type.sign = 's',
+ .scan_index = 0 },
+
+ IIO_CHAN_SOFT_TIMESTAMP(1)
+};
+
+struct hinge_state {
+ struct iio_dev *indio_dev;
+ struct hid_sensor_hub_attribute_info hinge;
+ /* Reserve for 1 channel + pading + timestamp */
+ u32 hinge_val[1 + 3];
+ int scale_pre_decml;
+ int scale_post_decml;
+ int scale_precision;
+ int value_offset;
+ int64_t timestamp;
+ u32 hinge_address;
+};
+
+#define IIO_DEV_NUM 3
+
+struct hinge_group {
+ struct hinge_state *hg_states[IIO_DEV_NUM];
+ struct hid_sensor_hub_callbacks callbacks;
+ struct hid_sensor_common common_attributes;
+};
+
+static struct hinge_group *hg_group;
+
+/* Channel read_raw handler */
+static int hinge_read_raw(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan, int *val, int *val2,
+ long mask)
+{
+ struct hinge_state *hg_state = iio_priv(indio_dev);
+ struct hid_sensor_hub_device *hsdev;
+ int report_id = -1;
+ int ret_type;
+ s32 min;
+
+ hsdev = hg_group->common_attributes.hsdev;
+
+ *val = 0;
+ *val2 = 0;
+ switch (mask) {
+ case IIO_CHAN_INFO_RAW:
+ hid_sensor_power_state(&hg_group->common_attributes, true);
+ report_id = hg_state->hinge.report_id;
+ min = hg_state->hinge.logical_minimum;
+ if (report_id < 0) {
+ *val = 0;
+ hid_sensor_power_state(&hg_group->common_attributes,
+ false);
+ return -EINVAL;
+ }
+
+ *val = sensor_hub_input_attr_get_raw_value(
+ hg_group->common_attributes.hsdev, hsdev->usage,
+ hg_state->hinge_address, report_id, SENSOR_HUB_SYNC,
+ min < 0);
+
+ hid_sensor_power_state(&hg_group->common_attributes, false);
+ ret_type = IIO_VAL_INT;
+ break;
+ case IIO_CHAN_INFO_SCALE:
+ *val = hg_state->scale_pre_decml;
+ *val2 = hg_state->scale_post_decml;
+ ret_type = hg_state->scale_precision;
+ break;
+ case IIO_CHAN_INFO_OFFSET:
+ *val = hg_state->value_offset;
+ ret_type = IIO_VAL_INT;
+ break;
+ case IIO_CHAN_INFO_SAMP_FREQ:
+ ret_type = hid_sensor_read_samp_freq_value(
+ &hg_group->common_attributes, val, val2);
+ break;
+ case IIO_CHAN_INFO_HYSTERESIS:
+ ret_type = hid_sensor_read_raw_hyst_value(
+ &hg_group->common_attributes, val, val2);
+ break;
+ default:
+ ret_type = -EINVAL;
+ break;
+ }
+
+ return ret_type;
+}
+
+/* Channel write_raw handler */
+static int hinge_write_raw(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan, int val, int val2,
+ long mask)
+{
+ int ret;
+
+ switch (mask) {
+ case IIO_CHAN_INFO_SAMP_FREQ:
+ ret = hid_sensor_write_samp_freq_value(
+ &hg_group->common_attributes, val, val2);
+ break;
+ case IIO_CHAN_INFO_HYSTERESIS:
+ ret = hid_sensor_write_raw_hyst_value(
+ &hg_group->common_attributes, val, val2);
+
+ break;
+ default:
+ ret = -EINVAL;
+ }
+
+ return ret;
+}
+
+static const struct iio_info hinge_info = {
+ .read_raw = &hinge_read_raw,
+ .write_raw = &hinge_write_raw,
+};
+
+/*
+ * Function to push data to buffer;
+ * wrapper added for symmetry with other hid-sensor drivers
+ */
+static void hid_sensor_push_data(struct iio_dev *indio_dev, void *data, int len,
+ int64_t timestamp)
+{
+ iio_push_to_buffers_with_timestamp(indio_dev, data, timestamp);
+}
+
+/*
+ * Callback handler to send event after all samples are received
+ * and captured.
+ */
+static int hinge_proc_event(struct hid_sensor_hub_device *hsdev,
+ unsigned int usage_id, void *priv)
+{
+ int i;
+
+ for (i = 0; i < IIO_DEV_NUM; ++i) {
+ struct hinge_state *hg_state;
+ struct iio_dev *indio_dev;
+
+ hg_state = hg_group->hg_states[i];
+ indio_dev = hg_state->indio_dev;
+
+ dev_dbg(&indio_dev->dev, "%s timestamp:%llu scan_bytes:%d\n",
+ __func__, hg_state->timestamp, indio_dev->scan_bytes);
+
+ if (!hg_state->timestamp)
+ hg_state->timestamp = iio_get_time_ns(indio_dev);
+
+ hid_sensor_push_data(indio_dev, hg_state->hinge_val,
+ sizeof(hg_state->hinge_val),
+ hg_state->timestamp);
+
+ hg_state->timestamp = 0;
+ }
+
+ return 0;
+}
+
+/* Capture samples in local storage */
+static int hinge_capture_sample(struct hid_sensor_hub_device *hsdev,
+ unsigned int usage_id, size_t raw_len,
+ char *raw_data, void *priv)
+{
+ struct hinge_state *hg_state;
+ int offset;
+ int ret = -EINVAL;
+ int i;
+
+ if (usage_id == HID_USAGE_SENSOR_TIME_TIMESTAMP) {
+ for (i = 0; i < IIO_DEV_NUM; i++)
+ hg_group->hg_states[i]->timestamp =
+ hid_sensor_convert_timestamp(
+ &hg_group->common_attributes,
+ *(int64_t *)raw_data);
+ return 0;
+ }
+
+ switch (usage_id) {
+ case HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_1:
+ case HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_2:
+ case HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_3:
+ offset = usage_id - HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_1;
+ hg_state = hg_group->hg_states[offset];
+ hg_state->hinge_val[0] = *(u32 *)raw_data;
+ ret = 0;
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+/* Parse report which is specific to an usage id */
+static int hinge_parse_report(struct platform_device *pdev,
+ struct hid_sensor_hub_device *hsdev,
+ unsigned int usage_id, unsigned int attr_usage_id,
+ struct hinge_state *st)
+{
+ int ret;
+
+ ret = sensor_hub_input_get_attribute_info(
+ hsdev, HID_INPUT_REPORT, usage_id, attr_usage_id, &st->hinge);
+ if (ret < 0)
+ return ret;
+
+ st->hinge_address = attr_usage_id;
+ st->scale_precision =
+ hid_sensor_format_scale(HID_USAGE_SENSOR_HINGE, &st->hinge,
+ &st->scale_pre_decml,
+ &st->scale_post_decml);
+
+ /* Set Sensitivity field ids, when there is no individual modifier */
+ if (hg_group->common_attributes.sensitivity.index < 0) {
+ sensor_hub_input_get_attribute_info(
+ hsdev, HID_FEATURE_REPORT, usage_id,
+ HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS |
+ HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_1,
+ &hg_group->common_attributes.sensitivity);
+ dev_dbg(&pdev->dev, "Sensitivity index:report %d:%d\n",
+ hg_group->common_attributes.sensitivity.index,
+ hg_group->common_attributes.sensitivity.report_id);
+ }
+
+ return ret;
+}
+
+/* Function to initialize the processing for usage id */
+static int hinge_add_iio_device(struct platform_device *pdev, int index,
+ const char *name, struct hinge_state **st)
+{
+ struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hinge_state *hg_state;
+ struct iio_dev *indio_dev;
+ int ret;
+
+ indio_dev =
+ devm_iio_device_alloc(&pdev->dev, sizeof(struct hinge_state));
+ if (indio_dev == NULL)
+ return -ENOMEM;
+
+ hg_state = iio_priv(indio_dev);
+ hg_state->indio_dev = indio_dev;
+
+ indio_dev->num_channels = ARRAY_SIZE(hinge_channels);
+ indio_dev->channels =
+ kmemdup(hinge_channels, sizeof(hinge_channels), GFP_KERNEL);
+ if (!indio_dev->channels)
+ return -ENOMEM;
+
+ ret = hinge_parse_report(
+ pdev, hsdev, hsdev->usage,
+ HID_USAGE_SENSOR_DATA_FIELD_CUSTOM_VALUE_1 + index, hg_state);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to setup attributes\n");
+ goto error_free_dev_mem;
+ }
+
+ indio_dev->dev.parent = &pdev->dev;
+ indio_dev->info = &hinge_info;
+ indio_dev->name = name;
+ indio_dev->modes = INDIO_DIRECT_MODE;
+
+ ret = hid_sensor_setup_trigger(indio_dev, name,
+ &hg_group->common_attributes);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "trigger setup failed\n");
+ goto error_free_dev_mem;
+ }
+
+ ret = iio_device_register(indio_dev);
+ if (ret) {
+ dev_err(&pdev->dev, "device register failed\n");
+ goto error_remove_trigger;
+ }
+
+ *st = hg_state;
+
+ return ret;
+
+error_remove_trigger:
+ hid_sensor_remove_trigger(indio_dev, &hg_group->common_attributes);
+error_free_dev_mem:
+ kfree(indio_dev->channels);
+ return ret;
+}
+
+/* Function to deinitialize the processing for usage id */
+static int hinge_remove_iio_device(struct platform_device *pdev, int index)
+{
+ struct hinge_state *hg_state = hg_group->hg_states[index];
+ struct iio_dev *indio_dev = hg_state->indio_dev;
+
+ iio_device_unregister(indio_dev);
+ hid_sensor_remove_trigger(indio_dev, &hg_group->common_attributes);
+ kfree(indio_dev->channels);
+
+ return 0;
+}
+
+static int hid_hinge_probe(struct platform_device *pdev)
+{
+ struct hinge_state *hg_state;
+ struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ static const char *const names[] = { "hinge", "screen", "keyboard" };
+ int ret;
+ int i;
+
+ hg_group = devm_kzalloc(&pdev->dev, sizeof(struct hinge_group),
+ GFP_KERNEL);
+ if (!hg_group)
+ return -ENOMEM;
+
+ hg_group->common_attributes.hsdev = hsdev;
+ hg_group->common_attributes.pdev = pdev;
+
+ ret = hid_sensor_parse_common_attributes(hsdev, hsdev->usage,
+ &hg_group->common_attributes);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to setup common attributes\n");
+ return ret;
+ }
+
+ atomic_set(&hg_group->common_attributes.data_ready, 0);
+ for (i = 0; i < IIO_DEV_NUM; i++) {
+ ret = hinge_add_iio_device(pdev, i, names[i], &hg_state);
+ if (ret)
+ goto err_probe;
+
+ hg_group->hg_states[i] = hg_state;
+ }
+
+ /* use the first iio device to do the PM */
+ platform_set_drvdata(pdev, hg_group->hg_states[0]->indio_dev);
+
+ hg_group->callbacks.send_event = hinge_proc_event;
+ hg_group->callbacks.capture_sample = hinge_capture_sample;
+ hg_group->callbacks.pdev = pdev;
+ ret = sensor_hub_register_callback(hsdev, hsdev->usage,
+ &hg_group->callbacks);
+ if (ret < 0)
+ dev_err(&pdev->dev, "callback reg failed\n");
+
+ return ret;
+
+err_probe:
+ for (i--; i >= 0; i--)
+ hinge_remove_iio_device(pdev, i);
+
+ return ret;
+}
+
+/* Function to deinitialize the processing for usage id */
+static int hid_hinge_remove(struct platform_device *pdev)
+{
+ struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ int i;
+
+ sensor_hub_remove_callback(hsdev, hsdev->usage);
+
+ for (i = 0; i < IIO_DEV_NUM; i++)
+ hinge_remove_iio_device(pdev, i);
+
+ return 0;
+}
+
+static const struct platform_device_id hid_hinge_ids[] = {
+ {
+ /* Format: HID-SENSOR-INT-usage_id_in_hex_lowercase */
+ .name = "HID-SENSOR-INT-020b",
+ },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, hid_hinge_ids);
+
+static struct platform_driver hid_hinge_platform_driver = {
+ .id_table = hid_hinge_ids,
+ .driver = {
+ .name = KBUILD_MODNAME,
+ .pm = &hid_sensor_pm_ops,
+ },
+ .probe = hid_hinge_probe,
+ .remove = hid_hinge_remove,
+};
+module_platform_driver(hid_hinge_platform_driver);
+
+MODULE_DESCRIPTION("HID Sensor Custom Hinge");
+MODULE_AUTHOR("Ye Xiang <xiang.ye@intel.com>");
+MODULE_LICENSE("GPL");
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/4] HID: hid-sensor-custom: Add custom sensor iio support
2020-11-19 3:03 ` [PATCH 1/4] HID: hid-sensor-custom: Add custom sensor iio support Ye Xiang
@ 2020-11-19 6:56 ` kernel test robot
0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2020-11-19 6:56 UTC (permalink / raw)
To: Ye Xiang, jikos, jic23, srinivas.pandruvada
Cc: kbuild-all, linux-input, linux-iio, linux-kernel, Ye Xiang
[-- Attachment #1: Type: text/plain, Size: 7261 bytes --]
Hi Ye,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on iio/togreg]
[also build test WARNING on linus/master v5.10-rc4 next-20201118]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Ye-Xiang/add-custom-hinge-sensor-support/20201119-110842
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: c6x-randconfig-r003-20201119 (attached as .config)
compiler: c6x-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/1f33733d65038ade4af057df7e5c126485ecb7c6
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ye-Xiang/add-custom-hinge-sensor-support/20201119-110842
git checkout 1f33733d65038ade4af057df7e5c126485ecb7c6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=c6x
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/hid/hid-sensor-custom.c: In function 'store_value':
drivers/hid/hid-sensor-custom.c:401:7: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
401 | int ret;
| ^~~
In file included from include/linux/device.h:15,
from include/linux/miscdevice.h:7,
from drivers/hid/hid-sensor-custom.c:11:
drivers/hid/hid-sensor-custom.c: In function 'get_known_custom_sensor_index':
>> drivers/hid/hid-sensor-custom.c:847:24: warning: format '%ld' expects argument of type 'long int', but argument 3 has type '__kernel_size_t' {aka 'unsigned int'} [-Wformat=]
847 | hid_err(hsdev->hdev, " %ld != %ld\n", strlen(buf),
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
include/linux/hid.h:1180:2: note: in expansion of macro 'dev_err'
1180 | dev_err(&(hid)->dev, fmt, ##__VA_ARGS__)
| ^~~~~~~
drivers/hid/hid-sensor-custom.c:847:3: note: in expansion of macro 'hid_err'
847 | hid_err(hsdev->hdev, " %ld != %ld\n", strlen(buf),
| ^~~~~~~
drivers/hid/hid-sensor-custom.c:847:28: note: format string is defined here
847 | hid_err(hsdev->hdev, " %ld != %ld\n", strlen(buf),
| ~~^
| |
| long int
| %d
In file included from include/linux/device.h:15,
from include/linux/miscdevice.h:7,
from drivers/hid/hid-sensor-custom.c:11:
drivers/hid/hid-sensor-custom.c:847:24: warning: format '%ld' expects argument of type 'long int', but argument 4 has type '__kernel_size_t' {aka 'unsigned int'} [-Wformat=]
847 | hid_err(hsdev->hdev, " %ld != %ld\n", strlen(buf),
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
include/linux/hid.h:1180:2: note: in expansion of macro 'dev_err'
1180 | dev_err(&(hid)->dev, fmt, ##__VA_ARGS__)
| ^~~~~~~
drivers/hid/hid-sensor-custom.c:847:3: note: in expansion of macro 'hid_err'
847 | hid_err(hsdev->hdev, " %ld != %ld\n", strlen(buf),
| ^~~~~~~
drivers/hid/hid-sensor-custom.c:847:35: note: format string is defined here
847 | hid_err(hsdev->hdev, " %ld != %ld\n", strlen(buf),
| ~~^
| |
| long int
| %d
vim +847 drivers/hid/hid-sensor-custom.c
771
772 static int get_known_custom_sensor_index(struct hid_sensor_hub_device *hsdev)
773 {
774 struct hid_sensor_hub_attribute_info sensor_manufacturer = { 0 };
775 struct hid_sensor_hub_attribute_info sensor_luid_info = { 0 };
776 int report_size;
777 int ret;
778 u16 *w_buf;
779 int w_buf_len;
780 char *buf;
781 int buf_len;
782 int i;
783 int index;
784
785 w_buf_len = sizeof(u16) * HID_CUSTOM_MAX_FEATURE_BYTES;
786 buf_len = sizeof(char) * HID_CUSTOM_MAX_FEATURE_BYTES;
787 w_buf = kzalloc(w_buf_len, GFP_KERNEL);
788 if (!w_buf)
789 return -1;
790
791 buf = kzalloc(buf_len, GFP_KERNEL);
792 if (!buf) {
793 kfree(w_buf);
794 return -1;
795 }
796
797 /* get manufacturer info */
798 ret = sensor_hub_input_get_attribute_info(
799 hsdev, HID_FEATURE_REPORT, hsdev->usage,
800 HID_USAGE_SENSOR_PROP_MANUFACTURER, &sensor_manufacturer);
801 if (ret < 0)
802 goto err_out;
803
804 report_size =
805 sensor_hub_get_feature(hsdev, sensor_manufacturer.report_id,
806 sensor_manufacturer.index, w_buf_len,
807 w_buf);
808 if (report_size <= 0) {
809 hid_err(hsdev->hdev,
810 "Failed to get sensor manufacturer info %d\n",
811 report_size);
812 goto err_out;
813 }
814
815 /* convert from wide char to char */
816 for (i = 0; i < buf_len - 1 && w_buf[i]; i++)
817 buf[i] = (char)w_buf[i];
818
819 /* ensure it's ISH sensor */
820 if (strncmp(buf, "INTEL", strlen("INTEL")))
821 goto err_out;
822
823 memset(w_buf, 0, w_buf_len);
824 memset(buf, 0, buf_len);
825
826 /* get real usage id */
827 ret = sensor_hub_input_get_attribute_info(
828 hsdev, HID_FEATURE_REPORT, hsdev->usage,
829 HID_USAGE_SENSOR_PROP_SERIAL_NUM, &sensor_luid_info);
830 if (ret < 0)
831 goto err_out;
832
833 report_size = sensor_hub_get_feature(hsdev, sensor_luid_info.report_id,
834 sensor_luid_info.index, w_buf_len,
835 w_buf);
836 if (report_size <= 0) {
837 hid_err(hsdev->hdev, "Failed to get real usage info %d\n",
838 report_size);
839 goto err_out;
840 }
841
842 /* convert from wide char to char */
843 for (i = 0; i < buf_len - 1 && w_buf[i]; i++)
844 buf[i] = (char)w_buf[i];
845
846 if (strlen(buf) != strlen(known_sensor_luid[0]) + 5) {
> 847 hid_err(hsdev->hdev, " %ld != %ld\n", strlen(buf),
848 strlen(known_sensor_luid[0]));
849 goto err_out;
850 }
851
852 /* get table index with luid (not matching 'LUID: ' in luid) */
853 index = get_luid_table_index(&buf[5]);
854 kfree(w_buf);
855 kfree(buf);
856 return index;
857
858 err_out:
859 kfree(w_buf);
860 kfree(buf);
861 return -1;
862 }
863
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30698 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-11-19 6:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 3:03 [PATCH 0/4] add custom hinge sensor support Ye Xiang
2020-11-19 3:03 ` [PATCH 1/4] HID: hid-sensor-custom: Add custom sensor iio support Ye Xiang
2020-11-19 6:56 ` kernel test robot
2020-11-19 3:03 ` [PATCH 2/4] iio: hid-sensor-trigger: Decrement runtime pm enable count on driver removal Ye Xiang
2020-11-19 3:03 ` [PATCH 3/4] iio: hid-sensor-trigger: Use iio->trig instead trig field internal structure Ye Xiang
2020-11-19 3:03 ` [PATCH 4/4] iio: hid-sensors: Add hinge sensor driver Ye Xiang
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).