starting preliminary work on macosx port

git-svn-id: svn+ssh://svn.code.sf.net/p/spacenav/code/trunk/spacenavd@146 ef983eb1-d774-4af8-acfd-baaf7b16a646
pull/1/head
John Tsiombikas 2012-05-17 03:56:12 +00:00
rodzic 301c691fe1
commit e6b41b7666
5 zmienionych plików z 120 dodań i 5 usunięć

Wyświetl plik

@ -7,8 +7,8 @@ ctl = spnavd_ctl
CC = gcc
INSTALL = install
CFLAGS = -pedantic -Wall $(dbg) $(opt) -fno-strict-aliasing -I$(srcdir)/src -I/usr/local/include
LDFLAGS = -L/usr/local/lib $(xlib)
CFLAGS = -pedantic -Wall $(dbg) $(opt) -fno-strict-aliasing -I$(srcdir)/src -I/usr/local/include $(add_cflags)
LDFLAGS = -L/usr/local/lib $(xlib) $(add_ldflags)
$(bin): $(obj)
$(CC) -o $@ $(obj) $(LDFLAGS)

13
configure vendored
Wyświetl plik

@ -47,15 +47,17 @@ fi
echo "configuring spacenavd - $VER"
if [ `uname -s` = Linux ]; then
sys=`uname -s`
if [ "$sys" = Linux ]; then
# NETLINK_KOBJECT_UEVENT used for hotplug detection requires 2.6.10
if test_kver 2.6.10; then
HOTPLUG=yes
else
HOTPLUG=no
fi
elif [ "$sys" = Darwin ]; then
add_ldflags='-framework CoreFoundation -framework IOKit'
else
echo "Currently support for systems other than Linux is experimental."
# TODO implement hotplug for other systems then switch this on
HOTPLUG=no
fi
@ -140,6 +142,13 @@ if [ "$X11" = 'yes' ]; then
echo 'xlib = -L/usr/X11/lib -lX11' >>Makefile
fi
if [ -n "$add_cflags" ]; then
echo "add_cflags = $add_cflags" >>Makefile
fi
if [ -n "$add_ldflags" ]; then
echo "add_ldflags = $add_ldflags" >>Makefile
fi
cat "$srcdir/Makefile.in" >>Makefile

Wyświetl plik

@ -0,0 +1,62 @@
/*
spacenavd - a free software replacement driver for 6dof space-mice.
Copyright (C) 2007-2012 John Tsiombikas <nuclear@member.fsf.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(__APPLE__) && defined(__MACH__)
#include "config.h"
#include <stdio.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/hid/IOHIDLib.h>
#include "dev.h"
int open_dev_usb(struct device *dev, const char *path)
{
return -1;
}
const char *find_usb_device(void)
{
static const int vendor_id = 1133; /* 3dconnexion */
static char dev_path[512];
io_object_t dev;
io_iterator_t iter;
CFMutableDictionaryRef match_dict;
CFNumberRef number_ref;
match_dict = IOServiceMatching(kIOHIDDeviceKey);
/* add filter rule: vendor-id should be 3dconnexion's */
number_ref = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &vendor_id);
CFDictionarySetValue(match_dict, CFSTR(kIOHIDVendorIDKey), number_ref);
CFRelease(number_ref);
/* fetch... */
if(IOServiceGetMatchingServices(kIOMasterPortDefault, match_dict, &iter) != kIOReturnSuccess) {
fprintf(stderr, "failed to retrieve USB HID devices\n");
return 0;
}
dev = IOIteratorNext(iter);
IORegistryEntryGetPath(dev, kIOServicePlane, dev_path);
IOObjectRelease(dev);
IOObjectRelease(iter);
return dev_path;
}
#endif /* __APPLE__ && __MACH__ */

Wyświetl plik

@ -15,7 +15,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(__linux__)
#if !defined(__linux__) && !(defined(__APPLE__) && defined(__MACH__))
#include <stdio.h>
#include "dev.h"

Wyświetl plik

@ -0,0 +1,44 @@
/*
spacenavd - a free software replacement driver for 6dof space-mice.
Copyright (C) 2007-2012 John Tsiombikas <nuclear@member.fsf.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(__APPLE__) && defined(__MACH__)
#include "config.h"
#include <stdio.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/hid/IOHIDLib.h>
int init_hotplug(void)
{
return -1;
}
void shutdown_hotplug(void)
{
}
int get_hotplug_fd(void)
{
return -1;
}
int handle_hotplug(void)
{
return -1;
}
#endif /* __APPLE__ && __MACH__ */