* Re: [git:media_tree/master] [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs
[not found] <E1abRXi-00035h-0E@www.linuxtv.org>
@ 2016-03-03 18:18 ` Heiner Kallweit
2016-03-03 18:52 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 5+ messages in thread
From: Heiner Kallweit @ 2016-03-03 18:18 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: linux-media
Am 03.03.2016 um 12:28 schrieb Mauro Carvalho Chehab:
> This is an automatic generated email to let you know that the following patch were queued at the
> http://git.linuxtv.org/cgit.cgi/media_tree.git tree:
>
> Subject: [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs
> Author: Heiner Kallweit <hkallweit1@gmail.com>
> Date: Mon Feb 8 17:25:59 2016 -0200
>
> This patch adds a binary attribute /sys/class/rc/rc?/wakeup_data which
> allows to read / write the wakeup sequence.
>
When working on another module I was reminded not to forget updating Documentation/ABI.
I think the same applies here. This patch introduces a new sysfs attribute that should
be documented. I'll submit a patch for adding Documentation/ABI/testing/sysfs-class-rc-nuvoton
Rgds, Heiner
> In combination with the core extension for exposing the most recent raw
> packet this allows to easily define and set a wakeup sequence.
>
> At least on my Zotac CI321 the BIOS resets the wakeup sequence at each boot
> to a factory default. Therefore I use a udev rule
> SUBSYSTEM=="rc", DRIVERS=="nuvoton-cir", ACTION=="add", RUN+="<script>"
> with the script basically doing
> cat <stored wakeup sequence> >/sys${DEVPATH}/wakeup_data
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>
> drivers/media/rc/nuvoton-cir.c | 85 ++++++++++++++++++++++++++++++++++++++++++
> drivers/media/rc/nuvoton-cir.h | 3 ++
> 2 files changed, 88 insertions(+)
>
> ---
>
> http://git.linuxtv.org/cgit.cgi/media_tree.git/commit/?id=449c1fcd86f5077d5076a955e65c07a7c4cbbf9d
> diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
> index c96da3aaf00b..c2ee5bdc6c7d 100644
> --- a/drivers/media/rc/nuvoton-cir.c
> +++ b/drivers/media/rc/nuvoton-cir.c
> @@ -39,6 +39,8 @@
>
> #include "nuvoton-cir.h"
>
> +static void nvt_clear_cir_wake_fifo(struct nvt_dev *nvt);
> +
> static const struct nvt_chip nvt_chips[] = {
> { "w83667hg", NVT_W83667HG },
> { "NCT6775F", NVT_6775F },
> @@ -177,6 +179,83 @@ static void nvt_set_ioaddr(struct nvt_dev *nvt, unsigned long *ioaddr)
> }
> }
>
> +static ssize_t wakeup_data_read(struct file *fp, struct kobject *kobj,
> + struct bin_attribute *bin_attr,
> + char *buf, loff_t off, size_t count)
> +{
> + struct device *dev = kobj_to_dev(kobj);
> + struct rc_dev *rc_dev = to_rc_dev(dev);
> + struct nvt_dev *nvt = rc_dev->priv;
> + int fifo_len, len;
> + unsigned long flags;
> + int i;
> +
> + spin_lock_irqsave(&nvt->nvt_lock, flags);
> +
> + fifo_len = nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_COUNT);
> + len = min(fifo_len, WAKEUP_MAX_SIZE);
> +
> + if (off >= len) {
> + spin_unlock_irqrestore(&nvt->nvt_lock, flags);
> + return 0;
> + }
> +
> + if (len > count)
> + len = count;
> +
> + /* go to first element to be read */
> + while (nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY_IDX) != off)
> + nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY);
> +
> + for (i = 0; i < len; i++)
> + buf[i] = nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY);
> +
> + spin_unlock_irqrestore(&nvt->nvt_lock, flags);
> +
> + return len;
> +}
> +
> +static ssize_t wakeup_data_write(struct file *fp, struct kobject *kobj,
> + struct bin_attribute *bin_attr,
> + char *buf, loff_t off, size_t count)
> +{
> + struct device *dev = kobj_to_dev(kobj);
> + struct rc_dev *rc_dev = to_rc_dev(dev);
> + struct nvt_dev *nvt = rc_dev->priv;
> + unsigned long flags;
> + u8 tolerance, config;
> + int i;
> +
> + if (off > 0)
> + return -EINVAL;
> +
> + /* hardcode the tolerance to 10% */
> + tolerance = DIV_ROUND_UP(count, 10);
> +
> + spin_lock_irqsave(&nvt->nvt_lock, flags);
> +
> + nvt_clear_cir_wake_fifo(nvt);
> + nvt_cir_wake_reg_write(nvt, count, CIR_WAKE_FIFO_CMP_DEEP);
> + nvt_cir_wake_reg_write(nvt, tolerance, CIR_WAKE_FIFO_CMP_TOL);
> +
> + config = nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRCON);
> +
> + /* enable writes to wake fifo */
> + nvt_cir_wake_reg_write(nvt, config | CIR_WAKE_IRCON_MODE1,
> + CIR_WAKE_IRCON);
> +
> + for (i = 0; i < count; i++)
> + nvt_cir_wake_reg_write(nvt, buf[i], CIR_WAKE_WR_FIFO_DATA);
> +
> + nvt_cir_wake_reg_write(nvt, config, CIR_WAKE_IRCON);
> +
> + spin_unlock_irqrestore(&nvt->nvt_lock, flags);
> +
> + return count;
> +}
> +
> +static BIN_ATTR_RW(wakeup_data, WAKEUP_MAX_SIZE);
> +
> /* dump current cir register contents */
> static void cir_dump_regs(struct nvt_dev *nvt)
> {
> @@ -1133,6 +1212,10 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
> NVT_DRIVER_NAME "-wake", (void *)nvt))
> goto exit_unregister_device;
>
> + ret = device_create_bin_file(&rdev->dev, &bin_attr_wakeup_data);
> + if (ret)
> + goto exit_unregister_device;
> +
> device_init_wakeup(&pdev->dev, true);
>
> dev_notice(&pdev->dev, "driver has been successfully loaded\n");
> @@ -1156,6 +1239,8 @@ static void nvt_remove(struct pnp_dev *pdev)
> {
> struct nvt_dev *nvt = pnp_get_drvdata(pdev);
>
> + device_remove_bin_file(&nvt->rdev->dev, &bin_attr_wakeup_data);
> +
> nvt_disable_cir(nvt);
>
> /* enable CIR Wake (for IR power-on) */
> diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h
> index 4a5650dffa29..c9c98ebb19ee 100644
> --- a/drivers/media/rc/nuvoton-cir.h
> +++ b/drivers/media/rc/nuvoton-cir.h
> @@ -417,3 +417,6 @@ struct nvt_dev {
> /* as VISTA MCE definition, valid carrier value */
> #define MAX_CARRIER 60000
> #define MIN_CARRIER 30000
> +
> +/* max wakeup sequence length */
> +#define WAKEUP_MAX_SIZE 65
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [git:media_tree/master] [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs
2016-03-03 18:18 ` [git:media_tree/master] [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs Heiner Kallweit
@ 2016-03-03 18:52 ` Mauro Carvalho Chehab
2016-03-03 19:22 ` Heiner Kallweit
0 siblings, 1 reply; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2016-03-03 18:52 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: linux-media
Em Thu, 03 Mar 2016 19:18:17 +0100
Heiner Kallweit <hkallweit1@gmail.com> escreveu:
> Am 03.03.2016 um 12:28 schrieb Mauro Carvalho Chehab:
> > This is an automatic generated email to let you know that the following patch were queued at the
> > http://git.linuxtv.org/cgit.cgi/media_tree.git tree:
> >
> > Subject: [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs
> > Author: Heiner Kallweit <hkallweit1@gmail.com>
> > Date: Mon Feb 8 17:25:59 2016 -0200
> >
> > This patch adds a binary attribute /sys/class/rc/rc?/wakeup_data which
> > allows to read / write the wakeup sequence.
> >
> When working on another module I was reminded not to forget updating Documentation/ABI.
> I think the same applies here. This patch introduces a new sysfs attribute that should
> be documented. I'll submit a patch for adding Documentation/ABI/testing/sysfs-class-rc-nuvoton
Good point.
Another thing: wouldn't be better to use a text format? This would make
esier to import from LIRC's irrecord format:
begin raw_codes
name power
850 900 1750 1800 850 900
850 900 1750 900 850 1800
850 900 850 900 850 900
1750 1800 800
end raw_codes
Regards,
Mauro
>
> Rgds, Heiner
>
> > In combination with the core extension for exposing the most recent raw
> > packet this allows to easily define and set a wakeup sequence.
> >
> > At least on my Zotac CI321 the BIOS resets the wakeup sequence at each boot
> > to a factory default. Therefore I use a udev rule
> > SUBSYSTEM=="rc", DRIVERS=="nuvoton-cir", ACTION=="add", RUN+="<script>"
> > with the script basically doing
> > cat <stored wakeup sequence> >/sys${DEVPATH}/wakeup_data
> >
> > Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> >
> > drivers/media/rc/nuvoton-cir.c | 85 ++++++++++++++++++++++++++++++++++++++++++
> > drivers/media/rc/nuvoton-cir.h | 3 ++
> > 2 files changed, 88 insertions(+)
> >
> > ---
> >
> > http://git.linuxtv.org/cgit.cgi/media_tree.git/commit/?id=449c1fcd86f5077d5076a955e65c07a7c4cbbf9d
> > diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
> > index c96da3aaf00b..c2ee5bdc6c7d 100644
> > --- a/drivers/media/rc/nuvoton-cir.c
> > +++ b/drivers/media/rc/nuvoton-cir.c
> > @@ -39,6 +39,8 @@
> >
> > #include "nuvoton-cir.h"
> >
> > +static void nvt_clear_cir_wake_fifo(struct nvt_dev *nvt);
> > +
> > static const struct nvt_chip nvt_chips[] = {
> > { "w83667hg", NVT_W83667HG },
> > { "NCT6775F", NVT_6775F },
> > @@ -177,6 +179,83 @@ static void nvt_set_ioaddr(struct nvt_dev *nvt, unsigned long *ioaddr)
> > }
> > }
> >
> > +static ssize_t wakeup_data_read(struct file *fp, struct kobject *kobj,
> > + struct bin_attribute *bin_attr,
> > + char *buf, loff_t off, size_t count)
> > +{
> > + struct device *dev = kobj_to_dev(kobj);
> > + struct rc_dev *rc_dev = to_rc_dev(dev);
> > + struct nvt_dev *nvt = rc_dev->priv;
> > + int fifo_len, len;
> > + unsigned long flags;
> > + int i;
> > +
> > + spin_lock_irqsave(&nvt->nvt_lock, flags);
> > +
> > + fifo_len = nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_COUNT);
> > + len = min(fifo_len, WAKEUP_MAX_SIZE);
> > +
> > + if (off >= len) {
> > + spin_unlock_irqrestore(&nvt->nvt_lock, flags);
> > + return 0;
> > + }
> > +
> > + if (len > count)
> > + len = count;
> > +
> > + /* go to first element to be read */
> > + while (nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY_IDX) != off)
> > + nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY);
> > +
> > + for (i = 0; i < len; i++)
> > + buf[i] = nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY);
> > +
> > + spin_unlock_irqrestore(&nvt->nvt_lock, flags);
> > +
> > + return len;
> > +}
> > +
> > +static ssize_t wakeup_data_write(struct file *fp, struct kobject *kobj,
> > + struct bin_attribute *bin_attr,
> > + char *buf, loff_t off, size_t count)
> > +{
> > + struct device *dev = kobj_to_dev(kobj);
> > + struct rc_dev *rc_dev = to_rc_dev(dev);
> > + struct nvt_dev *nvt = rc_dev->priv;
> > + unsigned long flags;
> > + u8 tolerance, config;
> > + int i;
> > +
> > + if (off > 0)
> > + return -EINVAL;
> > +
> > + /* hardcode the tolerance to 10% */
> > + tolerance = DIV_ROUND_UP(count, 10);
> > +
> > + spin_lock_irqsave(&nvt->nvt_lock, flags);
> > +
> > + nvt_clear_cir_wake_fifo(nvt);
> > + nvt_cir_wake_reg_write(nvt, count, CIR_WAKE_FIFO_CMP_DEEP);
> > + nvt_cir_wake_reg_write(nvt, tolerance, CIR_WAKE_FIFO_CMP_TOL);
> > +
> > + config = nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRCON);
> > +
> > + /* enable writes to wake fifo */
> > + nvt_cir_wake_reg_write(nvt, config | CIR_WAKE_IRCON_MODE1,
> > + CIR_WAKE_IRCON);
> > +
> > + for (i = 0; i < count; i++)
> > + nvt_cir_wake_reg_write(nvt, buf[i], CIR_WAKE_WR_FIFO_DATA);
> > +
> > + nvt_cir_wake_reg_write(nvt, config, CIR_WAKE_IRCON);
> > +
> > + spin_unlock_irqrestore(&nvt->nvt_lock, flags);
> > +
> > + return count;
> > +}
> > +
> > +static BIN_ATTR_RW(wakeup_data, WAKEUP_MAX_SIZE);
> > +
> > /* dump current cir register contents */
> > static void cir_dump_regs(struct nvt_dev *nvt)
> > {
> > @@ -1133,6 +1212,10 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
> > NVT_DRIVER_NAME "-wake", (void *)nvt))
> > goto exit_unregister_device;
> >
> > + ret = device_create_bin_file(&rdev->dev, &bin_attr_wakeup_data);
> > + if (ret)
> > + goto exit_unregister_device;
> > +
> > device_init_wakeup(&pdev->dev, true);
> >
> > dev_notice(&pdev->dev, "driver has been successfully loaded\n");
> > @@ -1156,6 +1239,8 @@ static void nvt_remove(struct pnp_dev *pdev)
> > {
> > struct nvt_dev *nvt = pnp_get_drvdata(pdev);
> >
> > + device_remove_bin_file(&nvt->rdev->dev, &bin_attr_wakeup_data);
> > +
> > nvt_disable_cir(nvt);
> >
> > /* enable CIR Wake (for IR power-on) */
> > diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h
> > index 4a5650dffa29..c9c98ebb19ee 100644
> > --- a/drivers/media/rc/nuvoton-cir.h
> > +++ b/drivers/media/rc/nuvoton-cir.h
> > @@ -417,3 +417,6 @@ struct nvt_dev {
> > /* as VISTA MCE definition, valid carrier value */
> > #define MAX_CARRIER 60000
> > #define MIN_CARRIER 30000
> > +
> > +/* max wakeup sequence length */
> > +#define WAKEUP_MAX_SIZE 65
> >
>
--
Thanks,
Mauro
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [git:media_tree/master] [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs
2016-03-03 18:52 ` Mauro Carvalho Chehab
@ 2016-03-03 19:22 ` Heiner Kallweit
2016-03-03 20:56 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 5+ messages in thread
From: Heiner Kallweit @ 2016-03-03 19:22 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: linux-media
Am 03.03.2016 um 19:52 schrieb Mauro Carvalho Chehab:
> Em Thu, 03 Mar 2016 19:18:17 +0100
> Heiner Kallweit <hkallweit1@gmail.com> escreveu:
>
>> Am 03.03.2016 um 12:28 schrieb Mauro Carvalho Chehab:
>>> This is an automatic generated email to let you know that the following patch were queued at the
>>> http://git.linuxtv.org/cgit.cgi/media_tree.git tree:
>>>
>>> Subject: [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs
>>> Author: Heiner Kallweit <hkallweit1@gmail.com>
>>> Date: Mon Feb 8 17:25:59 2016 -0200
>>>
>>> This patch adds a binary attribute /sys/class/rc/rc?/wakeup_data which
>>> allows to read / write the wakeup sequence.
>>>
>> When working on another module I was reminded not to forget updating Documentation/ABI.
>> I think the same applies here. This patch introduces a new sysfs attribute that should
>> be documented. I'll submit a patch for adding Documentation/ABI/testing/sysfs-class-rc-nuvoton
>
> Good point.
>
> Another thing: wouldn't be better to use a text format? This would make
> esier to import from LIRC's irrecord format:
>
> begin raw_codes
>
> name power
> 850 900 1750 1800 850 900
> 850 900 1750 900 850 1800
> 850 900 850 900 850 900
> 1750 1800 800
>
> end raw_codes
>
> Regards,
> Mauro
>
Most likely this is possible, but it would mean that we need a parser / generator
for this text format in the driver / kernel code. And I have my doubts that parsing
an application-specific file format (that could change anytime) in kernel code is
a good thing. Converting this format to raw binary data is better off in userspace
I think. What's your opinion?
>>
>> Rgds, Heiner
>>
>>> In combination with the core extension for exposing the most recent raw
>>> packet this allows to easily define and set a wakeup sequence.
>>>
>>> At least on my Zotac CI321 the BIOS resets the wakeup sequence at each boot
>>> to a factory default. Therefore I use a udev rule
>>> SUBSYSTEM=="rc", DRIVERS=="nuvoton-cir", ACTION=="add", RUN+="<script>"
>>> with the script basically doing
>>> cat <stored wakeup sequence> >/sys${DEVPATH}/wakeup_data
>>>
>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>>>
>>> drivers/media/rc/nuvoton-cir.c | 85 ++++++++++++++++++++++++++++++++++++++++++
>>> drivers/media/rc/nuvoton-cir.h | 3 ++
>>> 2 files changed, 88 insertions(+)
>>>
>>> ---
>>>
>>> [...]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [git:media_tree/master] [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs
2016-03-03 19:22 ` Heiner Kallweit
@ 2016-03-03 20:56 ` Mauro Carvalho Chehab
2016-03-03 21:39 ` Heiner Kallweit
0 siblings, 1 reply; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2016-03-03 20:56 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: linux-media
Em Thu, 03 Mar 2016 20:22:35 +0100
Heiner Kallweit <hkallweit1@gmail.com> escreveu:
> Am 03.03.2016 um 19:52 schrieb Mauro Carvalho Chehab:
> > Em Thu, 03 Mar 2016 19:18:17 +0100
> > Heiner Kallweit <hkallweit1@gmail.com> escreveu:
> >
> >> Am 03.03.2016 um 12:28 schrieb Mauro Carvalho Chehab:
> >>> This is an automatic generated email to let you know that the following patch were queued at the
> >>> http://git.linuxtv.org/cgit.cgi/media_tree.git tree:
> >>>
> >>> Subject: [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs
> >>> Author: Heiner Kallweit <hkallweit1@gmail.com>
> >>> Date: Mon Feb 8 17:25:59 2016 -0200
> >>>
> >>> This patch adds a binary attribute /sys/class/rc/rc?/wakeup_data which
> >>> allows to read / write the wakeup sequence.
> >>>
> >> When working on another module I was reminded not to forget updating Documentation/ABI.
> >> I think the same applies here. This patch introduces a new sysfs attribute that should
> >> be documented. I'll submit a patch for adding Documentation/ABI/testing/sysfs-class-rc-nuvoton
> >
> > Good point.
> >
> > Another thing: wouldn't be better to use a text format? This would make
> > esier to import from LIRC's irrecord format:
> >
> > begin raw_codes
> >
> > name power
> > 850 900 1750 1800 850 900
> > 850 900 1750 900 850 1800
> > 850 900 850 900 850 900
> > 1750 1800 800
> >
> > end raw_codes
> >
> > Regards,
> > Mauro
> >
> Most likely this is possible, but it would mean that we need a parser / generator
> for this text format in the driver / kernel code. And I have my doubts that parsing
> an application-specific file format (that could change anytime) in kernel code is
> a good thing. Converting this format to raw binary data is better off in userspace
> I think. What's your opinion?
I'm not telling that it should parse irrecord format, but, instead, to
accept an ascii sequence of timings. The problem with raw binary data
is that the format varies on big endian and long endian architectures,
with doesn't seem to be nice to an API, as a data sequence recorded
on one machine may not work on some other one.
>
> >>
> >> Rgds, Heiner
> >>
> >>> In combination with the core extension for exposing the most recent raw
> >>> packet this allows to easily define and set a wakeup sequence.
> >>>
> >>> At least on my Zotac CI321 the BIOS resets the wakeup sequence at each boot
> >>> to a factory default. Therefore I use a udev rule
> >>> SUBSYSTEM=="rc", DRIVERS=="nuvoton-cir", ACTION=="add", RUN+="<script>"
> >>> with the script basically doing
> >>> cat <stored wakeup sequence> >/sys${DEVPATH}/wakeup_data
> >>>
> >>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> >>> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> >>>
> >>> drivers/media/rc/nuvoton-cir.c | 85 ++++++++++++++++++++++++++++++++++++++++++
> >>> drivers/media/rc/nuvoton-cir.h | 3 ++
> >>> 2 files changed, 88 insertions(+)
> >>>
> >>> ---
> >>>
> >>> [...]
>
--
Thanks,
Mauro
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [git:media_tree/master] [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs
2016-03-03 20:56 ` Mauro Carvalho Chehab
@ 2016-03-03 21:39 ` Heiner Kallweit
0 siblings, 0 replies; 5+ messages in thread
From: Heiner Kallweit @ 2016-03-03 21:39 UTC (permalink / raw)
To: Mauro Carvalho Chehab; +Cc: linux-media
Am 03.03.2016 um 21:56 schrieb Mauro Carvalho Chehab:
> Em Thu, 03 Mar 2016 20:22:35 +0100
> Heiner Kallweit <hkallweit1@gmail.com> escreveu:
>
>> Am 03.03.2016 um 19:52 schrieb Mauro Carvalho Chehab:
>>> Em Thu, 03 Mar 2016 19:18:17 +0100
>>> Heiner Kallweit <hkallweit1@gmail.com> escreveu:
>>>
>>>> Am 03.03.2016 um 12:28 schrieb Mauro Carvalho Chehab:
>>>>> This is an automatic generated email to let you know that the following patch were queued at the
>>>>> http://git.linuxtv.org/cgit.cgi/media_tree.git tree:
>>>>>
>>>>> Subject: [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs
>>>>> Author: Heiner Kallweit <hkallweit1@gmail.com>
>>>>> Date: Mon Feb 8 17:25:59 2016 -0200
>>>>>
>>>>> This patch adds a binary attribute /sys/class/rc/rc?/wakeup_data which
>>>>> allows to read / write the wakeup sequence.
>>>>>
>>>> When working on another module I was reminded not to forget updating Documentation/ABI.
>>>> I think the same applies here. This patch introduces a new sysfs attribute that should
>>>> be documented. I'll submit a patch for adding Documentation/ABI/testing/sysfs-class-rc-nuvoton
>>>
>>> Good point.
>>>
>>> Another thing: wouldn't be better to use a text format? This would make
>>> esier to import from LIRC's irrecord format:
>>>
>>> begin raw_codes
>>>
>>> name power
>>> 850 900 1750 1800 850 900
>>> 850 900 1750 900 850 1800
>>> 850 900 850 900 850 900
>>> 1750 1800 800
>>>
>>> end raw_codes
>>>
>>> Regards,
>>> Mauro
>>>
>> Most likely this is possible, but it would mean that we need a parser / generator
>> for this text format in the driver / kernel code. And I have my doubts that parsing
>> an application-specific file format (that could change anytime) in kernel code is
>> a good thing. Converting this format to raw binary data is better off in userspace
>> I think. What's your opinion?
>
> I'm not telling that it should parse irrecord format, but, instead, to
> accept an ascii sequence of timings. The problem with raw binary data
> is that the format varies on big endian and long endian architectures,
> with doesn't seem to be nice to an API, as a data sequence recorded
> on one machine may not work on some other one.
>
The Nuvoton wakeup sequence is a number of bytes (bit 7 = pulse/space indicator,
bit 6..0 = length / 50us). It doesn't include any multi-byte numbers.
Therefore endianness doesn't affect us.
However I also like the idea of having a text format with pulses / spaces in us.
(as that's what utilities like mode2 display) It's easier for the user to deal with.
I'll prepare an alternative patch using such a text format.
>>
>>>>
>>>> Rgds, Heiner
>>>>
>>>>> In combination with the core extension for exposing the most recent raw
>>>>> packet this allows to easily define and set a wakeup sequence.
>>>>>
>>>>> At least on my Zotac CI321 the BIOS resets the wakeup sequence at each boot
>>>>> to a factory default. Therefore I use a udev rule
>>>>> SUBSYSTEM=="rc", DRIVERS=="nuvoton-cir", ACTION=="add", RUN+="<script>"
>>>>> with the script basically doing
>>>>> cat <stored wakeup sequence> >/sys${DEVPATH}/wakeup_data
>>>>>
>>>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>>>> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>>>>>
>>>>> drivers/media/rc/nuvoton-cir.c | 85 ++++++++++++++++++++++++++++++++++++++++++
>>>>> drivers/media/rc/nuvoton-cir.h | 3 ++
>>>>> 2 files changed, 88 insertions(+)
>>>>>
>>>>> ---
>>>>>
>>>>> [...]
>>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-03 21:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <E1abRXi-00035h-0E@www.linuxtv.org>
2016-03-03 18:18 ` [git:media_tree/master] [media] media: rc: nuvoton: support reading / writing wakeup sequence via sysfs Heiner Kallweit
2016-03-03 18:52 ` Mauro Carvalho Chehab
2016-03-03 19:22 ` Heiner Kallweit
2016-03-03 20:56 ` Mauro Carvalho Chehab
2016-03-03 21:39 ` Heiner Kallweit
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).