• AVR Freaks

Debug CDC device on MAC OS X ?

Author
terriea
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2010/09/06 11:22:26
  • Location: 0
  • Status: offline
2011/04/23 18:16:13 (permalink)
0

Debug CDC device on MAC OS X ?



Hi all,

I'm trying to get a simple CDC ACM device working on my MAC. But i can't get Mac OS initialize the driver completely. It is surely something from my firmware but I can't point the problem. Here is the device descriptor as displayed by USB Probe:
Full Speed device @ 7 (0xFD110000): .............................................   Communication device: "Peripheral module"
    Port Information:   0x0018
           Not Captive
           External Device
           Connected
           Enabled
    Device Descriptor
        Descriptor Version Number:   0x0200
        Device Class:   2   (Communication)
        Device Subclass:   0
        Device Protocol:   0
        Device MaxPacketSize:   8
        Device VendorID/ProductID:   0xA5A5/0x0001   (unknown vendor)
        Device Version Number:   0x0100
        Number of Configurations:   1
        Manufacturer String:   1 "Vasco Project"
        Product String:   2 "Peripheral module"
        Serial Number String:   3 "1"
    Configuration Descriptor
        Length (and contents):   67
            Raw Descriptor (hex)    0000: 09 02 43 00 02 01 00 80  32 09 04 00 00 01 02 02
            Raw Descriptor (hex)    0010: 01 00 05 24 00 10 01 05  24 01 01 01 04 24 02 02

            Raw Descriptor (hex)    0020: 05 24 06 00 01 07 05 81  03 40 00 01 09 04 01 00
            Raw Descriptor (hex)    0030: 01 0A 00 00 00 07 05 82  02 40 00 00 07 05 02 02
            Raw Descriptor (hex)    0040: 40 00 00
        Number of Interfaces:   2
        Configuration Value:   1
        Attributes:   0x80 (bus-powered)
        MaxPower:   100 ma
        Interface #0 - Communications-Control
            Alternate Setting   0
            Number of Endpoints   1
            Interface Class:   2   (Communications-Control)
            Interface Subclass;   2
            Interface Protocol:   1
            Comm Class Header Functional Descriptor
                Raw Descriptor (hex)   0000: 05 24 00 10 01
            Comm Class Call Management Functional Descriptor
                Raw Descriptor (hex)   0000: 05 24 01 01 01
            Comm Class Abstract Control Management Functional Descriptor
                Raw Descriptor (hex)   0000: 04 24 02 02
            Comm Class Union Functional Descriptor
                Raw Descriptor (hex)   0000: 05 24 06 00 01
            Endpoint 0x81 - Interrupt Input
                Address:   0x81  (IN)
                Attributes:   0x03  (Interrupt no synchronization data endpoint)
                Max Packet Size:   64
                Polling Interval:   1 ms
        Interface #1 - Communications-Data/Unknown Comm Class Model
            Alternate Setting   0
            Number of Endpoints   1
            Interface Class:   10   (Communications-Data)
            Interface Subclass;   0   (Unknown Comm Class Model)
            Interface Protocol:   0
            Endpoint 0x82 - Bulk Input
                Address:   0x82  (IN)
                Attributes:   0x02  (Bulk no synchronization data endpoint)
                Max Packet Size:   64
                Polling Interval:   0 ms
            Endpoint 0x02 - Bulk Output
                Address:   0x02  (OUT)
                Attributes:   0x02  (Bulk no synchronization data endpoint)
                Max Packet Size:   64
                Polling Interval:   0 ms



I get this error in dmesg:
AppleUSBCDCACMData: start: InterfaceMappings dictionary not found for this device. Assume CDC Device...
AppleUSBCDC::createSerialStream NON WAN CDC Device 
AppleUSBCDC::createSerialStream using default naming and suffix...
       0        0 AppleUSBCDCACMData: start - allocateResources failed



And the logs in USB Probe are silent. Event at level 7.
It really doesn't help to pin point what the device is doing wrong. I even checked at the source code of the AppleUSBCDC driver and there are a lot of things that could cause this "allocateResources failed". It would really help if there were a way to enable all the XTRACE messages I see in the source code. Does someone know how to do this ?
I'm that desesperate i'm ready to recompile it if needed to use a driver with proper debug messages. But i can't find any doc on how to do this.

I use a pic18f4550, pickit2, and Mac OS X 10.5.8 with USB Debug kit installed.
Didn't tried the device on other OS, as MAC OS is the only one a I have in hand.

If anyone can help me on this it would be greatly apreciated.
Thank you.

#1

