Coder Social home page Coder Social logo

facebook / pcicrawler Goto Github PK

View Code? Open in Web Editor NEW
184.0 26.0 33.0 70 KB

pcicrawler is a Python based command line interface tool which can be used to display, filter and export information about PCI (Peripheral Component Interconnect) or PCIe buses and devices, as well as PCI topology.

License: MIT License

Python 100.00%

pcicrawler's Issues

Root permissions should not be a requirement?

After looking at all the options available through --help. It looks like this is a read-only access to pci config space. So ideally root access should not be a requirement.

Also took a quick look at sysfs - /sys/pci/devices/

ls -rtl /sys/devices/pci0000\:00/0000\:00\:00.0/config 
-rw-r--r-- 1 root root 256 Aug  6 23:28 /sys/devices/pci0000:00/0000:00:00.0/config

shows config space is world readable.

Also, I can run lspci -t without a root user.

I quickly tried to remove the check and test - it's not working consistently. But once or twice it did show up a couple of devices!

New release since 2021

Its kinda unfortunate that the original repo was moved and the history was lost.

However, it seems like there have been some changes since 2021. A new pypi release would be really appreciated.

Thanks!

devices silently dropped when outputting in tree mode

pcicrawler -t displays nothing when all devices are root devices (e.g. when running on a VM as below):

# pcicrawler -t
#

Adding some print statement, I can see the devices are there, but are silently skipped:

# pcicrawler -t
<PCIDevice vendor_id=0x8086 device_id=0x1237 class_id=0x60000 domain_id=0x0000 bus_id=0x0000 bus_device_id=0x0000 device_function_id=0x0000>
<PCIDevice vendor_id=0x8086 device_id=0x7000 class_id=0x60100 domain_id=0x0000 bus_id=0x0000 bus_device_id=0x0001 device_function_id=0x0000>
<PCIDevice vendor_id=0x8086 device_id=0x7010 class_id=0x10180 domain_id=0x0000 bus_id=0x0000 bus_device_id=0x0001 device_function_id=0x0001>
<PCIDevice vendor_id=0x8086 device_id=0x7020 class_id=0xc0300 domain_id=0x0000 bus_id=0x0000 bus_device_id=0x0001 device_function_id=0x0002>
<PCIDevice vendor_id=0x8086 device_id=0x7113 class_id=0x68000 domain_id=0x0000 bus_id=0x0000 bus_device_id=0x0001 device_function_id=0x0003>
<PCIDevice vendor_id=0x1013 device_id=0x00B8 class_id=0x30000 domain_id=0x0000 bus_id=0x0000 bus_device_id=0x0002 device_function_id=0x0000>
<PCIDevice vendor_id=0x1AF4 device_id=0x1000 class_id=0x20000 domain_id=0x0000 bus_id=0x0000 bus_device_id=0x0003 device_function_id=0x0000>
<PCIDevice vendor_id=0x1AF4 device_id=0x1001 class_id=0x10000 domain_id=0x0000 bus_id=0x0000 bus_device_id=0x0004 device_function_id=0x0000>
<PCIDevice vendor_id=0x1AF4 device_id=0x1002 class_id=0xff00 domain_id=0x0000 bus_id=0x0000 bus_device_id=0x0005 device_function_id=0x0000>

Would it be possible to display these devices in tree mode?

Compare to e.g. the output of lspci in tree mode:

# lspci -t -vv
-[0000:00]-+-00.0  Intel Corporation 440FX - 82441FX PMC [Natoma]
           +-01.0  Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
           +-01.1  Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
           +-01.2  Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II]
           +-01.3  Intel Corporation 82371AB/EB/MB PIIX4 ACPI
           +-02.0  Cirrus Logic GD 5446
           +-03.0  Red Hat, Inc. Virtio network device
           +-04.0  Red Hat, Inc. Virtio block device
           \-05.0  Red Hat, Inc. Virtio memory balloon

or to the output of pcicrawler without tree mode:

# pcicrawler
0000:00:04.0, Red Hat, Inc. (1af4) Virtio block device (1001)
0000:00:05.0, Red Hat, Inc. (1af4) Virtio memory balloon (1002)
0000:00:01.1, Intel Corporation (8086) 82371SB PIIX3 IDE [Natoma/Triton II] (7010)
0000:00:01.3, Intel Corporation (8086) 82371AB/EB/MB PIIX4 ACPI (7113)
0000:00:02.0, Cirrus Logic (1013) GD 5446 (00b8)
0000:00:03.0, Red Hat, Inc. (1af4) Virtio network device (1000)
0000:00:01.2, Intel Corporation (8086) 82371SB PIIX3 USB [Natoma/Triton II] (7020)
0000:00:01.0, Intel Corporation (8086) 82371SB PIIX3 ISA [Natoma/Triton II] (7000)
0000:00:00.0, Intel Corporation (8086) 440FX - 82441FX PMC [Natoma] (1237)

