Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Questions inspired from USBPrivateDataSample



http://developer.apple.com/samplecode/USBPrivateDataSample/listing1.html
My application is for getting USB hid device connection notifications,
and will be dealing with more than one device connected to the
computer.

1.
On my second iteration in my DeviceAdded, I'm getting an access error
on IOCreatePlugInInterfaceForService.

Of course this is only happening in my app, not when I run
USBPrivateDataSample. My current recourse is to start backing out my
code, but would appreciate any insight from teh list.

Here's the stack on EXC_BAD_ACCESS:
#0	0x90003008 in strlen
#1	0x9012bb8c in _simple_vdprintf
#2	0x9012c404 in _simple_dprintf
#3	0x90126b50 in malloc_printf
#4	0x90110340 in szone_error
#5	0x90003b88 in szone_malloc
#6	0x9000374c in malloc_zone_malloc
#7	0x9073baa8 in CFAllocatorAllocate
#8	0x9073b89c in _CFRuntimeCreateInstance
#9	0x9073b574 in __CFStringCreateImmutableFunnel3
#10	0x9073d9d4 in CFStringCreateWithCString
#11	0x90a6a6ac in buildString
#12	0x90a6b5a4 in IOCFUnserializeparse
#13	0x90a6b864 in IOCFUnserialize
#14	0x90a6d060 in IORegistryEntryCreateCFProperties
#15	0x03e41018 in IOUSBDeviceClass::start
#16	0x90a6e378 in IOCreatePlugInInterfaceForService

This is on the second time around. The first time around I ..
(*aPlugInInterface)->Release(aPlugInInterface);
aPlugInInterface = NULL; // this didn't change a thing, nor in the example
.. GetDeviceProduct, Vendor
.. IORegistryEntryCreateCFProperties to get serial number, with
CFRelease on data
IOObjectRelease( aUSBDevice ); // iterator returned device

2.
Cleanup questions:

In DeviceAdded::
        // Now done with the plugin interface.
        (*plugInInterface)->Release(plugInInterface);

Is this enough? Is this preferred over IODestroyPlugInInterface ?
// I imagine so, as that's in the example

3. How do you create a wildcard matching dictionary?
I've got a vendor ID and two product ID's. I'd like to wildcard on vendor ID.


4. I'd appreciate clarification on my understanding regarding the
initial arming the notifications. Is this more specifically "arm
disconnect notification for previously connected devices"?
The default case is to call DeviceAdded in the setup, and within
DeviceAdded the device iteration it will arm a disconnect
notification.   At this point I should expect that all Adds will get a
callback (due to main setup IOServiceAddMathing call), but this call
is to arm all existing devices with a Disconnect match, correct?

Thanks,

Dean
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.