views:

26

answers:

1

I have a Panatone Huey, a monitor calibration probe (device you attach to the monitor, and it gives you colour readings) - I want to get readings from the device in Python.

Having never written such a device driver before, I'm not sure where to start.

I've found are two open-source C/C++ projects that interface with the Heuy - ArgyllCMS and mcalib.

ArgyllCMS comes with a spotread command which returns readings from the device, although it only functions as an interactive command line tool, so running it via subprocess will not (easily) work.

The code ArgyllCMS uses to communicate with the device is in spectro/huey.c

Not tried it (only just found it while writing this question), but mcalib contains much less code, mainly just heuy.cpp - however it has a worrying number of FIXME comments and incomplete methods, and the code appears to have been automatically generated (unhelpful variable names)

There seems to be three options:

  • Modify spotread to work without any interactive prompts, call it via subprocess
  • Create a C-based Python module around huey.c or huey.cpp
  • Re-implement the interface using something like PyUSB

Being much more familiar with Python, I'm tempted to use PyUSB, but will this be substantially more work than wrapping existing code with the Python C API? Is there anything obvious in either of the C implementations that will not be easily doable in PyUSB?

+1  A: 

Given the existence of spotread the easiest (though perhaps not the best) way to proceed would be to use pexpect. It allows you to interact with other command-line programs.

unutbu