diff -Nru xnu.orig/iokit/Families/IOADBBus/IOADBController.cpp xnu/iokit/Families/IOADBBus/IOADBController.cpp --- xnu.orig/iokit/Families/IOADBBus/IOADBController.cpp Tue May 6 17:50:29 2003 +++ xnu/iokit/Families/IOADBBus/IOADBController.cpp Fri Jul 4 16:46:41 2003 @@ -202,26 +202,37 @@ bool IOADBController::probeAddress ( IOADBAddress addr ) { IOReturn err; - ADBDeviceControl * deviceInfo; UInt16 value; IOByteCount length; length = 2; err = readFromDevice(addr,3,(UInt8 *)&value,&length); - if (err == ADB_RET_OK) { - if( NULL == (deviceInfo = adbDevices[ addr ])) { + if (err == ADB_RET_OK) + allocDevice(addr, value & 0xff); + + return( (err == ADB_RET_OK)); +} + +// ********************************************************************************** +// allocDevice +// +// ********************************************************************************** +void IOADBController::allocDevice(IOADBAddress addr, UInt8 handlerId) +{ + ADBDeviceControl* deviceInfo; - deviceInfo = (ADBDeviceControl *)IOMalloc(sizeof(ADBDeviceControl)); - bzero(deviceInfo, sizeof(ADBDeviceControl)); + if( NULL == (deviceInfo = adbDevices[ addr ])) { - adbDevices[ addr ] = deviceInfo; - deviceInfo->defaultAddress = addr; - deviceInfo->handlerID = deviceInfo->defaultHandlerID = (value & 0xff); - } - deviceInfo->address = addr; + deviceInfo = (ADBDeviceControl *)IOMalloc(sizeof(ADBDeviceControl)); + bzero(deviceInfo, sizeof(ADBDeviceControl)); + + adbDevices[ addr ] = deviceInfo; + deviceInfo->defaultAddress = addr; + deviceInfo->handlerID = deviceInfo->defaultHandlerID = handlerId; } - return( (err == ADB_RET_OK)); + + deviceInfo->address = addr; } @@ -348,6 +359,22 @@ if(devNum) { unresolvedAddrs &= ~( 1 << devNum ); } + } + + // If nothing has been found at address 2 (keyboard) force it anyway + if((adbDevices[2] == NULL) && (freeAddrs & (1<<2))) + { + IOLog("IOADBController: Forcing assignment of id 2.\n"); + allocDevice(2, 2); + freeAddrs &= ~(1<<2); + } + + // If nothing has been found at address 3 (mouse) force it anyway + if((adbDevices[3] == NULL) && (freeAddrs & (1<<3))) + { + IOLog("IOADBController: Forcing assignment of id 3.\n"); + allocDevice(3, 3); + freeAddrs &= ~(1<<3); } IOLog("ADB present:%lx\n", (freeAddrs ^ 0xfffe)); diff -Nru xnu.orig/iokit/IOKit/adb/IOADBController.h xnu/iokit/IOKit/adb/IOADBController.h --- xnu.orig/iokit/IOKit/adb/IOADBController.h Tue May 6 17:50:29 2003 +++ xnu/iokit/IOKit/adb/IOADBController.h Fri Jul 4 10:47:13 2003 @@ -107,6 +107,7 @@ bool moveDeviceFrom ( IOADBAddress from, IOADBAddress to, bool check ); unsigned int firstBit ( unsigned int mask ); int getURLComponentUnit ( IOService * device, char * path, int maxLen ); + void allocDevice(IOADBAddress addr, UInt8 handlerId); bool busProbed; thread_call_t probeThread; };