title: CDC Driver on MAC OS X - Device always busy
body: <p>I am writing an application to control a Modem via USB Virtual COM port on Win7, WinXP, MAC OS X and Linux (command line) and I use as USB to serial converter (aka Virtual COM Port) a Freescale Kinetis K40 MCU. The firmware inside is using the CDC Class 02 declaration.</p>
  
  <p>I can successfully run the Virtual COM port using the CDC Class on Win7 64Bit PC. There are some little communication problems related to buffers but I it's basically working. I connected the TX and the RX to an internal UART of the MCU and all works.</p>
  
  <p>The problem raises when I try to use the Virtual COM port on MAC OS X. The device is recognized as "tty.usbmodemxxx" when I try to send/receive any byte it the ZTerm (used for testing purposes) returns me that the USB Port is busy/not available. I used my own tool and the FileDescriptor returns always -1 so it is not possible to access to it. </p>
  
  <p>Then I tried to access to the device from the terminal using the "cat /dev/tty.usbmodemxxx" and also the "screen /dev/tty.usbmodemxxx" both are returning me Resource Busy.</p>
  
  <p>If I use a FTDI USB to Serial Converter it all works fine ZTerm and my own application.</p>
  
  <p>Again the tty.usbmodem device is recognized but the PORT is always busy/not available while the same code ran in stand alone on my proto board is working on Win7.</p>
  
  <p>I have digged a bit more googling on the net and many user have problems with CDC Drivers on MAC OS X but the majoriry of them are claiming that their device is not connecting while mine is "Resource Busy"!</p>
  
  <p>I tried to use the USB Prober from MACOSX logging at level 7 but there are tons of alerts in a sec so it becomes a bit hard to distinguish mines even if I am filtering.</p>
  
  <p>Descriptors seems corret as 2 Devices are created CDC and CDC data but the device is permanently busy and every 2/3 secs there is a handleOpen from the OS that appearls to me like a polling on my device and I have the same behavior also with FTDI Chip so it cannot be it.</p>
  
  <p><strong>My suspect is that maybe the firmware inside the MCU is returning a Busy state to the OS but this seems not to be the case because on Win7 with CDC drivers all is working fine.</strong></p>
  
  <p>Anybody knows eventually how to understand why the device is busy, like is my device returning a false state or maybe the is a deamon took control of my device not releasing it!?**</p>
  
  <p>Any help will be so appreciated!</p>
  
  <p>Regards.</p>