Failure when running on ubuntu focal

Stacktrace:

Traceback (most recent call last):
  File "/usr/local/bin/pcicrawler", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pcicrawler/cli.py", line 292, in main
    exptype = dev.express_type
  File "/usr/local/lib/python3.8/dist-packages/pci_lib/pci_lib.py", line 42, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/local/lib/python3.8/dist-packages/pci_lib/pci_lib.py", line 553, in express_type
    express = find_capability(config, PCI_CAP_EXPRESS)
  File "/usr/local/lib/python3.8/dist-packages/pci_lib/pci_lib.py", line 153, in find_capability
    cap_id = read_u8(config, pos)
  File "/usr/local/lib/python3.8/dist-packages/pci_lib/pci_lib.py", line 122, in read_u8
    r, = struct.unpack('B', data[offset:offset + 1])
  File "/usr/local/lib/python3.8/dist-packages/pci_lib/pci_lib.py", line 299, in __getitem__
    return b''.join(int2byte(b) for b in data)
  File "/usr/local/lib/python3.8/dist-packages/pci_lib/pci_lib.py", line 299, in <genexpr>
    return b''.join(int2byte(b) for b in data)
struct.error: required argument is not an integer```

Extend the tool to dump config space

Bumped into this tool. Built and installed it for ubuntu 18.04. I was hoping this would dump config space in a humanly readable format. Let me know if this is something being planned.

Error while running `pcicrawler` utility

While running the pcicrawler utility from within a virtual-environment - Following ModuleNotFound error is observed -

(venv) gabhijit@gabhijit-GL553VD:~/backup/personal-code/pcicrawler$ pcicrawler
Traceback (most recent call last):
  File "/home/gabhijit/backup/personal-code/pcicrawler/venv/bin/pcicrawler", line 11, in <module>
    load_entry_point('pcicrawler==0.1.0', 'console_scripts', 'pcicrawler')()
  File "/home/gabhijit/backup/personal-code/pcicrawler/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/gabhijit/backup/personal-code/pcicrawler/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2859, in load_entry_point
    return ep.load()
  File "/home/gabhijit/backup/personal-code/pcicrawler/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2450, in load
    return self.resolve()
  File "/home/gabhijit/backup/personal-code/pcicrawler/venv/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/gabhijit/backup/personal-code/pcicrawler/venv/lib/python3.7/site-packages/pcicrawler-0.1.0-py3.7.egg/pcicrawler/cli.py", line 12, in <module>
ModuleNotFoundError: No module named 'pcicrawler.lib'

Indeed there is no module named lib inside pcicrawler.

This error is observed while running from the checked out repo after doing a setup.py install in virtualenv.

Update for PCIe 5.0 and 6.0 support

Link Status shows the speed as unknown due to it is not Gen 5 ready, can you please update it? also Link Cap should be updated to allow Gen 5 devices to show Gen5 and gen6

Add to PyPi

Publish a package for this on PyPi. Among other things, this will make it easier to get pcicrawler packaged in distros

Renaming master branch to main

Renaming master branch to main

As a part of a broad effort to avoid problematic terminology in our software, we are renaming our default branch from master to main. We recognize that this is only a small step, but it is an opportunity to make our project and community more welcoming to historically marginalized communities.

How does this impact my development process?

There should be very little impact. GitHub will surface the branch name change in your fork, if you have one. For new forks, you will automatically have main as the default branch.

We encourage the use of feature branches for local development. The only change in practice is changing which branch your feature branch is started from. When sending Pull Requests on GitHub, the target will default to our main branch, so there are no changes to make there.

I have a lot of tools that depend on master being the upstream branch name. How can I fix that?

master has always been only a default value and a number of projects have used other names for their primary development branch for years. We encourage updating your tooling to instead dynamically determine the branch to use. This article provides insight into how you can do that. Additionally, you can always set up a branch locally of any name to track our main branch.

I'd like to do this for my own projects, do you have any documentation on how this works?

GitHub has published a guide documenting their tooling. We recommend reading that and the accompanying documentation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.