From 118909b4774b47d0b84446e20fd8a6aeed1eabf7 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Tue, 26 Apr 2011 16:56:28 +0000 Subject: h-client: started the parsing of the lsusb command --- h-client/credits.txt | 3 ++- h-client/hlibrary.py | 21 +++++++++++++++++---- h-client/test.py | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'h-client') diff --git a/h-client/credits.txt b/h-client/credits.txt index 792f571..e772eff 100644 --- a/h-client/credits.txt +++ b/h-client/credits.txt @@ -23,5 +23,6 @@ odict.py Copyright (C) 2005 Nicola Larosa, Michael Foord python library to manage ordered dictionaries licensed under the terms of the BSD license - +E-mail: nico AT tekNico DOT net, fuzzyman AT voidspace DOT org DOT uk +Documentation at http://www.voidspace.org.uk/python/odict.html diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py index 38e7f78..f0e84d6 100644 --- a/h-client/hlibrary.py +++ b/h-client/hlibrary.py @@ -510,6 +510,7 @@ class Client: def createDevices(self): + #parse the poutput of the lspci command if not os.system('lspci -vmmnn > tmp/temp'): f = open('tmp/temp','r') @@ -551,18 +552,30 @@ class Client: self.devices['p_' + dev.getVendorId() + ':' + dev.getProductId()] = [dev,cl.group(2),'insert','0'] else: - self._status = False self.errors.append('the lspci -vmmnn output is not a standard output, some products row not found') else: - self._status = False self.errors.append('the lspci -vmmnn output is not a standard output, some vendors row not found') else: - self._status = False self.errors.append('the lspci -vmmnn output is not a standard output, some class row not found') f.close(); else: - self._status = False + self.errors.append('tmp folder not writable') + + #parse the poutput of the lspci command + if not os.system('lsusb -v > tmp/temp'): + f = open('tmp/temp','r') + + while 1: + row = f.readline() + + print row + + if not row: + break + + f.close(); + else: self.errors.append('tmp folder not writable') #syncronize with the xml database diff --git a/h-client/test.py b/h-client/test.py index 07ccca0..9fef89c 100644 --- a/h-client/test.py +++ b/h-client/test.py @@ -23,7 +23,7 @@ client.setNode('http://h-source/') client.createDevices() #client.request.perform('download/all/it') #print client.request.url -client.sync() +#client.sync() #for key,dev in client.devices.iteritems(): #print key -- cgit v1.2.3