• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
IOServiceOpen fails
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

IOServiceOpen fails


  • Subject: IOServiceOpen fails
  • From: sanjay yaragatti <email@hidden>
  • Date: Fri, 13 Oct 2006 05:38:39 +0100 (BST)

Hi,

I have written a kernel driver.Now want to talk to it
through a userclient.My user space application is a
cocoa application  which calls IOServiceOpen() to
establish a connection with the userclient.The call
too IOServiceOpen fails and returning a value of  hex
value of 0xe00002c7 (-536870201  in decimal).But the
API's IOMasterPort(),IOServiceMatching() &
IOServiceGetMatchingServices() are returning
success.Can anybody help me out in this matter. I have
attached the sample code..



int sample()
{
 kern_return_t	kernResult;
 mach_port_t	masterPort;
 io_service_t	serviceObject;
 io_connect_t	dataPort;
 io_iterator_t 	iterator;
 CFDictionaryRef classToMatch;



 kernResult =
IOMasterPort(MACH_PORT_NULL,&masterPort);

 if (kernResult != KERN_SUCCESS)
  {
   printf( "IOMasterPort returned %d\n", kernResult);
   return 0;
  }


classToMatch=IOServiceMatching(kMyDriversIOKitClassName);

if (classToMatch == NULL)
{
printf( "IOServiceMatching returned a NULL
dictionary.\n");
 return 0;
}


kernResult = IOServiceGetMatchingServices(masterPort,
classToMatch, &iterator);

 if (kernResult != KERN_SUCCESS)
 {
printf("IOServiceGetMatchingServices returned %d\n\n",
kernResult);
 return 0;
 }


 // Get the first item in the iterator.
 serviceObject = IOIteratorNext(iterator);

// Release the io_iterator_t now that we're done with
it.
    IOObjectRelease(iterator);

    if (!serviceObject)
    {
        printf("Couldn't find any matches.\n");
        return 0;
    }


  // This call will cause the user client to be
instantiated.

kernResult = IOServiceOpen(serviceObject,
mach_task_self(), 0, &dataPort);

if (kernResult != KERN_SUCCESS)
{
 printf("IOServiceOpen returned %d\n", kernResult);
return 0;
}


Regards,
Sanjay



__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: IOServiceOpen fails
      • From: Michael Smith <email@hidden>
  • Prev by Date: Re: Socket permissions ???
  • Next by Date: Re: IOServiceOpen fails
  • Previous by thread: Re: Socket permissions ???
  • Next by thread: Re: IOServiceOpen fails
  • Index(es):
    • Date
    • Thread