]>
git.saurik.com Git - apple/xnu.git/blob - iokit/Drivers/platform/drvAppleCuda/AppleCudaUserClient.cpp
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 #include "AppleCudaUserClient.h"
28 #define super IOUserClient
30 OSDefineMetaClassAndStructors(AppleCudaUserClient
, IOUserClient
)
33 AppleCudaUserClient::withTask(task_t owningTask
)
35 AppleCudaUserClient
*client
;
37 client
= new AppleCudaUserClient
;
39 if (client
->init() == false) {
45 client
->fTask
= owningTask
;
51 AppleCudaUserClient::start(IOService
*provider
)
55 theInterface
= OSDynamicCast(AppleCuda
, provider
);
57 if (theInterface
!= NULL
)
58 result
= super::start(provider
);
62 if (result
== false) {
63 IOLog("AppleCudaUserClient: provider start failed\n");
70 AppleCudaUserClient::clientClose(void)
73 return (kIOReturnSuccess
);
77 AppleCudaUserClient::clientDied(void)
79 return (clientClose());
83 AppleCudaUserClient::connectClient(IOUserClient
*client
)
85 return (kIOReturnSuccess
);
89 AppleCudaUserClient::registerNotificationPort(mach_port_t port
, UInt32 type
)
91 return (kIOReturnUnsupported
);
94 // --------------------------------------------------------------------------
95 // Method: setProperties
98 // sets the property from the dictionary to the airport properties.
101 AppleCudaUserClient::setProperties( OSObject
* properties
)
105 dict
= OSDynamicCast( OSDictionary
, properties
);
106 if ((dict
) && (theInterface
!= NULL
)) {
109 // Sets the wake on ring:
110 if( (data
= OSDynamicCast( OSData
, dict
->getObject("WakeOnRing")))) {
111 UInt8 myBool
= *((UInt8
*)data
->getBytesNoCopy());
112 //theInterface->setWakeOnRing(myBool);
114 IOLog("AppleCudaUserClient::setProperties WakeOnRing %d\n", myBool
);
117 return kIOReturnSuccess
;
120 // Sets the file-server mode:
121 if( (data
= OSDynamicCast( OSData
, dict
->getObject("FileServer")))) {
122 UInt8 myBool
= *((UInt8
*)data
->getBytesNoCopy());
123 theInterface
->setFileServerMode(myBool
);
125 IOLog("AppleCudaUserClient::setProperties FileServer %d\n", myBool
!= 0);
128 return kIOReturnSuccess
;
131 //Demand sleep immediately:
132 if( (data
= OSDynamicCast( OSData
, dict
->getObject("SleepNow")))) {
133 UInt8 myBool
= *((UInt8
*)data
->getBytesNoCopy());
137 theInterface
->demandSleepNow();
138 IOLog("AppleCudaUserClient::setProperties SleepNow\n");
140 return kIOReturnSuccess
;
143 // Sets the self-wake time:
144 if( (data
= OSDynamicCast( OSData
, dict
->getObject("AutoWake")))) {
146 IOByteCount len
= data
->getLength();
149 newTime
= *((UInt32
*)data
->getBytesNoCopy());
153 theInterface
->setWakeTime(newTime
* 1000); //convert to milliseconds
155 IOLog("AppleCudaUserClient::setProperties AutoWake 0x%08lx\n", newTime
);
158 return kIOReturnSuccess
;
161 // Sets the self-poweron time:
162 if( (data
= OSDynamicCast( OSData
, dict
->getObject("AutoPower")))) {
164 IOByteCount len
= data
->getLength();
167 newTime
= *((UInt32
*)data
->getBytesNoCopy());
171 theInterface
->setPowerOnTime(newTime
);
173 IOLog("AppleCudaUserClient::setProperties AutoPower 0x%08lx\n", newTime
);
176 return kIOReturnSuccess
;
181 return(kIOReturnBadArgument
);