diff options
author | Christophe Fergeau <cfergeau@mandriva.com> | 2009-07-03 18:09:24 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@mandriva.com> | 2009-07-03 18:31:19 +0200 |
commit | 4c7b259e6988ad434e843b1d3aab274e8324a1c3 (patch) | |
tree | c0035bc2c0c3e83b630128723929feb6d58fff2b /tools | |
parent | d011a4ae3f9d7db2240288e47a9b1446f100dc4c (diff) |
in mpi files, make sure product ID lists are ;-separated
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/fdi2mpi.py | 8 | ||||
-rwxr-xr-x | tools/mpi2udev.py | 9 |
2 files changed, 12 insertions, 5 deletions
diff --git a/tools/fdi2mpi.py b/tools/fdi2mpi.py index cd59c4a..da7801d 100755 --- a/tools/fdi2mpi.py +++ b/tools/fdi2mpi.py @@ -91,7 +91,7 @@ def match_op2glob(node): for a in alternatives: hex_alternatives.append('%04x' % int(a, 0)) - gl = '|'.join(hex_alternatives) + gl = ';'.join(hex_alternatives) id = '_'.join([v.replace(' ', '_').lower() for v in hex_alternatives]) return (gl, id) @@ -157,7 +157,7 @@ def mkfilename(attrs, current_vendor): if 'USBModel' in attrs.get('Device', {}): m = attrs['Device']['USBModel'] # if we only have a single product ID, attempt to get nicer name - if '|' not in attrs['Device'].get('ProductID', [''])[0] and \ + if ';' not in attrs['Device'].get('ProductID', [''])[0] and \ 'Product' in attrs.get('Device', {}) and \ '/' not in attrs['Device']['Product']: m = attrs['Device']['Product'] @@ -166,13 +166,13 @@ def mkfilename(attrs, current_vendor): if type(m) == type([]): m = '_'.join(m) - m = m.replace(' ', '_').replace('|', '_').replace('*', '').replace('(', + m = m.replace(' ', '_').replace(';', '_').replace('*', '').replace('(', '').replace(')', '').lower() assert m assert '*' not in m, m assert '[' not in m, m - assert '|' not in m, m + assert ';' not in m, m assert '(' not in m, m assert ')' not in m, m assert ' ' not in m, m diff --git a/tools/mpi2udev.py b/tools/mpi2udev.py index 5f50c8e..fc1dbae 100755 --- a/tools/mpi2udev.py +++ b/tools/mpi2udev.py @@ -39,12 +39,19 @@ def parse_mpi(mpi): print '#', m except ConfigParser.NoOptionError: pass - for name in ['vendorid', 'productid', 'usbvendor', 'usbproduct']: + for name in ['vendorid', 'usbvendor', 'usbproduct']: try: value = cp.get('Device', name) print mpi2udev[name] % value, ',', except ConfigParser.NoOptionError: continue + + try: + productids = cp.get('Device', 'productid').replace(';', '|') + print mpi2udev['productid'] % productids, ',', + except ConfigParser.NoOptionError: + pass + print 'ENV{ID_MEDIA_PLAYER}="%s"' % os.path.splitext(os.path.basename(mpi))[0] # |