Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lacop/pyaoa
Python Android Open Accessory library
https://github.com/lacop/pyaoa
Last synced: about 1 month ago
JSON representation
Python Android Open Accessory library
- Host: GitHub
- URL: https://github.com/lacop/pyaoa
- Owner: lacop
- Created: 2013-02-03T15:36:38.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-02-03T16:49:20.000Z (almost 12 years ago)
- Last Synced: 2023-03-10T23:08:22.952Z (almost 2 years ago)
- Language: Python
- Size: 105 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PyAOA
=====Very simple [Android Open Accessory 1.0](http://source.android.com/tech/accessories/aoap/aoa.html) library. Finds a device, toggles accessory mode and provides `read` and `write` functions.
This was written in a few minutes as a proof-of-concept so the code is terrible, sorry about that. Pull requests are welcome :)
Usage
-----First you need to get an Android device handle. Find them by providing a list of (vendor ID, product ID) tuples (you can find them using `lsusb`):
```python
dev = find_device([0x04e8, 0x6860)])
```Next attempt to switch this device to accessory mode. You need to provide various info like manufacturer and model:
```python
toggle_accessory_mode(dev, "Manufacturer", "Model", "Description", "1.0", "http://example.com", "SN-123-456-789")
```This will cause the device to reconnect under a new USB id, you can find it again using `find_accessory()`:
```python
dev = find_accessory()
```And that's it. Now you can read/write from the device:
```python
data = read(dev, 1024)
write(dev, data)
```Dependencies
------------Requires [pyUSB](http://pypi.python.org/pypi/pyusb) package.