Is there a simple cross platform HID module for python? - python

I'm trying to write some code that will fetch receive data from usb HID devices like scales. I've used pywinusb for windows but I need it to be cross platform. pyhid says it's just for Mac OS X. The only cross-platform module I've found so far is libhid which is written in C but still python accessible. However, I haven't found any helpful internet sources on how to use it in python.
All I need to do is read the weight from usb scales.
Are there any other cross-platform python HID modules>?

Have you tried cython-hidapi? It is a cython wrapper around the excellent hidapi C library.
The PyPi page report that it works on POSIX, Mac OS X, and Windows operating systems.

Related

Is it possible to use socketCAN protocol on MacOS

I am looking to connect to a car wirelessly using socketCAN protocol on MacOS using the module python-can on python3. I don't know how to install the socketCAN protocol on MacOS. Pls help.
This cat managed to get it basically working:
socketcanx
I have compiled it on my hackintosh (running Mojave) and it works from the terminal. I have not played around with it more than that, as it was just easier to use Liunx in a VM or docker or one of my Linux machines. When compiled, I was able to use all of my makeshift CAN devices and a USB2CAN device without issue. I am sure with some work, it can be used with Python-CAN, though you would need to write your own interface module for Python-CAN. As far as I can tell, it should work more or less the same, though the code is old (4 years since last update).
As stated in the accepted answer, you can use a native CAN device that is compatible with macOS and as long as it's compatible with Python-CAN, then you are good to go (or if it works on mac and not compatible, you can create and interface for the device and submit a pull-request on github for Python-CAN).
SocketCAN is implemented only for the Linux kernel. So it is not available on other operating systems. But as long as your CAN adapter is supported by python-can, you don't need SocketCAN.

Using PyParallel in Windows XP

I have successfully implemented the PyParallel module in both Linux and Mac OSX as part of a large application to interface with a sensor I am developing.... I am now attempting to use this application on an instance of Windows XP. I have found several references (including right from the PySerial/PyParallel group) that:
The windows version needs a compiled extension and the giveio.sys driver for Windows NT/2k/XP. It uses ctypes to access functions in a prebuilt DLL.
However, I don't know what "a compiled extension" requirement is. And, I can't seem to get givio.sys to work. I obtained giveio.sys here and followed the recommendations, but LoadDrv.exe fails to "start" the service (it does "install", however).
I cannot find specific examples online of getting PyParallel working on Windows XP. Since PyParallel is "thoroughly" integrated into the application and is working on both Linux and Mac OSX, I'd prefer not to use a different module -- especially since PyParallel is great to not require root/administrator privileges to utilize.
I was having trouble with giveio.sys and LoadDrv.exe as well.
There is a handy installer that does it all automatically:
http://sourceforge.net/projects/pyserial/files/pyparallel/giveio/

How to control Enttec Open DMX USB via Python?

I'm wondering is that possible to control lights connected to Enttec Open DMX USB via Python shell. If it is, how to?
The Open Lighting Project (formerly known as opendmx) provides a Python API, as part of their Open Lighting Architecture (OLA), for use the OpenDMX USB on OSX and Linux. If you're on Windows then I've not found anything apart from the code from Enttec's website which uses the FTD2XX.DLL libraries.
However it should be noted that one cannot use normal serial based libraries (pyserial etc). Basically OLA either needs to use a special kernel module on Linux, or use the generic FTDI non-serial kernel driver in combination with libftdi on Mac or Linux - for details see their device specific page. There is now pre-built support for Raspberry Pi's on the OLA website.
The communication and protocols used are completely different from Enttec Pro range (which one can just control using simple serial commands with something like pyserial, though OLA also talks to them too).
I know this is quite an old post, however DmxPy has worked very well for me the last few months. It only works for Python 2 but I know there's some Python 3 ports out there.
It's stupid simple to use. I personally use it in my companies quality control software. While it only work for DMX (not RDM) I think it's much easier to use than OLA's Python Wrapper. It works flawlessly with our ENTTEC as well!
UPDATE: Here's my Python 3 port: https://github.com/trevordavies095/DmxPy
I had the exact same problem, so I wrote a simple python programm for all those that are running windows; have a look: https://github.com/Coronon/PyOpenDmxUsb
It uses a C# Server (Because their C# interface was the only one that worked for me) and a Python Client and is super easy to use.
It is compatible with the non pro version too. (The Pro Version is way easier to use and I would use the AcceptedAnswer instead [But the normal one isnt supported])
Edit: This may be 'advertisement' but my project is Open-Source and super easy to use, so I believe this can be useful to others :)

Speech recognition library for OSX?

So I've been looking around the web for a Python Speech recognition, and I found pyspeech. But that is only for Windows. I would like a Speech Recognition Library that works with Mac aswel. Thanks!
http://andrewbrobinson.com/2012/02/29/speech-recognition-using-sphinx-dont-try-this-at-home/ suggests that Pocket Sphinx includes Python bindings and is easy to use.
Another helpful resource may be the video at http://www.youtube.com/watch?v=3VA2Th121zQ
Also, from http://cmusphinx.sourceforge.net/sphinx4/
Sphinx-4 has been built and tested on the Solaris TM Operating
Environment, Mac OS X, Linux and Win32 operating systems. Running,
building, and testing Sphinx-4 requires additional software. Before
you start, you will need the following software available on your
machine.
Mozilla has open sourced their project DeepSpeech, a tensorflow implementation of Baidu's DeepSpeech architecture:
https://blog.mozilla.org/blog/2017/11/29/announcing-the-initial-release-of-mozillas-open-source-speech-recognition-model-and-voice-dataset/
https://github.com/mozilla/DeepSpeech
Here is a comparison table with a lot of libraries you may want to consider. (Written by Alberto Pettarin)
https://github.com/pettarin/forced-alignment-tools

is there an API for python to work with pressure-sensitive pen-tablets? (Mac OS, Linux)

I want to write a cross-platform wxPython app, and I'm wondering if there a single API to work with pen-tablets on different platforms? I'm only interested to get pressure value and ereaser flag - but I couldn't fined anything cross-platform for python.
UPD. so far, I found only windows-specific solution, what are the options for Mac OS and Linux?
https://bitbucket.org/AnomalousUnderdog/pythonmactabletlib
A small Python library to allow Python scripts to access pen tablet
input data in Mac OS X.
The library exists as plain C code compiled as a dynamic
library/shared object. It interfaces with the Mac OS X's API to get
data on pen tablet input.
Then, Python scripts can use ctypes to get the data.
Send me a message if you have any problems with it.
If your target tablets are HIDs, which they probably are, you can use python-hid.

Categories