~ubuntu-branches/ubuntu/precise/checkbox/precise

« back to all changes in this revision

Viewing changes to scripts/network_test

  • Committer: Bazaar Package Importer
  • Author(s): Marc Tardif
  • Date: 2009-01-20 16:46:15 UTC
  • Revision ID: james.westby@ubuntu.com-20090120164615-7iz6nmlef41h4vx2
Tags: 0.4
* Setup bzr-builddeb in native mode.
* Removed LGPL notice from the copyright file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
import os
 
4
import re
 
5
import sys
 
6
 
 
7
 
 
8
def main(args):
 
9
    devices = []
 
10
    command = "lspci"
 
11
    for line in os.popen(command).readlines():
 
12
        match = re.match("^.*(Network|Ethernet) controller: (.*)", line)
 
13
        if match:
 
14
            devices.append(match.group(2))
 
15
 
 
16
    if devices:
 
17
        print "\n".join(devices)
 
18
    else:
 
19
        print "Not found."
 
20
 
 
21
    return 0
 
22
 
 
23
 
 
24
if __name__ == "__main__":
 
25
    sys.exit(main(sys.argv[1:]))