{ "info": { "author": "Adam Coddington", "author_email": "me@adamcoddington.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3" ], "description": "# Python Tools for Enrichable Saleae Analyzers\n\nThe built-in analyzers for the Saleae Logic provides you with only a few basic options for how to display the transferred bytes -- as ascii text, or in one of several numeric formats.\nWhat if you're working with an device that encodes more than just integer or text data into those bytes, or even stores multiple values in each byte that will require you to either do the math in your head, export the data for post-processing, or display the frame as binary bits so you can directly look at the parts that matter to you?\nThat's the sort of thing computers are great at doing; why don't we just let your computer do that?\n\nThis Python library -- in tandem with special \"Enrichable\" versions of Saleae Logic analyzers -- makes it easy for you to enrich the data displayed so you can provide your own text and markers to display for each frame.\nNow you can focus on solving your actual problem instead of interpreting inscrutible hex values.\n\n## Related\n\n* [saleae-enrichable-spi-analyzer](https://github.com/coddingtonbear/saleae-enrichable-spi-analyzer): A version of the Saleae SPI analyzer that supports enrichment.\n* [saleae-enrichable-i2c-analyzer](https://github.com/coddingtonbear/saleae-enrichable-i2c-analyzer): A version of the Saleae I2C analyzer that supports enrichment.\n\n## Installation\n\n*Note*: This requires Python 3.5!\n\nIf you want to use the latest release; just install directly from pypi:\n\n```\npip install saleae_enrichable_analyzer\n```\n\nTo use the development version, just clone this repository and run:\n\n```\npip install .\n```\n\n## Bundled enrichment scripts\n\nThis library is bundled with a handful of enrichment scripts out-of-the-box;\nyou can use any of these by following the instructions below.\nNote that you may need to replace `python` in the examples with the path to the relevant Python binary --\nif you installed this library into a virtual environment, that path should point to that environment's `python`, of course.\n\n### SPI\n\n#### SC16IS75xx\n\nSupports the NXP SC16IS75xx series of SPI UART chips.\n\nKnown supported:\n\n* SC16IS740\n* SC16IS750\n* SC16IS752\n* SC16IS760\n* SC16IS762\n\nUsable by using the following enrichment script:\n\n```\npython -m saleae_enrichable_analyzer.scripts.spi.SC16IS75xx\n```\n\n### I2C\n\n#### AD799x\n\nSupports the Analog Devices AD799x series of I2C ADC chips.\n\nKnown supported:\n\n* AD7991 (12 bit)\n* AD7995 (10 bit)\n* AD7999 (8 bit)\n\nUsable by using the following enrichment script; be sure to replace\n`BITS` with the number of bits your ADC provides, and `ADDRESS` with\nyour device's base-2 I2C address:\n\n```\npython -m saleae_enrichable_analyzer.scripts.i2c.AD799x ADDRESS BITS\n```\n\nAdditionally, you can provide the `--reference-voltage=VOLTAGE` argument\nto display the calculated voltage as well as the raw ADC value.\n\n#### INA219\n\nSupports the Texas Instruments INA219 current monitor IC.\n\nUsable by using the following enrichment script; be sure to replace\n`ADDRESS` with your device's base-2 I2C address:\n\n```\npython -m saleae_enrichable_analyzer.scripts.i2c.INA219 ADDRESS\n```\n\n## Writing your own Enrichment Script\n\nUsing this is as simple as creating your own module somewhere that subclasses `saleae_enrichable_analyzer.EnrichableAnalyzer` with methods for the features you'd like to use;\nhere is a basic example:\n\n```python\nimport sys\nfrom typing import List, Optional\n\nfrom saleae_enrichable_analyzer import (\n Channel, EnrichableAnalyzer, Marker, MarkerType\n)\n\n\nclass MySimpleAnalyzer(EnrichableAnalyzer):\n def handle_bubble(\n self,\n packet_id: Optional[int],\n frame_index: int,\n start_sample: int,\n end_sample: int,\n frame_type: int,\n flags: int,\n direction: Channel,\n value: int\n ) -> List[str]:\n return [\n \"This message will be displayed above every frame in the blue bubble\"\n ]\n\n def handle_marker(\n self,\n packet_id: Optional[int],\n frame_index: int,\n sample_count: int,\n start_sample: int,\n end_sample: int,\n frame_type: int,\n flags: int,\n mosi_value: int,\n miso_value: int\n ) -> List[Marker]:\n markers = []\n\n if(miso_value == 0xff) {\n # This will show a \"Stop\" marker on the zeroth sample\n # of the frame on the MISO channel when its value is 0xff.\n markers.append(\n Marker(0, Channel.MISO, MarkerType.Stop)\n )\n }\n\n return markers\n\nif __name__ == '__main__':\n MySimpleAnalyzer.run(sys.argv[1:])\n```\n\nThe methods described below can be implemented for interacting with Saleae Logic.\n\nIf you'd like to see simple concrete examples,\nyou can refer to the following:\n\n* [simple_SC16IS7xx.py](\nhttps://github.com/coddingtonbear/saleae-enrichable-spi-analyzer/blob/master/examples/simple_SC16IS7xx.py): Implements a simple enricher for displaying register, channel, and data for the SC16IS7xx series of SPI UARTs.\n* [simple_ad7995.py](https://github.com/coddingtonbear/saleae-enrichable-i2c-analyzer/blob/master/examples/simple_ad7995.py): Implements a slightly-more completed enricher for displaying detailed configuration and read data for the AD7995 I2C ADC.\n\nAlso be aware that the `scripts` directory contains examples, too,\nbut they may be somewhat more advanced in functionality.\n\n### `handle_bubble`\n\n```python\n def handle_bubble(\n self,\n packet_id: Optional[int],\n frame_index: int,\n start_sample: int,\n end_sample: int,\n frame_type: int,\n flags: int,\n direction: Channel,\n value: int\n ) -> List[str]:\n return []\n```\n\nSet the bubble text (the text shown in blue abov the frame) for this frame.\nBy default, no bubble is shown. It is recommended that you return multiple\nstrings of varying lengths.\n\n### `handle_marker`\n\n```python\n def handle_marker(\n self,\n packet_id: Optional[int],\n frame_index: int,\n sample_count: int,\n start_sample: int,\n end_sample: int,\n frame_type: int,\n flags: int,\n value1: int, # SPI: MOSI; I2C: SDA\n value2: int, # SPI: MISO; I2C: Undefined\n ) -> List[Marker]:\n return []\n```\n\nReturn markers to display at given sample points.\nBy default, no markers are displayed.\n\nThis method can be implemented for reasons other than wanting to display\nmarkers, too --\nit is useful if your script needs to receive all frames of data in the order they were received.\nIn such cases, you can record your packets in the body of the method,\nand return an empty list.\nSee the [base I2CAnalyzer class](https://github.com/coddingtonbear/python-saleae-enrichable-analyzer/blob/f617c9fb22c68f06a863dd0197c57e17f085a789/saleae_enrichable_analyzer/scripts/i2c/base.py#L66) for a concrete example of that strategy in use.\n\n### `handle_tabular`\n\n```python\n def handle_tabular(\n self,\n packet_id: Optional[int],\n frame_index: int,\n start_sample: int,\n end_sample: int,\n frame_type: int,\n flags: int,\n value1: int, # SPI: MOSI; I2C: SDA\n value2: int, # SPI: MISO; I2C: Undefined\n ) -> List[str]:\n return []\n```\n\nData to display in the tabular \"Decoded Protocols\" section.\nDue to limitations within Saleae logic: if implemented, this method must return exactly the same number of strings in the result array for each request;\nif you attempt to do otherwise, you may see the following error (sic) \"Error: Number of strings in the analyzer results are diffrenet for different display bases\" followed by a SIGSEGV.\n\n## Debugging your enrichment script\n\nIf Saleae Logic crashes when using your enrichment script,\nit's almost certainly the fault of your script and not Saleae Logic.\nLuckily, debugging is quite easy by using the built-in logging features.\n\nBy default, logging is written to stderr,\nbut given that most of us do not run Saleae Logic in a terminal, that output isn't immediately visible.\nTo see that logging output without running in a terminal,\nyou can use the following two flags:\n\n* `--loglevel=LEVEL`: Set the level of reported output.\n When debugging, you likely want to use `--loglevel=DEBUG`.\n Valid options (in order of increasing verbosity) include\n `CRITICAL`, `ERROR`, `WARNING`, `INFO`, and `DEBUG`.\n The output displayed for a selected level includes the output of all\n lower-verbosity levels.\n* `--logpath=PATH`: Set a file path to write your logging output to.\n\nNote that these flags must follow the module name when using a bundled enrichment script.\nFor example, to debug the bundled AD799x enrichment script (which itself requires two positional arguments),\nyou can set the following for your \"Enrichment Script\" in Saleae Logic:\n\n```\npython -m saleae_enrichable_analyzer.scripts.i2c.AD799x --loglevel=DEBUG --logpath=/tmp/logic_debug.log 12 0101000\n```\n\nIf you're debugging a script you've written, though,\nsimply provide the flags following your script path:\n\n```\npython /path/to/your/enrichment/script.py --loglevel=DEBUG --logpath=/tmp/logic_debug.log\n```\n\nLogging messages will continue to be written to stderr regardless of whether you've enabled logging to a file,\nand if you find that the logging output written by your script is not revealing,\nit may be helpful to run Saleae Logic in a terminal to see both the logging output of Saleae Logic and your script interleaved.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/coddingtonbear/python-saleae-enrichable-analyzer", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "saleae-enrichable-analyzer", "package_url": "https://pypi.org/project/saleae-enrichable-analyzer/", "platform": "", "project_url": "https://pypi.org/project/saleae-enrichable-analyzer/", "project_urls": { "Homepage": "https://github.com/coddingtonbear/python-saleae-enrichable-analyzer" }, "release_url": "https://pypi.org/project/saleae-enrichable-analyzer/1.2.0/", "requires_dist": null, "requires_python": "", "summary": "Easily generate custom markers and bubble text for arbitrary protocols", "version": "1.2.0" }, "last_serial": 4692607, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "0ec2737a9aa4c91a0e5a75224033bb23", "sha256": "6c341a0840f0a84a686bcf950d40c624eb18d42dc2a61e1bc68307bbfa56e3d0" }, "downloads": -1, "filename": "saleae_enrichable_analyzer-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0ec2737a9aa4c91a0e5a75224033bb23", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5147, "upload_time": "2018-12-28T22:42:09", "url": "https://files.pythonhosted.org/packages/5c/de/ae2e6234658ee2445045fe9ca3a9efe9dba22c8f1bdaada3342f338c0fcd/saleae_enrichable_analyzer-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f4e3f8bbbb21e7c35d046f2f9742dd70", "sha256": "be9b6912ad6d545903b0b6c3bb6f0ba2c94fcf9f5ee7f6fcb3e1e46a44b448f8" }, "downloads": -1, "filename": "saleae_enrichable_analyzer-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f4e3f8bbbb21e7c35d046f2f9742dd70", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5017, "upload_time": "2018-12-26T01:17:07", "url": "https://files.pythonhosted.org/packages/d7/5d/e54dad4514f2888c0b125e240092562670a6a6f0b7e8ae5f5a4086bb7004/saleae_enrichable_analyzer-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d0246eec6fcf787292e9f0eab2dec73e", "sha256": "250e3894d675444bf1e2d5f04bf38a181f518a7a957389cb1c95b12d41b770b2" }, "downloads": -1, "filename": "saleae_enrichable_analyzer-1.0.tar.gz", "has_sig": false, "md5_digest": "d0246eec6fcf787292e9f0eab2dec73e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4457, "upload_time": "2018-12-26T01:17:09", "url": "https://files.pythonhosted.org/packages/6e/fe/4718a4ba56130ac869e8954c352e4875c02ba6771d41350c1ffedc6e72f7/saleae_enrichable_analyzer-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "439c28fbd0d2da8cfa3d99dcbf35ebb7", "sha256": "3f18f3e5843f4b9ad480491a547316acafe3619564598b20b227459030bc81ba" }, "downloads": -1, "filename": "saleae_enrichable_analyzer-1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "439c28fbd0d2da8cfa3d99dcbf35ebb7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12332, "upload_time": "2018-12-30T01:12:14", "url": "https://files.pythonhosted.org/packages/e8/92/39affb6cb05c0b1a7e2b07e7bcfdaacd68407102007a584fd80b2729183f/saleae_enrichable_analyzer-1.1-py2.py3-none-any.whl" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "43d5c4f0d4b796be48173b4a944552bf", "sha256": "682129f566fbca2ac0fe2998f09ed28271139a239e04a2168c89b8846f450512" }, "downloads": -1, "filename": "saleae_enrichable_analyzer-1.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "43d5c4f0d4b796be48173b4a944552bf", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12490, "upload_time": "2018-12-30T01:37:33", "url": "https://files.pythonhosted.org/packages/c4/f4/804248da46e6cc66bb201bb10015a934f0c1e2b49b574ce286db33912e67/saleae_enrichable_analyzer-1.1.1-py2.py3-none-any.whl" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "271420a23190fa5602f4f4fc1ea2ba39", "sha256": "c49cdd153c664a4d3ed2260349917e4c9c25e118bea02c30b67aa678596d5500" }, "downloads": -1, "filename": "saleae_enrichable_analyzer-1.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "271420a23190fa5602f4f4fc1ea2ba39", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14032, "upload_time": "2019-01-14T03:50:17", "url": "https://files.pythonhosted.org/packages/f3/52/5bfdc16669545f08a4b008c46ac565f9a310cf8c7b2721b1bbe7f4442910/saleae_enrichable_analyzer-1.2.0-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "271420a23190fa5602f4f4fc1ea2ba39", "sha256": "c49cdd153c664a4d3ed2260349917e4c9c25e118bea02c30b67aa678596d5500" }, "downloads": -1, "filename": "saleae_enrichable_analyzer-1.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "271420a23190fa5602f4f4fc1ea2ba39", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14032, "upload_time": "2019-01-14T03:50:17", "url": "https://files.pythonhosted.org/packages/f3/52/5bfdc16669545f08a4b008c46ac565f9a310cf8c7b2721b1bbe7f4442910/saleae_enrichable_analyzer-1.2.0-py2.py3-none-any.whl" } ] }