no luck with DMC TSC-10 touchscreen on USB

2007-06-26 Thread Clemens Koller

Hello!

I'm writing this to lkml since the linux-usb-users list seems to be stuck
in spam and I didn't receive an answer during the last week.

I have a DMC TSC-103 touchscreen controller on a ISP1563 EHCI/OHCI USB 
controller
on PCI on an MPC8540 PowerPC. The USB controller is working fine with some mice 
and keyboards.
The touchscreen itself is also working when I plug it to some other proprietary 
PC. ;-)
So, the hardware is okay.

Now, the interesting part is:
When I don't add a specific rule to udev and I connect the touchscreen to an 
USB port,
lsusb shows the TSC-10 as 0afa:03e8, which is correct:
$ lsusb
Bus 2 Device 1: ID :
Bus 1 Device 1: ID :
Bus 3 Device 5: ID 0afa:03e8
Bus 3 Device 1: ID :

When I add
$ cat /etc/udev/rules.d/10-local.rules
BUS=="usb", SYSFS{manufacturer}=="TSC-10 DM", NAME="input/touch"

and unplug/plug the touchscreen, I get indeed a device /dev/input/touch:
$ ls -l /dev/input/
total 0
crw-r--r-- 1 root root  13, 63 Jan  1  1970 mice
crw-rw 1 root root 253,  7 Jun 26 18:28 touch

BUT the touchscreen disappears from
$ lsusb
Bus 2 Device 1: ID :
Bus 1 Device 1: ID :
Bus 3 Device 1: ID :

Why does the device disappear from the lsusb output? *confused*

When I want to open /dev/input/touch to dump it's events to the console, it
just:
$ evdump /dev/input/touch
Cannot open device file!
Error: No such device or addres


When I connect some ImPS/2 mouse to the USB, it shows up as

$ lsusb
Bus 2 Device 1: ID :
Bus 1 Device 1: ID :
Bus 3 Device 28: ID 045e:0095 Kleinweich Corp.
Bus 3 Device 1: ID :

$ ls -l /dev/input/
total 0
crw--- 1 root root 13,  64 Jun 26 18:30 event0
crw-r--r-- 1 root root 13,  63 Jan  1  1970 mice
crw-r--r-- 1 root root 13,  32 Jun 26 18:30 mouse0
crw-r--r-- 1 root root 13, 128 Jun 26 18:30 ts0

$ evdump /dev/input/event0
value 1, type 2, code 0
value 0, type 0, code 0
value 1, type 2, code 0
value -1, type 2, code 1
value 0, type 0, code 0
value 1, type 2, code 0
value 0, type 0, code 0
[...]

...it just works.


So, how do I get a working device node when I plug the TSC-10 to USB?
How can I interface to that touchscreen's device event interface?
(I want to get it working in X as a second pointing device along with the
mouse...)

The kernel's usbtouchscreen.c should support that hardware since about 2.6.18.
I am quite sure I am missing something very basic, here...

Thank you in advance!

--
Here are some more details:

$ cat evdump.c

#include 
#include 
#include 
#include 

int main(int argc, char **argv)
{
int evfd;
struct input_event ev;

/* one arg: device name */
if (argc != 2) {
fprintf(stderr, "Usage %s !\n", argv[0]);
return 1;
}

/*evfd = open(argv[1], O_RDONLY | O_NONBLOCK);*/
evfd = open(argv[1], O_RDONLY);
if (evfd == -1) {
fprintf(stderr, "Cannot open device file!\n");
perror("Error");
return 1;
}

while(1) {
read(evfd, , sizeof(struct input_event));
printf("value %d, type %d, code %d\n",ev.value,ev.type,ev.code);
}

return 0;
}

$ uname -a
Linux fox 2.6.21.5 #2 Thu Jun 28 19:54:40 CEST 2007 ppc e500 GNU/Linux

$ cat /proc/cpuinfo
processor   : 0
cpu : e500
revision: 2.0 (pvr 8020 0020)
bogomips: 831.48
chipset : 8540
Vendor  : Freescale Semiconductor
Machine : mpc8540ads
clock   : 833MHz
PVR : 0x80200020
SVR : 0x80300020
PLL setting : 0x5
Memory  : 256 MB

