From: Mauro Carvalho Chehab on
Jarod Wilson wrote:
> On 02/04/2010 08:41 AM, Mauro Carvalho Chehab wrote:
>> Jiri Slaby wrote:
>>> On 02/04/2010 01:04 PM, Mauro Carvalho Chehab wrote:
>>>>> I have 2 dvb-t receivers and both of them need fullspeed quirk.
>>>>> Further
>>>>> disable_rc_polling (a dvb_usb module parameter) must be set to not get
>>>>> doubled characters now. And then, it works like a charm.
>>>> Module parameters always bothers me. They should be used as last
>>>> resort alternatives
>>>> when there's no other possible way to make it work properly.
>>>>
>>>> If we know for sure that the RC polling should be disabled by an
>>>> specific device,
>>>> just add this logic at the driver.
>>>
>>> Yes, this is planned and written below:
>>
>> Ok.
>>>
>>>>> Note that, it's just some kind of proof of concept. A migration of
>>>>> af9015 devices from dvb-usb-remote needs to be done first.
>>>>>
>>>>> Ideas, comments?
>>>> Please next time, send the patch inlined. As you're using
>>>> Thunderbird, you'll likely need
>>>> Asalted-patches[1] to avoid thunderbird to destroy your patches.
>>>
>>> I must disagree for two reasons: (a) it was not patch intended for merge
>>> and (b) it was a plain-text attachment which is fine even for
>>> submission. However I don't like patches as attachments so if I decide
>>> to submit it for a merge later, you will not see it as an attachment
>>> then :).
>>
>> Attachments aren't good for reply, as they appear as a file. So,
>> people need to
>> open the attachment on a separate application to see and to cut-and-paste
>> if they want to comment, like what I did.
>
> Just as an FYI... If you use mutt appropriately configured, it'll DTRT
> with attached patches and let you reply with them quoted inline, and
> actually, thunderbird 3 will more or less work with attached patches if
> you do a select-all, then hit reply (tbird finally has 'quote selected
> text' support).

RHEL5 has Thunderbird 2, so, quote selected text doesn't work. I don't
like very much to use text mailers, but i prefer the alpine interface.
I never saw this feature in alpine. Maybe I just never managed to properly
configure it there.

Claws-mail has this feature, its monothread/monotask structure is very
bad, since it stops answering to the edit window, if it starts to fetch new
emails while you're editing an email. So, I stopped using it.

--

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Pekka Sarnila on


Mauro Carvalho Chehab wrote:
> Pekka Sarnila wrote:
>
>>The problem using vendor class is that there is no standard. Each vendor
>>can define its own way using endpoints (and has done so e.g Logitech
>>joysticks). Thus each usb ir receiver must have its own specific driver.
>> However then you get the raw ir codes. When using HID class, generic
>>HID driver can do the job. But then you get HID key codes directly not
>>ir codes.
>
> We started writing an abstraction layer for IR, using the input. The idea
> is to allow the IR receivers to work with different IR's, as several users
> prefer to use universal IR's to control their devices, instead of the original
> one. This is already used by all V4L drivers and I intend to port most of
> the DVB drivers to use it as well soon.

This is very good.

The problem here is that at least afatech ir receiver has the ir code to
key code build in, so trough HID you can use only the remote whose ir to
key translate table has been loaded to the aftech device. Unless that
can be easily controlled by the user HID is no good for this.

>
>>Also this should not be seen at all as dvb question. First, not all the
>>world uses dvb standard (including USA) but uses very similar tv-sticks
>>with identical ir receivers and remotes.
>
> Despiste its name, the DVB subsystem is not specific for DVB standards, but
> it is meant to be used by all DTV standards (and almost all DTV standards
> are already supported).

But most of the world still uses analog (they can not afford yet the
transfer). Those tv-sticks have identical receivers. And there are usb
ir receivers not embedded to tv-sticks. Conceptually and technically it
has nothing to do with any tv or any other audiovisual system system
(e.g. a remote controlled weather station).

So dvb is both as a place and a name misleading.

>>Second there are many other
>>type of usb devices with ir receiver. So dvb layer should not be
>>involved at all. There maybe would be need for hid-ir-remote layer (your
>>code suggestion moved there). However even there IMHO better would be
>>just to improve HID <-> input layer interface so that input layer could
>>divert the remotes input to generic remotes layer instead of keyboard
>>layer. IMHO this would be the real linux way.
>
> This is already happening.
>
> See drivers/media/IR on linux-next for the IR common code. The ir-core is
> provided by ir-keytable.c and ir-sysfs.c, and it is not DVB or V4L specific.

Well I was talking about HID remotes that don't give ir codes but key
codes. What to do with them?

> The ir-common module were developed for V4L drivers and will probably be
> changed into a more generic way, with the integration with lirc.
>
>
>>However linux usb layer has been build so that it was technically
>>impossible to put it there without completely redesigning usb <-> higher
>>layer (including HID) interface. But I'm of the opinion that that
>>redesign should be done anyway.
>
> Feel free to submit patches. My plan is to integrate the DVB devices soon

Yes, I have thought of it. But it is a big job, I'm quite busy, and
after all mostly the benefit is more esthetical than practical. A lot of
other usb strandard and vendor class interrupt endpoint drivers beside
HID should be rewritten. Writing new ones would be easier though.

> into the new ir-core. I should start with dvb-usb-remote, where most of the
> DVB USB devices use to attach their IR's. Unfortunately, af9015 doesn't
> rely on the dvb-usb-remote, so, it will require some specific changes.
> As I don't have any af9015 device, I'll likely postpone it or wait for
> someone to do the job.

Well that was the original point of my involvement. It can support both
the dvb-usb-remote and HID. The problem with af9015/dvb-usb-remote is
that it uses usb vendor class endpoint (all trough I have used 'vendor
class' to specifically mean usb vendor class). Usb vendor classes have
no standard. But af9015 can also use USB HID class (remote as keyboard)
in a standard manner. That would avoid using special device based driver.

>>Now the question is, how much all usb based ir receivers have in common,
>>and how much they differ. This should determine on what level and in
>>which way they should be handled. How much and on what level there
>>should be common code and where device specific driver code would be
>>needed and where and how the ir-to-code translate should take place.
>
>
> There are several different ways for IR receivers, and, at least for
> vendor class, no standard way to handle. They can use GPIO polling,
> they can use i2c layer, they can use IRQ (on PCI devices) and the data
> may be provided in parallel or on a serial interface.

Well the thing is that even with usb each device can have non standard
user vendor endpoint. In case of af9015 it can provide the ir code.

> The idea of the ir-core is to provide support for all those options.

Even for those that do provide key codes trough standard HID layer
instead of ir codes trough specific device drivers?

>>IMHO all that have HID endpoint that works (either as such or with some
>>generic quirk) should be handled by HID first and then conveyed to
>>generic remotes layer that handles all remote controllers what ever the
>>lower layers (and does translate per remote not per ir receiver). Vendor
>>class should be avoided unless that's the only way to make it work
>>right. But using HID is not without problems either.
>
> Almost all chipsets only provide IR via vendor class. I agree that using
> standard HID class is the better way for doing it.

Yes, but look below.

>>Now with the two receivers that need the quirk. If they don't have
>>vendor class bulk endpoint for reading ir codes, then specific driver is
>>out anyway. However then changes to HID driver would be needed to make
>>the translate work. The quirk just makes them work as generic usb
>>keyboard with no remote specific translate. With afatech, driver loads
>>the translate table to the device, different for different remotes. I
>>don't know if one table could handle them all. Maybe this table should
>>be loaded from a user space file. Nor do I know how it is with other
>>receivers: can the table be loaded or is it fixed. In any case a generic
>>secondary per remote user configurable translate would be highly
>>desirable. And I don't mean lircd. This job is IMHO kernel level job and
>>lircd won't work here anyway. It does ir code to key code or function
>>translate not key code to key code translate. How nice it would be if
>>there would be a generic usb ir receiver class that all vendors used.
>>There seems to be no way to make this well and clean.
>
>
> The ir-core provides standard ways to replace the IR keycode and IR protocols.
> The IR protocol change is already working with vendor class with em28xx driver.

The thing is that remote controller trough HID layer does not provide IR
keycode but standard keyboard key code. And HID layer does not know that
it is a remote controller but sees it as an ordinary usb keyboard. The
question is that how can it tell the upper layer that it really is a
remote controller so that the event would end up to generic ir-core.

Pekka

> Cheers,
> Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Mauro Carvalho Chehab on
Pekka Sarnila wrote:

> The problem here is that at least afatech ir receiver has the ir code to
> key code build in, so trough HID you can use only the remote whose ir to
> key translate table has been loaded to the aftech device. Unless that
> can be easily controlled by the user HID is no good for this.

The ir-core allows a driver to start with a built in table, that can be
dynamically replaced in userspace by a different table, and even with a
different protocol, if supported by the driver/device.

> But most of the world still uses analog (they can not afford yet the
> transfer). Those tv-sticks have identical receivers. And there are usb
> ir receivers not embedded to tv-sticks. Conceptually and technically it
> has nothing to do with any tv or any other audiovisual system system
> (e.g. a remote controlled weather station).
>
> So dvb is both as a place and a name misleading.

It happens that almost all tv products (analog or digital) come with some
IR support. But you can find also some products that are just IR.

That's why we're moving it to be outside the V4L and the DVB directory.
For now, it is at /drivers/media/IR (since it helps us to move the code, while
there are still some dependencies at ir-common). But the better is to move it
later to /drivers/IR or /drivers/input/IR.

>> See drivers/media/IR on linux-next for the IR common code. The ir-core is
>> provided by ir-keytable.c and ir-sysfs.c, and it is not DVB or V4L
>> specific.
>
> Well I was talking about HID remotes that don't give ir codes but key
> codes. What to do with them?

What happens if you use it to receive keycodes from a different IR using
the same protocol?

Maybe it can still be valid to keep allowing keycode translation.

>> As I don't have any af9015 device, I'll likely postpone it or wait for
>> someone to do the job.
>
> Well that was the original point of my involvement. It can support both
> the dvb-usb-remote and HID. The problem with af9015/dvb-usb-remote is
> that it uses usb vendor class endpoint (all trough I have used 'vendor
> class' to specifically mean usb vendor class). Usb vendor classes have
> no standard. But af9015 can also use USB HID class (remote as keyboard)
> in a standard manner. That would avoid using special device based driver.

Well, as HID, you may loose the capability of using a different IR than the
one shipped with the af9015. It may make sense to just disable HID and use
USB Vendor Class.

> Well the thing is that even with usb each device can have non standard
> user vendor endpoint. In case of af9015 it can provide the ir code.

It doesn't matter how the IR code is get, kernel needs to translate it into
a linux key. That's where the ir-core enters: instead of registering the device
directly at input event, the driver registers via ir_input_register():

int ir_input_register(struct input_dev *input_dev,
const struct ir_scancode_table *rc_tab,
const struct ir_dev_props *props)

The arguments are the input device, the keycode->scancode table and an optional
argument that specifies the IR supported protocols, and a callback function
to be called when a different protocol is requested.

The IR subsystem will do a dynamic allocation for the keytable and will take
care of EVIOCGKEY/EVIOCSKEY events. It will increase/decrease the keytable size
if needed.

This way, userspace may replace the scancode/keycode table and even the IR protocol,
without needing to add any specific code at the driver.

It will also create some sysfs nodes that will help udev to identify when a new IR
device driver is loaded, allowing the keycode replacement during device hotplug.

The only needed change, at the driver, is to replace input_register_device/input_unregister_device
by ir_input_register/ir_input_unregister.

>
>> The idea of the ir-core is to provide support for all those options.
>
> Even for those that do provide key codes trough standard HID layer
> instead of ir codes trough specific device drivers?

It basically depends on what the HID layer receives from the IR. Yet, it is possible to
use the ir-core layer in order to use an IR keycode to produce a different code. It is
not always clear what certain remote keys are supposed to do.

For example, should the <POWER> key turn off the PC, or just quit the application?

>> The ir-core provides standard ways to replace the IR keycode and IR
>> protocols.
>> The IR protocol change is already working with vendor class with
>> em28xx driver.
>
> The thing is that remote controller trough HID layer does not provide IR
> keycode but standard keyboard key code. And HID layer does not know that
> it is a remote controller but sees it as an ordinary usb keyboard. The
> question is that how can it tell the upper layer that it really is a
> remote controller so that the event would end up to generic ir-core.

For HID remote controllers, the only way I see is to have an USB ID list of devices
that are known to be remote controllers and register them via ir_input_register,
instead of input_register_device.

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Dmitry Torokhov on
On Thu, Feb 04, 2010 at 11:31:45AM +0100, Jiri Slaby wrote:
+
> +static int dvb_event(struct hid_device *hdev, struct hid_field *field,
> + struct hid_usage *usage, __s32 value)
> +{
> + /* we won't get a "key up" event */
> + if (value) {
> + input_event(field->hidinput->input, usage->type, usage->code, 1);
> + input_event(field->hidinput->input, usage->type, usage->code, 0);

Do not ever forget input_sync(), you need 2 of them here.

With the latest changes to evdev, if you are using SIGIO you won't get
wioken up until EV_SYN/SYN_REPORT.

--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Jiri Slaby on
On 02/04/2010 07:14 PM, Dmitry Torokhov wrote:
> On Thu, Feb 04, 2010 at 11:31:45AM +0100, Jiri Slaby wrote:
> +
>> +static int dvb_event(struct hid_device *hdev, struct hid_field *field,
>> + struct hid_usage *usage, __s32 value)
>> +{
>> + /* we won't get a "key up" event */
>> + if (value) {
>> + input_event(field->hidinput->input, usage->type, usage->code, 1);
>> + input_event(field->hidinput->input, usage->type, usage->code, 0);
>
> Do not ever forget input_sync(), you need 2 of them here.
>
> With the latest changes to evdev, if you are using SIGIO you won't get
> wioken up until EV_SYN/SYN_REPORT.

HID layer syncs on its own. So the second is not needed. Why is needed
the first?

I.e. should there be one also in dvb_usb_read_remote_control?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/