linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Driver problems: t213 on i8042 port
@ 2010-12-08 10:33 Alex Hudson
  2010-12-11  7:15 ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Hudson @ 2010-12-08 10:33 UTC (permalink / raw)
  To: Linux Input

Hi all,

I'm having some trouble with the serio support for a touchit213 device,
and I'm hoping by describing what's going on someone can offer some
clues.

The PC in question is a tablet PC with the touchscreen apparently
connected to the fourth serial/ps2 port on the i8042 internally, rather
than ttyS0 or something.

The manufacturer provides an xf86 driver which is extremely ropey, and
requires raw access the port. This works:

	echo -n "serio_raw" > /sys/bus/serio/devices/serio4/drvctl

.. and /dev/serio_raw0 is created.

Now, there is a serio driver for the touchit213 series, but the obvious:

	echo -n "touchit213" > /sys/bus/serio/devices/serio4/drvctl

.. doesn't work. I don't see anything in the logs; whereas if I use
inputattach to connect the driver to ttyS0 (which doesn't have the
device, obviously) I can see that the driver is enabled
in /var/log/messages and a touch /dev/input/event device is created.

I've looked through the source for the touchit213 driver, and it's nice
simple code - and I'm assuming that it's failing somewhere in the
connect function. However, I'm struggling to get much further than this.

I guess the first question is, should this work? Attaching touchit213 to
a 'real' serial port appears to work, so I'm making the guess that this
is something to do with it being a port on the i8042. However, I don't
really know much serio and haven't been able to find any good
documentation about it - it could be I'm just missing an appropriate
incantation?

Second question is, if it's supposed to work - does anyone have some
good ideas for debugging this? I think otherwise I'm going to be
sprinkling kprintfs() in the driver and seeing what happens - are there
any better ways than this?

Thanks for any help you can offer,

Alex.


--
This message was scanned by Better Hosted and is believed to be clean.
http://www.betterhosted.com


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

* Re: Driver problems: t213 on i8042 port
  2010-12-08 10:33 Driver problems: t213 on i8042 port Alex Hudson
@ 2010-12-11  7:15 ` Dmitry Torokhov
  2010-12-11  8:56   ` Alex Hudson
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2010-12-11  7:15 UTC (permalink / raw)
  To: Alex Hudson; +Cc: Linux Input

Hi Alex,

On Wed, Dec 08, 2010 at 10:33:08AM +0000, Alex Hudson wrote:
> Hi all,
> 
> I'm having some trouble with the serio support for a touchit213 device,
> and I'm hoping by describing what's going on someone can offer some
> clues.

I guess I'd start by making sure that you are indeed dealing with
touchit123 and not some other device.

> 
> The PC in question is a tablet PC with the touchscreen apparently
> connected to the fourth serial/ps2 port on the i8042 internally, rather
> than ttyS0 or something.
> 
> The manufacturer provides an xf86 driver which is extremely ropey,

They don't support the source do they?

> and
> requires raw access the port. This works:
> 
> 	echo -n "serio_raw" > /sys/bus/serio/devices/serio4/drvctl
> 
> .. and /dev/serio_raw0 is created.

Well, even if they don't we can capture the driver initializzation
sequence by doing:

	echo 1 > /sys/module/i8042/paramaters/debug

before switching to X and activating the vendor driver. This will also
allow us capture the data stream from the device and analyze it.

> 
> Now, there is a serio driver for the touchit213 series, but the obvious:
> 
> 	echo -n "touchit213" > /sys/bus/serio/devices/serio4/drvctl
> 
> .. doesn't work. I don't see anything in the logs; whereas if I use
> inputattach to connect the driver to ttyS0 (which doesn't have the
> device, obviously) I can see that the driver is enabled
> in /var/log/messages and a touch /dev/input/event device is created.

Right, the current touchit123 driver only binds to serio that has
appropriate type. Basically this means that the driver only works with
serial ports (ttySx) and not PS/2 ports.

