tags:

views:

114

answers:

1

Hi,

I am trying to pass a structure to IOConnectCallStructMethod.the structure declaration I got is below (I am not sure it is correct or not).

struct JPEGDriverArgs {    
  int must_be_zero_1;    
  IOSurfaceID src_surface /*in*/;    
  size_t src_size /*in*/;    
  int must_be_zero_2;    
  IOSurfaceID dest_surface /*in*/;    
  size_t dest_size /*in*/;    
  size_t result_size /*out*/;    
  size_t dest_width /*in*/;    
  size_t dest_height /*in*/;    
  int quality /*in: 4 gives decent quality */;    
};

Here is my actual code.

 io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault,
                IOServiceMatching("AppleJPEGDriver"));
    if (!service)
        return -1;

    io_connect_t port = (io_connect_t)0;
    kern_return_t kr = IOServiceOpen(service, mach_task_self(), 0, &port);
    IOObjectRelease(service);
    if (kr != kIOReturnSuccess)
        return kr;


 JPEGDriverArgs inputStruct;

 inputStruct.dest_height=400;
 inputStruct.dest_size=sizeof(dest);
 inputStruct.dest_surface=&dest;
 inputStruct.dest_width=320;
 inputStruct.must_be_zero_1=0;
 inputStruct.must_be_zero_2=0;
 inputStruct.quality=4;
 inputStruct.src_size=sizeof(lcdSurface);
 inputStruct.src_surface=&lcdSurface;

 JPEGDriverArgs outputStruct;
 size_t outputStructCnt = sizeof(outputStruct);

 int op1=__openJPEGDriverUserClientConnection();

 kr = IOConnectCallScalarMethod((mach_port_t)port, (uint32_t)2,0, 0,0, 0);

    if (kr != kIOReturnSuccess)
        return kr;

    kr = IOConnectCallStructMethod((mach_port_t)port,(uint32_t) 3,
           (const void *)&inputStruct, sizeof(inputStruct),
           (void *)&outputStruct, &outputStructCnt);

 NSLog(@"\nError : system 0x%x subsystem 0x%x code 0x%x ",
     err_get_system(kr), err_get_sub(kr), err_get_code(kr));

But I am getting the error result 0x2bc at IOConnectCallStructMethod

Am I filling the structure correctly ?

Can anyone please help me out.

Thanks In Advance,

A: 

Did you ever find out? I am interested with the answer as well.

c0diq