$ gzip -c -d /proc/config.gz | grep "TOUCH"
CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_GUNZE is not set
# CONFIG_TOUCHSCREEN_ELO is not set
# CONFIG_TOUCHSCREEN_MTOUCH is not set
# CONFIG_TOUCHSCREEN_MK712 is not set
# CONFIG_TOUCHSCREEN_PENMOUNT is not set
# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
# CONFIG_TOUCHSCREEN_UCB1400 is not set
# CONFIG_USB_STORAGE_ONETOUCH is not set
CONFIG_USB_TOUCHSCREEN=y
# CONFIG_USB_TOUCHSCREEN_EGALAX is not set
# CONFIG_USB_TOUCHSCREEN_PANJIT is not set
# CONFIG_USB_TOUCHSCREEN_3M is not set
# CONFIG_USB_TOUCHSCREEN_ITM is not set
# CONFIG_USB_TOUCHSCREEN_ETURBO is not set
# CONFIG_USB_TOUCHSCREEN_GUNZE is not set
CONFIG_USB_TOUCHSCREEN_DMC_TSC10=y
# CONFIG_USB_APPLETOUCH is not set

$ gzip -c -d /proc/config.gz | grep "INPUT"
CONFIG_INPUT=y
# CONFIG_INPUT_FF_MEMLESS is not set
CONFIG_INPUT_MOUSEDEV=y
CONFIG_INPUT_MOUSEDEV_PSAUX=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=640
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=480
# CONFIG_INPUT_JOYDEV is not set
CONFIG_INPUT_TSDEV=y
CONFIG_INPUT_TSDEV_SCREEN_X=640
CONFIG_INPUT_TSDEV_SCREEN_Y=480
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_EVBUG=m
CONFIG_INPUT_KEYBOARD=y
CONFIG_INPUT_MOUSE=y
# CONFIG_INPUT_JOYSTICK is not set
CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_INPUT_MISC is not set
# 

no luck with DMC TSC-10 touchscreen on USB

2007-06-26 Thread Clemens Koller

Hello!

I'm writing this to lkml since the linux-usb-users list seems to be stuck
in spam and I didn't receive an answer during the last week.

I have a DMC TSC-103 touchscreen controller on a ISP1563 EHCI/OHCI USB 
controller
on PCI on an MPC8540 PowerPC. The USB controller is working fine with some mice 
and keyboards.
The touchscreen itself is also working when I plug it to some other proprietary 
PC. ;-)
So, the hardware is okay.

Now, the interesting part is:
When I don't add a specific rule to udev and I connect the touchscreen to an 
USB port,
lsusb shows the TSC-10 as 0afa:03e8, which is correct:
$ lsusb
Bus 2 Device 1: ID :
Bus 1 Device 1: ID :
Bus 3 Device 5: ID 0afa:03e8
Bus 3 Device 1: ID :

When I add
$ cat /etc/udev/rules.d/10-local.rules
BUS==usb, SYSFS{manufacturer}==TSC-10 DM, NAME=input/touch

and unplug/plug the touchscreen, I get indeed a device /dev/input/touch:
$ ls -l /dev/input/
total 0
crw-r--r-- 1 root root  13, 63 Jan  1  1970 mice
crw-rw 1 root root 253,  7 Jun 26 18:28 touch

BUT the touchscreen disappears from
$ lsusb
Bus 2 Device 1: ID :
Bus 1 Device 1: ID :
Bus 3 Device 1: ID :

Why does the device disappear from the lsusb output? *confused*

When I want to open /dev/input/touch to dump it's events to the console, it
just:
$ evdump /dev/input/touch
Cannot open device file!
Error: No such device or addres


When I connect some ImPS/2 mouse to the USB, it shows up as

$ lsusb
Bus 2 Device 1: ID :
Bus 1 Device 1: ID :
Bus 3 Device 28: ID 045e:0095 Kleinweich Corp.
Bus 3 Device 1: ID :