> 
> I've looked through the source for the touchit213 driver, and it's nice
> simple code - and I'm assuming that it's failing somewhere in the
> connect function. However, I'm struggling to get much further than this.
> 
> I guess the first question is, should this work? Attaching touchit213 to
> a 'real' serial port appears to work, so I'm making the guess that this
> is something to do with it being a port on the i8042.

I am not sure, it depends whether touchit123 is indeed the right driver.
You sure it is not a variation of Lifebook touchscreen? What device
(laptop) is this?

> However, I don't
> really know much serio and haven't been able to find any good
> documentation about it - it could be I'm just missing an appropriate
> incantation?

There is no appropriate incantation for PS/2 ports. It either works
automatically or we need to adjust in-kernel driver to make it work
automatically.

> 
> Second question is, if it's supposed to work - does anyone have some
> good ideas for debugging this? I think otherwise I'm going to be
> sprinkling kprintfs() in the driver and seeing what happens - are there
> any better ways than this?

Like I said, if there is no sources to vendor driver just enable
debugging for i8042 and capture initialization steam and the data steam
with vendor driver and we'll have to make sense out of it.

Hope this helps.

-- 
Dmitry

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

* Re: Driver problems: t213 on i8042 port
  2010-12-11  7:15 ` Dmitry Torokhov
@ 2010-12-11  8:56   ` Alex Hudson
  2010-12-13  9:10     ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Hudson @ 2010-12-11  8:56 UTC (permalink / raw)
  To: Linux Input

Hi Dmitry,

Thanks for responding, much appreciated ;)

On Fri, 2010-12-10 at 23:15 -0800, Dmitry Torokhov wrote:
> > I'm having some trouble with the serio support for a touchit213 device,
> > and I'm hoping by describing what's going on someone can offer some
> > clues.
> 
> I guess I'd start by making sure that you are indeed dealing with
> touchit123 and not some other device.

Indeed, I'm pretty sure this is the right device. The xf86 driver I
mentioned comes as a source module, and accesses the device via
serio_raw. I've compared the code and the protocol is identical: and
indeed, the xf86 module makes clear some things the serio driver implies
(e.g., the xf86 driver treats the data definitively as 11-bit).

The problem with the xf86 driver is many-fold; it was written pre-Xorg
and it's taken me a fair bit of hacking just to even get it to work on
Fedora 14 without segfaulting. It's also a lot more complex than the
serio equivalent.

> > Now, there is a serio driver for the touchit213 series, but the obvious:
> > 
> > 	echo -n "touchit213" > /sys/bus/serio/devices/serio4/drvctl
> > 
> > .. doesn't work. I don't see anything in the logs; whereas if I use
> > inputattach to connect the driver to ttyS0 (which doesn't have the
> > device, obviously) I can see that the driver is enabled
> > in /var/log/messages and a touch /dev/input/event device is created.
> 
> Right, the current touchit123 driver only binds to serio that has
> appropriate type. Basically this means that the driver only works with
> serial ports (ttySx) and not PS/2 ports.

I think you've nailed the problem, then - is this to do with the
structure in touchit213_serio_ids[]? I had only really been looking at
the connect() function.

Is it possible it's as simple as adding another stanza accepting
SERIO_8042 or is there a more fundamental reason why ttySx is only
allowed?

Thanks for all your help, 

Alex.


--
This message was scanned by Better Hosted and is believed to be clean.
http://www.betterhosted.com


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

