{"id":18733584,"url":"https://github.com/pklaus/universal_usbtmc","last_synced_at":"2025-04-12T18:31:51.714Z","repository":{"id":62586440,"uuid":"31009296","full_name":"pklaus/universal_usbtmc","owner":"pklaus","description":"Universal Python Interface For Different USBTMC Backends.","archived":false,"fork":false,"pushed_at":"2022-11-29T19:13:56.000Z","size":41,"stargazers_count":7,"open_issues_count":5,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T13:03:09.357Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://universal-usbtmc.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pklaus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-19T09:54:08.000Z","updated_at":"2024-04-25T21:07:16.000Z","dependencies_parsed_at":"2023-01-23T00:15:10.299Z","dependency_job_id":null,"html_url":"https://github.com/pklaus/universal_usbtmc","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pklaus%2Funiversal_usbtmc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pklaus%2Funiversal_usbtmc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pklaus%2Funiversal_usbtmc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pklaus%2Funiversal_usbtmc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pklaus","download_url":"https://codeload.github.com/pklaus/universal_usbtmc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248613555,"owners_count":21133533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T15:10:32.636Z","updated_at":"2025-04-12T18:31:51.452Z","avatar_url":"https://github.com/pklaus.png","language":"Python","readme":"\n### A Universal USBTMC Package for Python\n\n`universal_usbtmc` is an effort to fix the clutter\nof USBTMC implementations for Python.\n\nThis project provides a unified interface to the different ways/\nimplementations (\"backends\") to talk to USBTMC devices (\"instruments\").\nThis allows you to write very platform independent code.\n\nIt also comes with an interactive USBTMC shell.\n\nYou can use the following instrument implementations\n(\"backends\") in your software:\n\n* USBTMC via the Linux kernel module\n* USBTMC via [python-usbtmc][] (uses libusb)\n* TCP Socket via [socket][] (remote connection e.g. via [rpi-usbtmc-gateway][])\n* VXI-11 via [python-vxi11][] (an RPC-based TCP connection, not really usbtmc)\n* RS-232 via [PySerial][]\n\nAs already mentioned, you'll automatically gain a large deal\nof platform independence as any operating system will support\nat least some of those backends.\n\n### Installation\n\n    pip install universal_usbtmc\n\n### Usage\n\nThis software is mainly made to be used by other software, not humans.  \nIt comes, however, with a small command line tool called `usbtmc-shell`.\nYou can use it to test if the different backends work for you.\n(Or for trying to talk to a new device you just bought.)\nSee below in the backends sections on how to use it with different backends.\n\n### Backends\n\nTo communicate with your device, the following backends are available:\n\n* `linux_kernel`\n* `python_usbtmc`\n* `tcp_socket`\n* `python_vxi11`\n* `pyserial`\n\n### Backend Details\n\n#### `linux_kernel`\n\nUses the Linux Kernel Module *usbtmc*  \nThe source code of the kernel module can be found [here][usbtmc.c].\n\nTo use this backend, you must be using a Linux kernel\nand have the kernel module compiled and loaded.\nLook for the device `/dev/usbtmc0` to check\nyour USBTMC device is detected.\n\nYou can run the usbtmc shell to check if everything works OK:\n\n    usbtmc-shell --backend linux_kernel /dev/usbtmc0\n\n#### `python_usbtmc`\n\nUses the libusb-/PyUSB-based [python-usbtmc][].\n\nHere's how to use the usbtmc shell with it:\n\n    usbtmc-shell --backend python_usbtmc USB::0x1ab1::0x0588::INSTR\n\nTo use the backend `python_usbtmc`, you need to install the requirements [python-usbtmc][] and [PyUSB][]:\n\n    pip install python-usbtmc pyusb\n\nThe backend works on Mac OS X and Linux.\n\n#### `tcp_socket`\n\nThis backend connects to your instrument via TCP sockets.\nHow is this possible if the instrument itself doesn't have an Ethernet port?\nYou can put it on the net with [rpi-usbtmc-gateway][]!\n\nTo connect using the *tcp_socket* backend, run:\n\n    usbtmc-shell --backend tcp_socket 192.168.0.21\n    # or\n    usbtmc-shell --backend tcp_socket TCPIP::192.168.0.21::5025::SOCKET\n\nThis backend has no external dependencies and works on all operating systems.\n\n#### `python_vxi11`\n\nThis backend connects to your instrument via VXI-11.\nThis is not USBTMC in a way but the interface with SCPI commands is usually the same.\n\nUses the Python library [python-vxi11][].\n\nTo connect using the *python_vxi11* backend, run:\n\n    usbtmc-shell --backend python_vxi11 192.168.0.21\n    # or\n    usbtmc-shell --backend python_vxi11 TCPIP::192.168.0.21::INSTR\n\nTo use this backend, install python-vxi:\n\n    pip install python-vxi11\n\nThe backend should work on all operating systems.\n\n#### `pyserial`\n\nThis backend uses [PySerial][] to connect to your device via RS232.\nOn some devices, this is more stable than the USBTMC connection.\n\n    usbtmc-shell --backend pyserial ASRL::/dev/ttyUSB0,9600::INSTR\n\nOff course, you need to install [PySerial][] first! The backend works on all operating systems.\n\n### Resources\n\n* A project with a similar aim is [python-ivi](https://github.com/python-ivi/python-ivi)\n\n[usbtmc.c]: https://github.com/torvalds/linux/blob/master/drivers/usb/class/usbtmc.c\n[PySerial]: http://pyserial.sourceforge.net/\n[python-usbtmc]: https://github.com/python-ivi/python-usbtmc\n[PyUSB]: https://github.com/walac/pyusb\n[python-vxi11]: https://github.com/python-ivi/python-vxi11\n[socket]: https://docs.python.org/3/library/socket.html\n[rpi-usbtmc-gateway]: https://github.com/pklaus/rpi-usbtmc-gateway\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpklaus%2Funiversal_usbtmc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpklaus%2Funiversal_usbtmc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpklaus%2Funiversal_usbtmc/lists"}