Hey Tom, Tom Gundersen [2013-07-18 16:41 +0200]: > udev recently gained a hardware database that is intended to replace large > udev rule files such as the one shipped with media-player-info. This should > give a significant (>50%) speed-up in the processing of usb add events.
Thanks for working on this! > This patch adds support for converting mpi to hwdb (where applicable), and > restricts the mpi2udev tool to only output the entries that cannot be > represented in the hwdb format (currently there are only three of them). This needs some Makefile.am integration to actually get called during build, and the .hwdb installed etc., but that's not too difficult. However, for now I would appreciate if this could become a configure option, and the tools get changed in a way to support both pure udev rule mode as well as the new hwdb mode. Distributions like Debian don't yet have a hwdb-capable udev, and this is also a package which commonly gets backported to older stable distro releases where hwdb doesn't exist yet either. Could you please rework this to support either mode? > --- a/tools/mpi2udev.py > +++ b/tools/mpi2udev.py > @@ -2,6 +2,7 @@ > # Generate udev rules from music player identification (.mpi) files > # > # (C) 2009 Canonical Ltd. > +# (C) 2013 Tom Gundersen <t...@jklm.no> > # Author: Martin Pitt <martin.p...@ubuntu.com> > # > # This program is free software; you can redistribute it and/or modify it > @@ -37,47 +38,34 @@ def parse_mpi(mpi): > assert cp.read(mpi) > > try: > - m = cp.get('Device', 'product') > - print '#', m > + cp.get('Device', 'devicematch') > + > except ConfigParser.NoOptionError: This is now the main check whether or not we should create an udev rule for this device (i. e. for everything which does not have a DeviceMatch field). It should be easier to read to do this as a plain "if" condition with a comment about that which just "continue"s, instead of stuffing the whole actual logic into the big "except" block below. By extending the if condition it will also be easier to support the old mode ("has DeviceMatch and we are configured for hwdb"). I think that's the main change to this script, right? the rest is just diff noise due to the changed indentation. Thanks! Martin -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
signature.asc
Description: Digital signature
_______________________________________________ devkit-devel mailing list devkit-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/devkit-devel