All of lore.kernel.org
 help / color / mirror / Atom feed
* EV_MSC / driver/input/input.c (Input Handler)
@ 2007-02-08  8:56 Frank Salomon
  2007-02-08 15:15 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Frank Salomon @ 2007-02-08  8:56 UTC (permalink / raw)
  To: linux-kernel

Hi All,

I had written an additional input_handler :

      static struct input_device_id pcraw_ids[] = {
	     {
                      .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
                      .evbit = { BIT(EV_MSC) },
              },
	     { },    /* Terminating entry */
      };

to get MSC_RAW events from the atkeyboard :

      input_event (&atkbd->dev, EV_MSC, MSC_RAW, code)

But I only get these events :

      input_event(&atkbd->dev, EV_MSC, MSC_SCAN, code);

I know the reason is in driver/input/input.c :

      case EV_MSC:
           if (code > MSC_MAX || !test_bit(code, dev->mscbit))
                return;

           if (dev->event) dev->event(dev, type, code, value);
           break;

because of (driver/input/keyboard/atkbd.c):

      atkbd->dev.mscbit[0] = atkbd->softraw ? BIT(MSC_SCAN) :
           BIT(MSC_RAW) | BIT(MSC_SCAN);

I would like to change driver/input/input.c like this :

      case EV_MSC:
           if (code > MSC_MAX)
                return;

           if (test_bit(code, dev->mscbit))
                if (dev->event) dev->event(dev, type, code, value);
           break;

Any comments ? Maybe I misunderstand the concept of the input events. In 
that case, please give me a short description or let me know were I can 
find any documentation.

Best regards, Frank







^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: EV_MSC / driver/input/input.c (Input Handler)
  2007-02-08  8:56 EV_MSC / driver/input/input.c (Input Handler) Frank Salomon
@ 2007-02-08 15:15 ` Dmitry Torokhov
  2007-02-09  7:15   ` Frank Salomon
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2007-02-08 15:15 UTC (permalink / raw)
  To: frank.salomon; +Cc: linux-kernel

On 2/8/07, Frank Salomon <frank.salomon@wincor-nixdorf.com> wrote:
> Hi All,
>
> I had written an additional input_handler :
>
>      static struct input_device_id pcraw_ids[] = {
>             {
>                      .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
>                      .evbit = { BIT(EV_MSC) },
>              },
>             { },    /* Terminating entry */
>      };
>
> to get MSC_RAW events from the atkeyboard :
>
>      input_event (&atkbd->dev, EV_MSC, MSC_RAW, code)
>
> But I only get these events :
>
>      input_event(&atkbd->dev, EV_MSC, MSC_SCAN, code);
>

That is because by default atkbd uses software-emulated raw mode.
bootk with atkbd.softraw=0 or switch it off after boot through sysfs
attribute to get EV_MSC/MSC_RAW passed through).

> I know the reason is in driver/input/input.c :
>
>      case EV_MSC:
>           if (code > MSC_MAX || !test_bit(code, dev->mscbit))
>                return;
>
>           if (dev->event) dev->event(dev, type, code, value);
>           break;
>
> because of (driver/input/keyboard/atkbd.c):
>
>      atkbd->dev.mscbit[0] = atkbd->softraw ? BIT(MSC_SCAN) :
>           BIT(MSC_RAW) | BIT(MSC_SCAN);
>
> I would like to change driver/input/input.c like this :
>
>      case EV_MSC:
>           if (code > MSC_MAX)
>                return;
>
>           if (test_bit(code, dev->mscbit))
>                if (dev->event) dev->event(dev, type, code, value);
>           break;
>
> Any comments ? Maybe I misunderstand the concept of the input events. In
> that case, please give me a short description or let me know were I can
> find any documentation.
>

No, input core should not pass any events device did not claim to support.