3 Replies Related Threads

    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:Debug CDC device on MAC OS X ? 2011/04/24 07:09:46 (permalink)
    0

    Comm Class Call Management Functional Descriptor 
      Raw Descriptor (hex)   0000: 05 24 01 01 01

    Set bmCapabilities field (4th byte) to 0x03

    Re: CDC device with 2 interfaces - Apple Mailing Lists
    http://lists.apple.com/ar...2009/Jan/msg00017.html


    Did you see "A new network interface has been detected" dialog on the Mac?
    Did you push "cancel" button on the dialog?
    If you would push "Network Preferences..." button on the dialog, OS grabs the device.

    If you don't want to see this dialog any more for your device, follow to this Tech note.

    Technical Q&A QA1667
    "Suppressing the Network Configuration Dialog"
    http://developer.apple.co...#qa/qa2009/qa1667.html

    And the logs in USB Probe are silent. Event at level 7. 
    ...
    I use a pic18f4550, pickit2, and Mac OS X 10.5.8 with USB Debug kit installed.

    In the dmg of Mac OS X USB Debug kit, you'll see two install packages.
    Install this one with -log
    IOUSBFamily-349.4.3-log
    And then, USBProber.app puts debug messages to USB Logger pane.

    Tsuneo


    [Edit]
    Attached the examples of codeless KEXTs, formerly distributed by Apple Technical Q&A QA1667
    post edited by chinzei - 2015/02/05 01:54:28
    #2
    terriea
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2010/09/06 11:22:26
    • Location: 0
    • Status: offline
    Re:Debug CDC device on MAC OS X ? 2011/04/24 15:48:27 (permalink)
    0

    Thanks for the help,


    much apreciated

    chinzei
    Set bmCapabilities field (4th byte) to 0x03

    Re: CDC device with 2 interfaces - Apple Mailing Lists
    http://lists.apple.com/ar...2009/Jan/msg00017.html


    I tried this but i got the exact same behavior.


    chinzei
    Did you see "A new network interface has been detected" dialog on the Mac?
    Did you push "cancel" button on the dialog?
    If you would push "Network Preferences..." button on the dialog, OS grabs the device.



    I don't get any dialog of any kind. I get the /dev/tty.usbmodem1 device, but they don't clean-up when de device is removed, and they keep stacking (usbmodem2, 3, 4...). If I try to access the devices the CPU goes crasy and I have to restart my MAC.


    chinzei
    In the dmg of Mac OS X USB Debug kit, you'll see two install packages.
    Install this one with -log
    IOUSBFamily-349.4.3-log
    And then, USBProber.app puts debug messages to USB Logger pane.

    Tsuneo



    Thanks ! that's much better. But I still get very litte information related to AppleUSBCDC driver. Most messages are from upper USB layers.
    Plus the messages in the USB Prober Log doesn't include the ones I see in dmesg (ALTERT from driver). And none from the XTRACE from the driver sources. Is there something else to do to turn them on ?


    All messages are just status like this, no real error message:
    4.364 [5] Finding device driver for Peripheral module, matching personality using com.apple.driver.AppleUSBCDC, score: 69000, wildCard = 0

    4.955 [5] Finding driver for interface #0 of Peripheral module, matching personality using com.apple.driver.AppleUSBCDCACMControl, score: 50000, wildCard = 0

    5.165 [5] Finding driver for interface #1 of Peripheral module, matching personality using com.apple.driver.AppleUSBCDCACMData, score: 50000, wildCard = 0
    5.398 [5] Finding driver for interface #1 of Peripheral module, matching personality using com.apple.driver.AppleUSBCDCECMData, score: 50000, wildCard = 0




    #3
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:Debug CDC device on MAC OS X ? 2011/04/24 18:21:45 (permalink)
    0

    Plus the messages in the USB Prober Log doesn't include the ones I see in dmesg (ALTERT from driver). And none from the XTRACE from the driver sources. Is there something else to do to turn them on ?

    Do you see any message in /Applications/Utilities/Console.app?

    Remote debug over gdb shows the debug message on the kernel driver sources. For remote debug, you need another Mac (or Linux box) to make your Mac as the debug target. Brief explanation of gdb setting is here.

    When Things Go Wrong: Debugging the Kernel
    http://developer.apple.co...0000905-CH221-CIHBJCGC

    I'm using VMware Fusion for kernel driver debug on single Mac. Fusion officially runs MacOSX Server guest. And unofficially, non-Server SnowLeopard wink Search for "Snowy_Vmware_files.zip" on the web.

    I use a pic18f4550

    Microchip "USB - Device - CDC - xxxx" examples work on Mac.
    Compare them with your code.

    MAL (Microchip Application Library)
    http://www.microchip.com/...&dDocName=en547784


    If you'll post your code, I'll run it on a Mac with a bus analyzer.

    Tsuneo
    #4
    Jump to:
    © 2019 APG vNext Commercial Version 4.5