/usr/bin/xpci is in xdiagnose 3.8.8.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #!/usr/bin/python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#
# Copyright (C) 2010-2012 Bryce Harrington <bryce@canonical.com>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import os
import sys
# Add project root directory (enable symlink, and trunk execution).
PROJECT_ROOT_DIRECTORY = os.path.abspath(
os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'xdiagnose'))
and PROJECT_ROOT_DIRECTORY not in sys.path):
sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY) # for subprocesses
from xdiagnose.pci_devices import get_pci_devices
from xdiagnose.utils import debug
if __name__ == "__main__":
from xdiagnose import info
from xdiagnose.utils.option_handler import OptionHandler
opt_hand = OptionHandler(info)
opt_hand.add('-v', '--verbose', dest='verbose',
help='Show debug messages',
action='store_true', default=False,
desc='Turns on verbose debugging output.')
opts, args = opt_hand.parse_args()
debug.DEBUGGING = opts.verbose
if len(args) > 0:
text = ' '.join(args)
else:
import subprocess
process = subprocess.Popen('lspci -vvnn', shell=True, stdout=subprocess.PIPE)
text = process.communicate()[0]
devices = get_pci_devices(text)
if devices is None:
sys.exit(1)
for device in devices:
if device:
print(device.name, device.regex, end='')
if device.generation:
print('', device.generation, end='')
if device.title:
print('', device.title, end='')
print('', ','.join(device.drivers), end='')
if not device.supported:
print(" (NOT SUPPORTED)")
print("")
|