* Re: Driver problems: t213 on i8042 port
  2010-12-11  8:56   ` Alex Hudson
@ 2010-12-13  9:10     ` Dmitry Torokhov
  2010-12-13 10:12       ` Alex Hudson
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2010-12-13  9:10 UTC (permalink / raw)
  To: Alex Hudson; +Cc: Linux Input

On Sat, Dec 11, 2010 at 08:56:05AM +0000, Alex Hudson wrote:
> Hi Dmitry,
> 
> Thanks for responding, much appreciated ;)
> 
> On Fri, 2010-12-10 at 23:15 -0800, Dmitry Torokhov wrote:
> > > I'm having some trouble with the serio support for a touchit213 device,
> > > and I'm hoping by describing what's going on someone can offer some
> > > clues.
> > 
> > I guess I'd start by making sure that you are indeed dealing with
> > touchit123 and not some other device.
> 
> Indeed, I'm pretty sure this is the right device. The xf86 driver I
> mentioned comes as a source module, and accesses the device via
> serio_raw. I've compared the code and the protocol is identical: and
> indeed, the xf86 module makes clear some things the serio driver implies
> (e.g., the xf86 driver treats the data definitively as 11-bit).

Any chance you could post a link to the sources?

> 
> The problem with the xf86 driver is many-fold; it was written pre-Xorg
> and it's taken me a fair bit of hacking just to even get it to work on
> Fedora 14 without segfaulting. It's also a lot more complex than the
> serio equivalent.

Right, it is most likely does hardware probing and initialization
whereas touchkit213 expects input_attach to do this for it.

> 
> > > Now, there is a serio driver for the touchit213 series, but the obvious:
> > > 
> > > 	echo -n "touchit213" > /sys/bus/serio/devices/serio4/drvctl
> > > 
> > > .. doesn't work. I don't see anything in the logs; whereas if I use
> > > inputattach to connect the driver to ttyS0 (which doesn't have the
> > > device, obviously) I can see that the driver is enabled
> > > in /var/log/messages and a touch /dev/input/event device is created.
> > 
> > Right, the current touchit123 driver only binds to serio that has
> > appropriate type. Basically this means that the driver only works with
> > serial ports (ttySx) and not PS/2 ports.
> 
> I think you've nailed the problem, then - is this to do with the
> structure in touchit213_serio_ids[]? I had only really been looking at
> the connect() function.
> 
> Is it possible it's as simple as adding another stanza accepting
> SERIO_8042 or is there a more fundamental reason why ttySx is only
> allowed?

You can't simply allowing binding to SERIO_8042 as it will cause
touchkit213 to fight with the standard psmouse driver. What needs to be
done is to write a sub-driver (or protocol driver) for psmouse module
which would probe the devices and automatically select proper protocol.

Please take a look at drivers/input/mouse/psmouse-base.c and friends
there.

Also, please use 'reply-all' on kernel lists - this way you have much
better chance to receive prompt replies ;)

-- 
Dmitry

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

* Re: Driver problems: t213 on i8042 port
  2010-12-13  9:10     ` Dmitry Torokhov
@ 2010-12-13 10:12       ` Alex Hudson
  2010-12-15  8:03         ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Hudson @ 2010-12-13 10:12 UTC (permalink / raw)
  To: Linux Input; +Cc: Dmitry Torokhov

On Mon, 2010-12-13 at 01:10 -0800, Dmitry Torokhov wrote:
> > [re: xf86 driver for t213 device]
>
> Any chance you could post a link to the sources?

I can:

http://www.tabletkiosk.de/files//linux-general/drivers/testing/touchkit-linux-2.2.0.tar.bz2

There is a thread about this driver on their site as well:

http://www.tabletkiosk.com/forum/forum_posts.asp?TID=103

It doesn't compile at all against current X.org; I can send you my diff
for that but it's all X.org ABI stuff - nothing to do with the actual
t213 protocol. However, some of this might be moot anyway:

> You can't simply allowing binding to SERIO_8042 as it will cause
> touchkit213 to fight with the standard psmouse driver. What needs to be
> done is to write a sub-driver (or protocol driver) for psmouse module
> which would probe the devices and automatically select proper protocol.
> 
> Please take a look at drivers/input/mouse/psmouse-base.c and friends
> there.

Ah, ok, that makes sense then - originally when I was trying to make
sense of this hardware it kept coming through as a PS/2 mouse but of
course X.org went slightly nuts with that configuration. 

As an aside, I wonder if this speaks to some of the problems I was
having with the X.org driver. I was simply attaching serio_raw to serio4
as per the instructions; however, if this "fights" (as you describe it)
with the ps2 mouse, that could explain why it would mostly work but then
go weird.

I had a look at psmouse-base.c, and I can see what you mean: also,
there's a "Touchkit" driver for eGalax, and the protocol there looks
identical. Weirdly, this isn't working - even though looking at the code
the detect() function doesn't seem to need a manual trigger.

So, I think I have my place to look: the touchit213 driver is probably
the wrong thing, it's the mouse/touchkit driver I actually want and I
should attempt to debug this part first. 

I think the comms part of it looks right, so maybe what's going on is
that the probing earlier in the ps2 code is actually upsetting the
device.

> Also, please use 'reply-all' on kernel lists - this way you have much
> better chance to receive prompt replies ;)

Apologies, it's my first time trying to contribute on vger lists - thank
you very much for your patience!

Thanks

Alex.



--
This message was scanned by Better Hosted and is believed to be clean.
http://www.betterhosted.com


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

* Re: Driver problems: t213 on i8042 port
  2010-12-13 10:12       ` Alex Hudson
