Skip to content

Commit

Permalink
allow delays in VoodooPS2Controller to be configured
Browse files Browse the repository at this point in the history
  • Loading branch information
RehabMan committed Dec 20, 2015
1 parent e553e22 commit 1c25792
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
4 changes: 2 additions & 2 deletions VoodooPS2Controller.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
"LLVM_LTO[arch=x86_64]" = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
MODULE_VERSION = 1.8.20;
MODULE_VERSION = 1.8.21;
"OTHER_LDFLAGS[arch=x86_64]" = "-dead_strip";
PRODUCT_NAME = VoodooPS2Controller;
SDKROOT = macosx10.8;
Expand All @@ -830,7 +830,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
"LLVM_LTO[arch=x86_64]" = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
MODULE_VERSION = 1.8.20;
MODULE_VERSION = 1.8.21;
"OTHER_LDFLAGS[arch=x86_64]" = "-dead_strip";
PRODUCT_NAME = VoodooPS2Controller;
SDKROOT = macosx10.8;
Expand Down
28 changes: 24 additions & 4 deletions VoodooPS2Daemon/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ static io_iterator_t g_AddedIter;
static int g_MouseCount;
static io_service_t g_ioservice;

static int g_startupDelay = 1000000;
static int g_notificationDelay = 20000;

#ifdef DEBUG
#define DEBUG_LOG(args...) do { printf(args); fflush(stdout); } while (0)
#else
Expand Down Expand Up @@ -217,7 +220,7 @@ static void CheckForPointingAndRegisterInterest(io_service_t service)

static void DeviceAdded(void *refCon, io_iterator_t iter1)
{
usleep(20000); // wait 20ms for entry to populate
usleep(g_notificationDelay); // wait 20ms for entry to populate

int oldMouseCount = g_MouseCount;
io_service_t service;
Expand Down Expand Up @@ -320,11 +323,28 @@ int main(int argc, const char *argv[])
size_t l = strlen(c_time_string);
if (l > 0)
c_time_string[l-1] = 0;
DEBUG_LOG("%s: VoodooPS2Daemon 1.8.19 starting...\n", c_time_string);

DEBUG_LOG("%s: VoodooPS2Daemon 1.8.21 starting...\n", c_time_string);

// parse arguments...
for (int i = 1; i < argc; i++)
{
if (0 == strcmp(argv[i], "--startupDelay"))
{
if (++i < argc && argv[i])
g_startupDelay = atoi(argv[i]);
}
if (0 == strcmp(argv[i], "--notificationDelay"))
{
if (++i < argc && argv[i])
g_notificationDelay = atoi(argv[i]);
}
}
DEBUG_LOG("g_startupDelay: %d\n", g_startupDelay);
DEBUG_LOG("g_notificationDelay: %d\n", g_notificationDelay);

// Note: on Snow Leopard, the system is not ready to enumerate USB devices, so we wait a
// bit before continuing...
usleep(1000000);
usleep(g_startupDelay);

// first check for trackpad driver
g_ioservice = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("ApplePS2SynapticsTouchPad"));
Expand Down
7 changes: 7 additions & 0 deletions VoodooPS2Daemon/org.rehabman.voodoo.driver.Daemon.plist
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
<false/>
<key>Program</key>
<string>/usr/bin/VoodooPS2Daemon</string>
<key>ProgramArguments</key>
<array>
<string>--startupDelay</string>
<string>1000000</string>
<string>--notificationDelay</string>
<string>20000</string>
</array>
<key>StandardOutPath</key>
<string>/var/log/VoodooPS2Daemon.log</string>
<key>StandardErrorPath</key>
Expand Down

0 comments on commit 1c25792

Please sign in to comment.