multi-touch-dev team mailing list archive
-
multi-touch-dev team
-
Mailing list archive
-
Message #00244
Re: script to detect MT devices
$ python scan-for-mt-devices
Found device(s):
Acer T230H: /dev/input/event3
Works like a charm !
* Ara Pulido <ara.pulido@xxxxxxxxxxxxx> [2010-08-18 12:32:47]:
> Marc Tardif was kind enough to write the script in Python (which will
> make integration with apport much easier).
>
> Can you guys try it with your hardware, please?
>
> Thanks!
> Ara.
>
> El 18/08/10 07:48, Rafi Rubin escribió:
> > Not present on 2.6.35-{14,15,16} for x86_64 on my xt.
> >
> > $ cat /sys/class/input/event*/dev*/cap*/abs ~ 1:14AM
> > holly
> > 0
> > 0
> > 0
> > 0
> > 0
> > 0
> > 1000003
> > 73010000000003
> > 30000000003
> > 0
> > 0
> > 0
> > $ uname -a ~ 1:15AM
> > holly
> > Linux holly 2.6.35-15-generic #21-Ubuntu SMP Wed Aug 11 17:06:48 UTC 2010
> > x86_64 GNU/Linux
> >
> >
> > I will start a 32b image download and will have to figure out a way to
> > test multiple kernels. I guess I can blow away swap or something for
> > another install.
> >
> > Nothing terribly obvious in the delta of the source for -13 -> -15
> > (assuming I grabbed the correct git tree).
> >
> > Anyway the functions in questions are input_bits_to_string
> > (input.c:814ish) and input_print_bitmap (1218) or maybe
> > input_seq_print_bitmap.
> >
> > Anyway should be easy enough to figure out, and we probably should do to
> > increase consistency. However, it might also make sense to adjust the
> > script to account for buggy kernels which might not get fixed before
> > people start testing and asking questions.
> >
> > Rafi
> >
> > On Wed, Aug 18, 2010 at 12:58:20AM +0200, Mohamed Ikbel Boulabiar wrote:
> >> I have exactly the same cat output and the same kernel as Duncan with my hp tx2.
> >>
> >> ik.
> >>
> >> On Wed, Aug 18, 2010 at 12:56 AM, Duncan McGreggor
> >> <duncan.mcgreggor@xxxxxxxxxxxxx> wrote:
> >>>>> Henrik and Rafi,
> >>>>>
> >>>>> I've tried to use this script with the Lenovo T410s, and it fails. It
> >>>>> seems that the following N-trig device returns two integers instead of
> >>>>> the expected one integer:
> >>>>>
> >>>>> ? ?/sys/class/input/event10/device/capabilities/abs
> >>>>>
> >>>>> cat'ing it gives the following:
> >>>>>
> >>>>> ? ?730100 3
> >>>>
> >>>> That is a bit strange. ?What kernel version were you using at the time
> >>>> and do you have another kernel version installed?
> >>>>
> >>>> (wondering if its just a broken sprintf)
> >>>
> >>> ?$ uname -a
> >>> ?Linux bree 2.6.35-15-generic #21-Ubuntu SMP Wed Aug 11 16:41:40 UTC
> >>> 2010 i686 GNU/Linux
> >>
> >> _______________________________________________
> >> Mailing list: https://launchpad.net/~multi-touch-dev
> >> Post to : multi-touch-dev@xxxxxxxxxxxxxxxxxxx
> >> Unsubscribe : https://launchpad.net/~multi-touch-dev
> >> More help : https://help.launchpad.net/ListHelp
> >>
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~multi-touch-dev
> > Post to : multi-touch-dev@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~multi-touch-dev
> > More help : https://help.launchpad.net/ListHelp
> #!/usr/bin/env python
>
> import os
> import sys
>
> from glob import glob
> from optparse import OptionParser
>
>
> class Event(object):
>
> def __init__(self, path):
> self.path = path
>
> @property
> def capabilities(self):
> path = os.path.join(self.path, "device", "capabilities", "abs")
> line = read_line(path)
> capabilities = 0
> for i, word in enumerate(line.split(" ")):
> capabilities += int(word, 16) * 2^(i*4)
> return capabilities
>
> @property
> def device(self):
> base = os.path.basename(self.path)
> return os.path.join("/dev", "input", base)
>
> @property
> def name(self):
> path = os.path.join(self.path, "device", "name")
> return read_line(path)
>
>
> def get_events(input):
> event_glob = os.path.join(input, "event*")
> for event_path in glob(event_glob):
> yield Event(event_path)
>
> def read_line(path):
> f = open(path)
> try:
> return f.readline().strip()
> finally:
> f.close()
>
> def main(args):
> usage = "Usage: %prog [OPTIONS]"
> parser = OptionParser(usage=usage)
> parser.add_option("-i", "--input",
> metavar="FILE",
> default="/sys/class/input",
> help="Input sysfs directory")
> (options, args) = parser.parse_args(args)
>
> detected = False
> for event in get_events(options.input):
> if event.capabilities & 0x35:
> if not detected:
> detected = True
> print "Found device(s):"
> print "%s: %s" % (event.name, event.device)
>
> if not detected:
> print "No MT-capable device found..."
> return 1
>
> else:
> return 0
>
> if __name__ == "__main__":
> sys.exit(main(sys.argv[1:]))
> _______________________________________________
> Mailing list: https://launchpad.net/~multi-touch-dev
> Post to : multi-touch-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~multi-touch-dev
> More help : https://help.launchpad.net/ListHelp
References