@ 2010-12-15  8:03         ` Dmitry Torokhov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2010-12-15  8:03 UTC (permalink / raw)
  To: Alex Hudson; +Cc: Linux Input

On Mon, Dec 13, 2010 at 10:12:54AM +0000, Alex Hudson wrote:
> On Mon, 2010-12-13 at 01:10 -0800, Dmitry Torokhov wrote:
> > > [re: xf86 driver for t213 device]
> >
> > Any chance you could post a link to the sources?
> 
> I can:
> 
> http://www.tabletkiosk.de/files//linux-general/drivers/testing/touchkit-linux-2.2.0.tar.bz2
> 
> There is a thread about this driver on their site as well:
> 
> http://www.tabletkiosk.com/forum/forum_posts.asp?TID=103
> 
> It doesn't compile at all against current X.org; I can send you my diff
> for that but it's all X.org ABI stuff - nothing to do with the actual
> t213 protocol. However, some of this might be moot anyway:
> 
> > You can't simply allowing binding to SERIO_8042 as it will cause
> > touchkit213 to fight with the standard psmouse driver. What needs to be
> > done is to write a sub-driver (or protocol driver) for psmouse module
> > which would probe the devices and automatically select proper protocol.
> > 
> > Please take a look at drivers/input/mouse/psmouse-base.c and friends
> > there.
> 
> Ah, ok, that makes sense then - originally when I was trying to make
> sense of this hardware it kept coming through as a PS/2 mouse but of
> course X.org went slightly nuts with that configuration. 
> 
> As an aside, I wonder if this speaks to some of the problems I was
> having with the X.org driver. I was simply attaching serio_raw to serio4
> as per the instructions; however, if this "fights" (as you describe it)
> with the ps2 mouse, that could explain why it would mostly work but then
> go weird.
> 
> I had a look at psmouse-base.c, and I can see what you mean: also,
> there's a "Touchkit" driver for eGalax, and the protocol there looks
> identical. Weirdly, this isn't working - even though looking at the code
> the detect() function doesn't seem to need a manual trigger.
>

Touchkit initialization sequence looks similar to the one used in X
driver. You probably want to boot with i8042.debug (or activate it via
/sys/module/i8042/parameters/debug), load psmouse module and see what
kind of response you are getting from the device.

Also, have you tried forcing touchkit protocol by doing:

	echo "touchkit" > /sys/bus/serio/devices/serioX/protocol

Thanks.

-- 
Dmitry

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

end of thread, other threads:[~2010-12-15  8:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-08 10:33 Driver problems: t213 on i8042 port Alex Hudson
2010-12-11  7:15 ` Dmitry Torokhov
2010-12-11  8:56   ` Alex Hudson
2010-12-13  9:10     ` Dmitry Torokhov
2010-12-13 10:12       ` Alex Hudson
2010-12-15  8:03         ` Dmitry Torokhov

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).