Mailing Lists: Apple Mailing Lists

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

help, trying to use IOConnectSetCFProperty (and failing)



oops, hit the wrong key there...

something like this:

OSDictionary * dict = OSDynamicCast(OSDictionary, properties);
if (dict)
{
// process contents thereof
}
else
{
// something went wrong, we got a bag of properties but
// it wasn't a dictionary.
}

> Paul,
> from the user-space side, I build a CFDictionary and send it using
> IORegistryEntrySetCFProperties. I've never used, or needed to use,
> IOConnectSetCFProperties, because I've rarely needed an io_connect_t to kernel
> objects for this kind of communication.
>
> IORegistryEntrySetCFProperties maps to your driver's setProperties( OSObject *
> properties ) method. first thing I do in my setProperties method is something
> like this:
>
>
> you're okay using kCFStringEncodingASCII for
> "aardvark_pci_dsp_56301_firmware", because it _IS_ an ASCII string, unless
> your development system encodes string literals in some weird way.
>
> hth,
>
> Stuart
>
> on 2/26/03 10:00 PM, email@hidden at
> email@hidden wrote:

> Message: 1
> Date: Wed, 26 Feb 2003 14:45:58 -0500
> Subject: help, trying to use IOConnectSetCFProperty (and failing)
> From: "Paul R.Potts" <email@hidden>
> To: email@hidden
>
> Hi all,
>
> I have a PCI device driver with a user client based on Apple's
> SimpleUserClient example. The driver starts up, I'm also able to get
> some user-space code to open the user client like so:
>
> kern_result = IOServiceOpen (serviceObject, mach_task_self(), 0,
> &dataPort);
>
> This seems to work just great. The user client is coming up. Now I'm
> trying to set a property in the I/O registry. Apple's docs specifically
> suggest this as a method for downloading firmware (Writing an IOKit
> Device Driver, PDF, p. 92). I eventually want the user-space code to
> set up a dictionary of, perhaps, arrays of firmware to be downloaded,
> and for the kernel driver to see this, map the user-space memory into
> kernel space, and perform the download. I have a working MacOS 9 driver
> to port so I'm not starting from scratch; right now the difficult part
> is the user/kernel boundary.
>
> So far I'm just trying to get a single property to set. I've got:
>
> // create the dictionary's property name
> CFStringRef prop_name = CFStringCreateWithCString (NULL,
> "aardvark_pci_dsp_56301_firmware", kCFStringEncodingASCII);
>
> // should we be using CFStringGetSystemEncoding() or
> kCFStringEncodingASCII?
> CFStringRef prop_value = CFStringCreateWithCString (NULL,
> "property_value", kCFStringEncodingASCII);
>
> // create the dictionary
> kern_result = IOConnectSetCFProperty (dataPort, prop_name,
> prop_value);
>
> kern_result is always coming back e00002c7.
>
> I've got setOneProperty and setProperties methods implemented in both
> the user client class and the driver class itself, not knowing for sure
> which one will be called. it seems neither is.
>
> For kicks I also am trying using the service object instead of the data
> port:
>
> kern_result = IORegistryEntrySetCFProperty (serviceObject, prop_name,
> prop_value);
>
> I get the same result.
>
> Apple's book on Writing Device Drivers show how to implement the driver
> side of this, but not the user-space side. Is there some trick that I'm
> missing?
>
> Thanks for any help,
>
> Paul R. Potts
_______________________________________________
darwin-drivers mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-drivers
Do not post admin requests to the list. They will be ignored.



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.