• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/AppleUSBIrDA-145.2.4/IrDAMenu/

Lines Matching +defs:* -defs:.0123456789=?@

2  *  UtilityRoutines.c
3 * IrDAExtra
5 * Created by jwilcox on Fri Jun 01 2001.
6 * Copyright (c) 2001 __CompanyName__. All rights reserved.
10 #include "UtilityRoutines.h"
12 kern_return_t doCommand(io_connect_t con, unsigned char commandID, void *inputData, unsigned long inputDataSize, void *outputData, size_t *outputDataSize)
14 kern_return_t err = KERN_SUCCESS;
15 //mach_msg_type_number_t outSize = outputDataSize;
16 IrDACommandPtr command = NULL;
18 // Creates a command block:
19 command = (IrDACommandPtr)malloc (inputDataSize + sizeof (unsigned char));
20 if (!command)
21 return KERN_FAILURE;
22 command->commandID = commandID;
23 // Adds the data to the command block:
24 if ((inputData != NULL) && (inputDataSize != 0))
25 memcpy(command->data, inputData, inputDataSize);
26 // Now we can (hopefully) transfer everything:
27 err = IOConnectCallStructMethod(
28 con,
29 0, /* method index */
30 (char *) command, /* input[] */
31 inputDataSize+sizeof(unsigned char), /* inputCount */
32 (char *) outputData, /* output */
33 outputDataSize); /* buffer size, then result */
34 free (command);
35 return err;
38 /* ==========================================
39 * Look through the registry and search for an
40 * IONetworkInterface objects with the given
41 * name.
42 * If a match is found, the object is returned.
43 * =========================================== */
44 io_object_t getInterfaceWithName(mach_port_t masterPort, char *className)
46 kern_return_t kr;
47 io_iterator_t ite;
48 io_object_t obj = 0;
50 kr = IORegistryCreateIterator(masterPort, kIOServicePlane, true, &ite);
51 if (kr != kIOReturnSuccess) {
52 printf("IORegistryCreateIterator() error %08lx\n", (unsigned long)kr);
53 return 0;
55 while ((obj = IOIteratorNext(ite))) {
56 if (IOObjectConformsTo(obj, (char *) className)) {
57 break;
59 else {
60 io_name_t name;
61 kern_return_t rc;
62 rc = IOObjectGetClass(obj, name);
64 IOObjectRelease(obj);
65 obj = 0;
67 IOObjectRelease(ite);
68 return obj;