What are you trying to do though? Why are you interested in raw atkbd
events? What will your handler do with events from other input devices
that might emit raw events?

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: EV_MSC / driver/input/input.c (Input Handler)
  2007-02-08 15:15 ` Dmitry Torokhov
@ 2007-02-09  7:15   ` Frank Salomon
  2007-02-09 14:36     ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Frank Salomon @ 2007-02-09  7:15 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-kernel

Hi Dmitry,

Dmitry Torokhov wrote:

> That is because by default atkbd uses software-emulated raw mode.
> bootk with atkbd.softraw=0 or switch it off after boot through sysfs
> attribute to get EV_MSC/MSC_RAW passed through).

Thank you for your advice, but I really don't know, what will be the 
secondary effect if it will be switched off.

> No, input core should not pass any events device did not claim to support.

I am not sure, but I think the function input_event in 
drivers/input/input.c has 2 tasks:
One is to send events to the device (first part: "switch (type){").

The other one is to send the events to the handler (second part: 
"list_for_each_entry(handle, &dev->h_list, d_node)").

This is the reason why I had the idea of changing the code as I have 
described it before.

With the current implementation, the device sends events to the handler. 
But only events, known/claimed by the device are passed through to the 
handler. I believe, this should be handled transparently.

> What are you trying to do though? Why are you interested in raw atkbd
> events? What will your handler do with events from other input devices
> that might emit raw events?

I have to connected special Point Of Sales Keyboards. Sometimes they are 
sending none standard scan codes, only make codes and no break codes. I 
had successfully implemented this in kernel version 2.4 and now I have 
to do it in 2.6.

Best regards, Frank


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: EV_MSC / driver/input/input.c (Input Handler)
  2007-02-09  7:15   ` Frank Salomon
@ 2007-02-09 14:36     ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2007-02-09 14:36 UTC (permalink / raw)
  To: frank.salomon; +Cc: linux-kernel

Hi Frank,

On 2/9/07, Frank Salomon <frank.salomon@wincor-nixdorf.com> wrote:
> Hi Dmitry,
>
> Dmitry Torokhov wrote:
>
> > That is because by default atkbd uses software-emulated raw mode.
> > bootk with atkbd.softraw=0 or switch it off after boot through sysfs
> > attribute to get EV_MSC/MSC_RAW passed through).
>
> Thank you for your advice, but I really don't know, what will be the
> secondary effect if it will be switched off.
>
> > No, input core should not pass any events device did not claim to support.
>
> I am not sure, but I think the function input_event in
> drivers/input/input.c has 2 tasks:
> One is to send events to the device (first part: "switch (type){").
>
> The other one is to send the events to the handler (second part:
> "list_for_each_entry(handle, &dev->h_list, d_node)").
>
> This is the reason why I had the idea of changing the code as I have
> described it before.
>
> With the current implementation, the device sends events to the handler.
> But only events, known/claimed by the device are passed through to the
> handler. I believe, this should be handled transparently.
>

Thta is the policy. Unless device claims to support certain events
they will not be passed through so there is no "surprises". This way
userspace applications can query device capabilities, classify them
and adjust behavior accordingly.

> > What are you trying to do though? Why are you interested in raw atkbd
> > events? What will your handler do with events from other input devices
> > that might emit raw events?
>
> I have to connected special Point Of Sales Keyboards. Sometimes they are
> sending none standard scan codes, only make codes and no break codes. I
> had successfully implemented this in kernel version 2.4 and now I have
> to do it in 2.6.
>

You probably want to use serio_raw module for that that provides raw
access to a PS/2 port (2.4-style) and possibly uinput driver to nject
parsed event stream back into kernel for standard delivery to
userspace apps.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-09 14:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-08  8:56 EV_MSC / driver/input/input.c (Input Handler) Frank Salomon
2007-02-08 15:15 ` Dmitry Torokhov
2007-02-09  7:15   ` Frank Salomon
2007-02-09 14:36     ` Dmitry Torokhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.