Author Topic: Writing to USB device with Python using ioctl  (Read 15954 times)

erich

  • Member
  • ***
  • Posts: 2
Writing to USB device with Python using ioctl
« on: November 23, 2011, 11:45:35 am »
Using Python, I am trying to write to a USB sensor using ioctl. I have loads of examples of reading from devices either directly or via pyusb, or simple file writes, but anything more complicated disappears off the radar.

I need to use a control_transfer to write Feature Report message

The command is ioctl(devicehandle, Operation, Args) The issue I have is determining the correct Operation. The Args, I believe should be a buffer containing the Feature Report for the device? plus a Mutable flag set to true

Any help or advice would be greatly received

I should add; the reason for using Python is the code must be device independent

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Writing to USB device with Python using ioctl
« Reply #1 on: November 23, 2011, 03:48:47 pm »

erich

  • Member
  • ***
  • Posts: 2
Re: Writing to USB device with Python using ioctl
« Reply #2 on: November 23, 2011, 05:39:33 pm »
Thanks - I already did. And on Twitter and Stackoverflow ;D

I just can't get my head around the  initiation of the message.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Writing to USB device with Python using ioctl
« Reply #3 on: November 23, 2011, 06:39:22 pm »
Show the source code you have so far.

Jan