• How to find any documentation for smbus?

    From Chris Green@21:1/5 to All on Sat Oct 28 17:08:00 2023
    I am using the python3 smbus module, but it's hard work because of the
    lack of documentation. Web searches confirm that the documentation is
    somewhat thin!

    If you do the obvious this is what you get:-

    >>> import smbus
    >>> dir (smbus)
    ['SMBus', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']
    >>> help(smbus)


    Help on module SMBus:

    NAME
    SMBus

    DESCRIPTION
    This module defines an object type that allows SMBus transactions
    on hosts running the Linux kernel. The host kernel must have I2C
    support, I2C device interface support, and a bus adapter driver.
    All of these can be either built-in to the kernel, or loaded from
    modules.

    Because the I2C device interface is opened R/W, users of this
    module usually must have root permissions.

    FILE
    /usr/lib/python3/dist-packages/smbus.cpython-39-arm-linux-gnueabihf.so


    Even a list of available methods would be handy! :-)


    Presumably python3's smbus is just a wrapper so if I could find the underlying C/C++
    documentation it might help.

    --
    Chris Green
    ·

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Green@21:1/5 to Dan Purgert on Sat Oct 28 17:50:51 2023
    Dan Purgert <dan@djph.net> wrote:
    On 2023-10-28, Chris Green wrote:
    I am using the python3 smbus module, but it's hard work because of the
    lack of documentation. Web searches confirm that the documentation is somewhat thin!


    The SMBus spec is available from http://smbus.org (or at least it used
    to be ... watch it be hidden behind a paywall now).

    That provides very detailed hardware information but virtually nothing
    at all about software libraries and such. Lots of interesting
    reading, for example there's an appendix detailing the differences
    between smbus and i2c, but nothing very helpful for a poor old
    application programmer like me! :-)

    --
    Chris Green
    ·

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From km@21:1/5 to All on Sat Oct 28 20:19:22 2023
    Il Sat, 28 Oct 2023 17:08:00 +0100, Chris Green ha scritto:

    I am using the python3 smbus module, but it's hard work because of the
    lack of documentation. Web searches confirm that the documentation is somewhat thin!

    If you do the obvious this is what you get:-

    >>> import smbus dir (smbus)
    ['SMBus', '__doc__', '__file__', '__loader__', '__name__',
    '__package__', '__spec__']
    >>> help(smbus)


    Help on module SMBus:

    NAME
    SMBus

    DESCRIPTION
    This module defines an object type that allows SMBus
    transactions on hosts running the Linux kernel. The host kernel
    must have I2C support, I2C device interface support, and a bus
    adapter driver.
    All of these can be either built-in to the kernel, or loaded
    from modules.

    Because the I2C device interface is opened R/W, users of this
    module usually must have root permissions.

    FILE
    /usr/lib/python3/dist-packages/smbus.cpython-39-arm-linux-
    gnueabihf.so


    Even a list of available methods would be handy! :-)


    Presumably python3's smbus is just a wrapper so if I could find the underlying C/C++
    documentation it might help.

    https://pypi.org/project/smbus2/

    smbus2 is designed to be a "drop-in replacement of smbus". SO you can look
    at its documentation for or use it instead of smbus.

    Disclaimer: I haven't any experience on this library

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Green@21:1/5 to kammamuri@libero.it on Sun Oct 29 13:46:19 2023
    km <kammamuri@libero.it> wrote:
    Il Sat, 28 Oct 2023 17:08:00 +0100, Chris Green ha scritto:

    I am using the python3 smbus module, but it's hard work because of the
    lack of documentation. Web searches confirm that the documentation is somewhat thin!

    If you do the obvious this is what you get:-

    >>> import smbus dir (smbus)
    ['SMBus', '__doc__', '__file__', '__loader__', '__name__',
    '__package__', '__spec__']
    >>> help(smbus)


    Help on module SMBus:

    NAME
    SMBus

    DESCRIPTION
    This module defines an object type that allows SMBus
    transactions on hosts running the Linux kernel. The host kernel
    must have I2C support, I2C device interface support, and a bus
    adapter driver.
    All of these can be either built-in to the kernel, or loaded
    from modules.

    Because the I2C device interface is opened R/W, users of this
    module usually must have root permissions.

    FILE
    /usr/lib/python3/dist-packages/smbus.cpython-39-arm-linux-
    gnueabihf.so


    Even a list of available methods would be handy! :-)


    Presumably python3's smbus is just a wrapper so if I could find the underlying C/C++
    documentation it might help.

    https://pypi.org/project/smbus2/

    smbus2 is designed to be a "drop-in replacement of smbus". SO you can look
    at its documentation for or use it instead of smbus.

    Disclaimer: I haven't any experience on this library

    Ah, thank you, I had come across smbus2 but wanted to stay with smbus
    if I could as it's in the Debian repositories. However, as you say,
    it claims to be a "drop-in replacement of smbus" so the documentation
    should be some help at least.

    --
    Chris Green
    ·

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dieter Maurer@21:1/5 to Chris Green on Mon Oct 30 17:55:33 2023
    Chris Green wrote at 2023-10-28 17:08 +0100:
    I am using the python3 smbus module, but it's hard work because of the
    lack of documentation. Web searches confirm that the documentation is >somewhat thin!

    If you do the obvious this is what you get:-

    >>> import smbus
    >>> dir (smbus)
    ['SMBus', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']
    >>> help(smbus)
    ...

    What does `help(smbus.SMBus`) tell you?

    Almost surely, `SMBus` is a class providing the main access methods.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)