# Python wrapper for NXP libusbsio binary library
The [NXP libusbsio](https://www.nxp.com/design/software/development-software/library-for-windows-macos-and-ubuntu-linux:LIBUSBSIO)
is a binary library for Win/Linux/MacOS systems used to exercise SPI, I2C bus and GPIO pins over USBSIO interface of NXP
[LPCLink2](https://www.nxp.com/design/microcontrollers-developer-resources/lpc-microcontroller-utilities/lpc-link2:OM13054)
and [MCUlink Pro](https://www.nxp.com/design/microcontrollers-developer-resources/mcu-link-pro-debug-probe:MCU-LINK-PRO)
devices.
This Python component provides a wrapper object which encapsulates the binary library
and exposes its API to Python applications.
Author: michal.hanak@nxp.com (https://www.nxp.com)
## Dependencies
There are no dependencies to any external modules needed to use the LIBUSBSIO
module.
The binary libraries use the [HID_API](https://github.com/signal11/hidapi) library code and partially also its
new [libusb/hidapi](https://github.com/libusb/hidapi) version to access
the USB HID interface on all supported OS platforms.
## Installation
### pypi.org
Use pip to download and install the package
```
python -m pip install libusbsio
```
### Local
Use the following `pip` command to install the libusbsio module from
the local NXP LIBUSBSIO installation package available at www.nxp.com:
```
python -m pip install dist/libusbsio-2.1.13-py3-none-any.whl
```
## Running example code
Running the example code is easy. You do not even need to install the package,
the example code will locate the module in the local directory (in ../libusbsio).
Go to `examples` directory and see the demo scripts there.
Examine the script and the way how it creates the `LIBUSBSIO` object.
Without any constructor parameters, the USBSIO library is automatically
located. There are also options to load the library from a given path.
```
from libusbsio import *
sio = LIBUSBSIO()
```
Use the `loglevel` parameter to specify logging verbosity:
```
import logging
from libusbsio import *
logging.basicConfig()
sio = LIBUSBSIO(loglevel=logging.INFO)
```
## Running test code
The test code is located in the `test` directory and it is ready to be used with the
`unittest` or `pytest`. *Note that most of the tests assume that the target MCU application
runs the `siotest1` application test code which answers on SPI and I2C buses using a simple
command/response protocol.* The source code of the `siotest` application for
different target boards is available as an optional part of the NXP MCUXpresso SDK package.
Run one of the following commands in the base 'python' directory. Note that some long
duration tests and known-issues tests are skipped by default.
See more in `test/test_base.py` main test file.
```
python -m unittest
.............s.......s...s...sssss.........s.
----------------------------------------------------------------------
Ran 45 tests in 11.034s
OK (skipped=9)
```
or:
```
pyttest
===================================== test session starts ======================================
platform win32 -- Python 3.8.7, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
rootdir: d:\gitwork\libusbsio\python
collected 45 items
test\test_00_lib.py .......... [ 22%]
test\test_10_spi.py ...s.... [ 40%]
test\test_20_i2c.py ...s...s...s...ssss [ 82%]
test\test_30_gpio.py ......s. [100%]
================================ 36 passed, 9 skipped in 11.38s ================================
```
## History
### v2.1.13 - October 2024
- Fix HID_API Windows enumeration to avoid accidental duplicate device enumeration.
### v2.1.12 - January 2023
- Fix HID_API Windows to enable both debugger interface and USBSIO device to be open simultaneously.
### v2.1.11 - February 2022
- Source code of the library made available under BSD-3-Clause license.
- macOS now use the libusb/hidapi version to use a new format of HID device path.
### v2.1.10 - February 2022
- Add GetDeviceInfo method to retrieve hid_api low-level information of the SIO port
### v2.1.8 - November 2021
- Add binaries for linux_armv7l and linux_aarch64
### v2.1.5 - August 2021
- Add binaries and support for arm64 macOS
### v2.1.4 - July 2021
- Extend by low-level HID_API access, fix read buffer length when reading data.
- Refactor "PIDVID" variables, arguments and tuples to a correctly ordered "VIDPID"
- Fix example code.
### v2.1.0 - April 2021
- The initial Python libusbsio library wrapper release supporting USBSIO library v2.1
____
Copyright NXP 2021-2024
Raw data
{
"_id": null,
"home_page": null,
"name": "libusbsio",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "LIBUSBSIO, USBSIO, SPI, I2C, GPIO",
"author": "Michal Hanak",
"author_email": "michal.hanak@nxp.com",
"download_url": "https://files.pythonhosted.org/packages/8d/e6/145ec627bd29b969750541f65c0d95f9eafe23daa91353f795892526f456/libusbsio-2.1.13.tar.gz",
"platform": "Windows",
"description": "# Python wrapper for NXP libusbsio binary library\r\n\r\nThe [NXP libusbsio](https://www.nxp.com/design/software/development-software/library-for-windows-macos-and-ubuntu-linux:LIBUSBSIO) \r\nis a binary library for Win/Linux/MacOS systems used to exercise SPI, I2C bus and GPIO pins over USBSIO interface of NXP\r\n[LPCLink2](https://www.nxp.com/design/microcontrollers-developer-resources/lpc-microcontroller-utilities/lpc-link2:OM13054)\r\nand [MCUlink Pro](https://www.nxp.com/design/microcontrollers-developer-resources/mcu-link-pro-debug-probe:MCU-LINK-PRO)\r\ndevices.\r\n\r\nThis Python component provides a wrapper object which encapsulates the binary library\r\nand exposes its API to Python applications.\r\n\r\nAuthor: michal.hanak@nxp.com (https://www.nxp.com)\r\n\r\n## Dependencies\r\nThere are no dependencies to any external modules needed to use the LIBUSBSIO\r\nmodule.\r\n\r\nThe binary libraries use the [HID_API](https://github.com/signal11/hidapi) library code and partially also its \r\nnew [libusb/hidapi](https://github.com/libusb/hidapi) version to access \r\nthe USB HID interface on all supported OS platforms.\r\n\r\n## Installation\r\n### pypi.org\r\nUse pip to download and install the package\r\n```\r\npython -m pip install libusbsio\r\n```\r\n### Local\r\nUse the following `pip` command to install the libusbsio module from\r\nthe local NXP LIBUSBSIO installation package available at www.nxp.com:\r\n```\r\npython -m pip install dist/libusbsio-2.1.13-py3-none-any.whl\r\n```\r\n\r\n## Running example code\r\nRunning the example code is easy. You do not even need to install the package,\r\nthe example code will locate the module in the local directory (in ../libusbsio).\r\n\r\nGo to `examples` directory and see the demo scripts there.\r\nExamine the script and the way how it creates the `LIBUSBSIO` object.\r\n\r\nWithout any constructor parameters, the USBSIO library is automatically\r\nlocated. There are also options to load the library from a given path.\r\n```\r\nfrom libusbsio import *\r\nsio = LIBUSBSIO()\r\n```\r\n\r\nUse the `loglevel` parameter to specify logging verbosity:\r\n```\r\nimport logging\r\nfrom libusbsio import *\r\n\r\nlogging.basicConfig()\r\nsio = LIBUSBSIO(loglevel=logging.INFO)\r\n```\r\n\r\n## Running test code\r\nThe test code is located in the `test` directory and it is ready to be used with the\r\n`unittest` or `pytest`. *Note that most of the tests assume that the target MCU application \r\nruns the `siotest1` application test code which answers on SPI and I2C buses using a simple\r\ncommand/response protocol.* The source code of the `siotest` application for \r\ndifferent target boards is available as an optional part of the NXP MCUXpresso SDK package.\r\n\r\nRun one of the following commands in the base 'python' directory. Note that some long\r\nduration tests and known-issues tests are skipped by default. \r\nSee more in `test/test_base.py` main test file.\r\n\r\n```\r\npython -m unittest\r\n.............s.......s...s...sssss.........s.\r\n----------------------------------------------------------------------\r\nRan 45 tests in 11.034s\r\n\r\nOK (skipped=9)\r\n```\r\n\r\nor:\r\n\r\n```\r\npyttest\r\n\r\n===================================== test session starts ======================================\r\nplatform win32 -- Python 3.8.7, pytest-6.2.3, py-1.10.0, pluggy-0.13.1\r\nrootdir: d:\\gitwork\\libusbsio\\python\r\ncollected 45 items\r\n\r\ntest\\test_00_lib.py .......... [ 22%]\r\ntest\\test_10_spi.py ...s.... [ 40%]\r\ntest\\test_20_i2c.py ...s...s...s...ssss [ 82%]\r\ntest\\test_30_gpio.py ......s. [100%]\r\n\r\n================================ 36 passed, 9 skipped in 11.38s ================================\r\n```\r\n\r\n## History\r\n### v2.1.13 - October 2024\r\n- Fix HID_API Windows enumeration to avoid accidental duplicate device enumeration.\r\n### v2.1.12 - January 2023\r\n- Fix HID_API Windows to enable both debugger interface and USBSIO device to be open simultaneously.\r\n### v2.1.11 - February 2022\r\n- Source code of the library made available under BSD-3-Clause license.\r\n- macOS now use the libusb/hidapi version to use a new format of HID device path.\r\n### v2.1.10 - February 2022\r\n- Add GetDeviceInfo method to retrieve hid_api low-level information of the SIO port\r\n### v2.1.8 - November 2021\r\n- Add binaries for linux_armv7l and linux_aarch64\r\n### v2.1.5 - August 2021\r\n- Add binaries and support for arm64 macOS\r\n### v2.1.4 - July 2021\r\n- Extend by low-level HID_API access, fix read buffer length when reading data.\r\n- Refactor \"PIDVID\" variables, arguments and tuples to a correctly ordered \"VIDPID\"\r\n- Fix example code.\r\n### v2.1.0 - April 2021\r\n- The initial Python libusbsio library wrapper release supporting USBSIO library v2.1\r\n\r\n____\r\nCopyright NXP 2021-2024\r\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Python wrapper around NXP LIBUSBSIO library",
"version": "2.1.13",
"project_urls": {
"LPCLink2": "https://www.nxp.com/design/microcontrollers-developer-resources/lpc-microcontroller-utilities/lpc-link2:OM13054",
"MCULink Pro": "https://www.nxp.com/design/microcontrollers-developer-resources/mcu-link-pro-debug-probe:MCU-LINK-PRO",
"NXP LIBUSBSIO Home": "https://www.nxp.com/design/software/development-software/library-for-windows-macos-and-ubuntu-linux:LIBUSBSIO"
},
"split_keywords": [
"libusbsio",
" usbsio",
" spi",
" i2c",
" gpio"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a423d3a420e8aa191dc4f165c3e9a7d491125a5e9e6b3ecb3db4e01c7176adf5",
"md5": "9b13ccc0e1edea36865a2176db6af685",
"sha256": "f978c55e2e688693b03faa874d17009c866591e020ece2a946c92ae5757e5c10"
},
"downloads": -1,
"filename": "libusbsio-2.1.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9b13ccc0e1edea36865a2176db6af685",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 247271,
"upload_time": "2024-10-16T10:58:18",
"upload_time_iso_8601": "2024-10-16T10:58:18.761000Z",
"url": "https://files.pythonhosted.org/packages/a4/23/d3a420e8aa191dc4f165c3e9a7d491125a5e9e6b3ecb3db4e01c7176adf5/libusbsio-2.1.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8de6145ec627bd29b969750541f65c0d95f9eafe23daa91353f795892526f456",
"md5": "78cb54da18af824f0ef12370d45d9260",
"sha256": "df1b9d4b2a9f5eadf0b0574e8017862b59d26343598f1f548664ea6d01975b25"
},
"downloads": -1,
"filename": "libusbsio-2.1.13.tar.gz",
"has_sig": false,
"md5_digest": "78cb54da18af824f0ef12370d45d9260",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 259644,
"upload_time": "2024-10-16T10:58:20",
"upload_time_iso_8601": "2024-10-16T10:58:20.756233Z",
"url": "https://files.pythonhosted.org/packages/8d/e6/145ec627bd29b969750541f65c0d95f9eafe23daa91353f795892526f456/libusbsio-2.1.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-16 10:58:20",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "libusbsio"
}