$ ls -l /dev/input/
total 0
crw--- 1 root root 13,  64 Jun 26 18:30 event0
crw-r--r-- 1 root root 13,  63 Jan  1  1970 mice
crw-r--r-- 1 root root 13,  32 Jun 26 18:30 mouse0
crw-r--r-- 1 root root 13, 128 Jun 26 18:30 ts0

$ evdump /dev/input/event0
value 1, type 2, code 0
value 0, type 0, code 0
value 1, type 2, code 0
value -1, type 2, code 1
value 0, type 0, code 0
value 1, type 2, code 0
value 0, type 0, code 0
[...]

...it just works.


So, how do I get a working device node when I plug the TSC-10 to USB?
How can I interface to that touchscreen's device event interface?
(I want to get it working in X as a second pointing device along with the
mouse...)

The kernel's usbtouchscreen.c should support that hardware since about 2.6.18.
I am quite sure I am missing something very basic, here...

Thank you in advance!

--
Here are some more details:

$ cat evdump.c

#include stdio.h
#include stdlib.h
#include linux/input.h
#include fcntl.h

int main(int argc, char **argv)
{
int evfd;
struct input_event ev;

/* one arg: device name */
if (argc != 2) {
fprintf(stderr, Usage %s device!\n, argv[0]);
return 1;
}

/*evfd = open(argv[1], O_RDONLY | O_NONBLOCK);*/
evfd = open(argv[1], O_RDONLY);
if (evfd == -1) {
fprintf(stderr, Cannot open device file!\n);
perror(Error);
return 1;
}

while(1) {
read(evfd, ev, sizeof(struct input_event));
printf(value %d, type %d, code %d\n,ev.value,ev.type,ev.code);
}

return 0;
}

$ uname -a
Linux fox 2.6.21.5 #2 Thu Jun 28 19:54:40 CEST 2007 ppc e500 GNU/Linux

$ cat /proc/cpuinfo
processor   : 0
cpu : e500
revision: 2.0 (pvr 8020 0020)
bogomips: 831.48
chipset : 8540
Vendor  : Freescale Semiconductor
Machine : mpc8540ads
clock   : 833MHz
PVR : 0x80200020
SVR : 0x80300020
PLL setting : 0x5
Memory  : 256 MB

$ gzip -c -d /proc/config.gz | grep TOUCH
CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_GUNZE is not set
# CONFIG_TOUCHSCREEN_ELO is not set
# CONFIG_TOUCHSCREEN_MTOUCH is not set
# CONFIG_TOUCHSCREEN_MK712 is not set
# CONFIG_TOUCHSCREEN_PENMOUNT is not set
# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
# CONFIG_TOUCHSCREEN_UCB1400 is not set
# CONFIG_USB_STORAGE_ONETOUCH is not set
CONFIG_USB_TOUCHSCREEN=y
# CONFIG_USB_TOUCHSCREEN_EGALAX is not set
# CONFIG_USB_TOUCHSCREEN_PANJIT is not set
# CONFIG_USB_TOUCHSCREEN_3M is not set
# CONFIG_USB_TOUCHSCREEN_ITM is not set
# CONFIG_USB_TOUCHSCREEN_ETURBO is not set
# CONFIG_USB_TOUCHSCREEN_GUNZE is not set
CONFIG_USB_TOUCHSCREEN_DMC_TSC10=y
# CONFIG_USB_APPLETOUCH is not set

$ gzip -c -d /proc/config.gz | grep INPUT
CONFIG_INPUT=y
# CONFIG_INPUT_FF_MEMLESS is not set
CONFIG_INPUT_MOUSEDEV=y
CONFIG_INPUT_MOUSEDEV_PSAUX=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=640
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=480
# CONFIG_INPUT_JOYDEV is not set
CONFIG_INPUT_TSDEV=y
CONFIG_INPUT_TSDEV_SCREEN_X=640
CONFIG_INPUT_TSDEV_SCREEN_Y=480
CONFIG_INPUT_EVDEV=y
CONFIG_INPUT_EVBUG=m
CONFIG_INPUT_KEYBOARD=y
CONFIG_INPUT_MOUSE=y
# CONFIG_INPUT_JOYSTICK is not set
CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_INPUT_MISC is not set