Skip to main content

sysfstree displayes gadget usb information from the ConfigFS and SysFS

Project description

SysFSTree

sysfstree implements a generator function that will recursively iterate a file system, typically /sys, retrieving the contents of the files, and displaying the path names and data in a fashion similar to the tree(1) command.

A small python module for generating annotated tree(1) style output for /sys items.

This can be used by other modules to generate system specific tools that allow for showing system specific information.

Calling sequence:

import sysfstree

sysfs = sysfstree(root, maxlevel, include, exclude):
for l in sysfs._tree(p, os.listdir(p), "", -1):
    print("%s" % (l))

Where:

  • root is the top level path to start at
  • maxlevel is the maximum depth to recurse to
  • include is a list of requested includes at each recursion level
  • exclude is a list of requested excludes at each recursion level

The include and exclude use shell matching (fnmatch).

Examples

The sysfstree_raspbian Python package uses this module to display information about various various Raspbian specific areas in /sys. For example:

# sysfstree_raspbian --gadget

# sysfstree_raspbian --soc-udc

That was generated by:

import sysfstree
    sysfs = sysfstree("/sys/kernel/config/usb_gadget")
    for l in sysfs._tree(p, os.listdir(p), "", -1):
            print("%s" % (l))

import sysfstree
    sysfs = sysfstree("/sys/kernel/config/usb_gadget")
    for l in sysfs._tree(p, os.listdir(p), "", -1):
            print("%s" % (l))

Running Tests

sysfstree currently only has doctests.

Run tests with nose::

nosetests --with-doctest src/sysfstree

Run tests with doctest::

python -m doctest -v src/sysfstree/__init__.py

Author

Stuart.Lynne@belcarra.com Copyright (c) 2020 Belcarra Technologies (2005) Corp.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sysfstree, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size sysfstree-0.1.2-py3.7.egg (8.9 kB) File type Egg Python version 3.7 Upload date Hashes View hashes
Filename, size sysfstree-0.1.2.tar.gz (10.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page