I've got a compound USB + CDC device I built using a PIC32 microcontroller, and I'm trying to connect to the device and send some data to the CDC data interface endpoint from my Mac.
I know the circuit works 100%, as the device registers as both a HID joystick, and I'm able to connect to the device using Zoc terminal, on /dev/tty.usbmodemfa132. I can send commands with Zoc, and see my MCU responding to these commands by blinking some LEDs on the circuit.
I'm running this on Mac OS X Mavericks, but had the same problem with a similar example I gave up on, a few weeks ago on Mountain Lion.
My code looks like follows:
// Includes ----------------------------------------------------------------------------------------------------------- #include #include #include #include #include // Defines ------------------------------------------------------------------------------------------------------------ #define VID 0x04d8 #define PID 0x005e #define CDC_DATA_INTERFACE_ID 2 // Function Declarations ---------------------------------------------------------------------------------------------- void print_device(libusb_device *device); void send(libusb_context *usb_context, uint16_t vid, uint16_t pid); // Function Definitions ----------------------------------------------------------------------------------------------- /** * main */ int main(int argc, char **argv) { libusb_device **usb_devices = NULL; libusb_context *usb_context = NULL; ssize_t device_count = 0; bool debug_enabled = false; int c; // Collect command line attributes while ( (c = getopt(argc, argv, "d")) != -1) { switch (c) { case 'd': debug_enabled = true; break; } } // Initialize USB context int result = libusb_init(&usb_context); if(result I'm getting the following error output:
libusb: 0.828223 error [darwin_open] USBDeviceOpen: another process has device opened for exclusive access libusb: 0.828241 info [darwin_open] device open for access Device successfully opened Kernel driver doesn't appear to be active libusb: 0.828641 error [darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access Unable to claim interface! libusb: 0.828766 info [event_thread_main] thread exiting Is there a way I can release the USB device from the other process, freeing it up so I can claim it?
Is there an alternative way I can connect to /dev/tty.usbmodemfa132 to send and receive data to the CDC interface on the USB device?
An alternative to libusb perhaps?