Skip to content

Commit f7735a2

Browse files
authored
Fixed device count detection when ps2rst=0 is set (#57)
1 parent 3f7f910 commit f7735a2

File tree

3 files changed

+42
-29
lines changed

3 files changed

+42
-29
lines changed

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
VoodooPS2 Changelog
22
============================
3+
#### v2.3.4
4+
- Fixed device count detection when `ps2rst=0` is set.
5+
36
#### v2.3.3
47
- Fixed rapidly opening pages in browsers while scrolling with the trackpoint
58
- Fixed buttons on various trackpads (especially those without trackpoints attached)

VoodooPS2Controller/VoodooPS2Controller.cpp

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ IOReturn ApplePS2Controller::setProperties(OSObject* props)
369369

370370
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
371371

372-
void ApplePS2Controller::resetController(bool wakeup)
372+
void ApplePS2Controller::resetController()
373373
{
374374
_suppressTimeout = true;
375375
UInt8 commandByte;
@@ -415,30 +415,6 @@ void ApplePS2Controller::resetController(bool wakeup)
415415
writeCommandPort(kCP_SetCommandByte);
416416
writeDataPort(commandByte);
417417
DEBUG_LOG("%s: new commandByte = %02x\n", getName(), commandByte);
418-
419-
if (wakeup && _muxPresent)
420-
{
421-
setMuxMode(true);
422-
}
423-
else if (!wakeup)
424-
{
425-
if (!_kbdOnly){
426-
_muxPresent = setMuxMode(true);
427-
_nubsCount = _muxPresent ? kPS2MuxMaxIdx : kPS2AuxMaxIdx;
428-
}else{
429-
_muxPresent = false;
430-
_nubsCount = 1;
431-
}
432-
}
433-
434-
resetDevices();
435-
436-
//
437-
// Clear out garbage in the controller's input streams, before starting up
438-
// the work loop.
439-
//
440-
441-
flushDataPort();
442418
}
443419

444420
// -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -548,9 +524,32 @@ bool ApplePS2Controller::start(IOService * provider)
548524

549525
PE_parse_boot_argn("ps2rst", &_resetControllerFlag, sizeof(_resetControllerFlag));
550526
if (_resetControllerFlag & RESET_CONTROLLER_ON_BOOT) {
551-
resetController(false);
527+
resetController();
552528
}
553529

530+
//
531+
// Enable "Active PS/2 Multiplexing" if it exists.
532+
// This creates 4 Aux ports which pointing devices may connect to.
533+
//
534+
535+
if (_kbdOnly) {
536+
_muxPresent = false;
537+
_nubsCount = 1;
538+
} else {
539+
_muxPresent = setMuxMode(true);
540+
_nubsCount = _muxPresent ? kPS2MuxMaxIdx : kPS2AuxMaxIdx;
541+
}
542+
543+
//
544+
// Reset attached devices and clear out garbage in the controller's input streams,
545+
// before starting up the work loop.
546+
//
547+
548+
if (_resetControllerFlag & RESET_CONTROLLER_ON_BOOT) {
549+
resetDevices();
550+
flushDataPort();
551+
}
552+
554553
//
555554
// Use a spin lock to protect the client async request queue.
556555
//
@@ -1875,12 +1874,23 @@ void ApplePS2Controller::setPowerStateGated( UInt32 powerState )
18751874

18761875
if (_resetControllerFlag & RESET_CONTROLLER_ON_WAKEUP)
18771876
{
1878-
resetController(true);
1877+
resetController();
18791878
}
18801879

18811880
#endif // FULL_INIT_AFTER_WAKE
18821881

1883-
1882+
if (_muxPresent) {
1883+
setMuxMode(true);
1884+
}
1885+
1886+
#if FULL_INIT_AFTER_WAKE
1887+
if (_resetControllerFlag & RESET_CONTROLLER_ON_WAKEUP)
1888+
{
1889+
resetDevices();
1890+
flushDataPort();
1891+
}
1892+
#endif // FULL_INIT_AFTER_WAKE
1893+
18841894
//
18851895
// Transition from Sleep state to Working state in 4 stages.
18861896
//

VoodooPS2Controller/VoodooPS2Controller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ class EXPORT ApplePS2Controller : public IOService
305305
virtual UInt8 readDataPort(size_t port);
306306
virtual void writeCommandPort(UInt8 byte);
307307
virtual void writeDataPort(UInt8 byte);
308-
void resetController(bool);
308+
void resetController(void);
309309
bool setMuxMode(bool);
310310
void flushDataPort(void);
311311
void resetDevices(void);

0 commit comments

Comments
 (0)