USB driver development on Mac using Python

I would like to write a driver to talk with my Suunto t3 watch in Python on Mac. My day job does basic work on the Internet in C #, so my introduction to Python and Mac development is limited.

Can you suggest how you can start developing drivers in general, and then more specifically on a Mac. That is, how easy it is to see what data is transferred to the device? I am running Python 2.5 (MacPorts).

+4
source share
2 answers

The Mac already has the basic infrastructure to support USB, so you'll need a Python library that can use it. For any Python project that needs consistent support, be it USB, RS-232, or GPIB, I would recommend the PyVisa library at SourceForge. See http://pyvisa.sourceforge.net/ .

If your device does not have a VISA driver, you will have to directly contact the USB system. You can use another library for SourceForge for this: http://pyusb.berlios.de/

+4
source

If the watch supports a standard USB device class specification such as HID or serial communication, the Macintosh driver may already be installed on the OS. Otherwise, you will need to get information about the supplierโ€™s teams used to contact him from one of three sources: the manufacturer; reverse engineering the protocol used by the Windows driver; or from others who have already applied, have developed a protocol to support a device on Linux or BSD.

USB is a packet bus, and it is important to understand the various types of transactions. Reading The USB specification is a good place to start.

You can see what data is transferred to the device using the USB bus analyzer, which is an expensive offer for an amateur, but it is quite accessible to most enterprises developing USB. For example, the Catalyst Conquest is $ 1,199. Another established manufacturer is LeCroy (formerly CATC) . There are also software USB analyzers that connect to the USB stack of the OS, but they do not display all the traffic on the bus and may not be as reliable.

I'm not a Mac expert, so take this paragraph with salt: Apple has a driver development kit called the I / O Kit , which apparently requires you to write your driver in C ++ if they also don't any user driver environment. If you write it in Python, most likely it will be more like the Python library, which will interact with the universal USB driver of another (Apple?).

+3
source

Source: https://habr.com/ru/post/1277470/


All Articles