aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hidio.c24
-rw-r--r--hidio.h15
2 files changed, 27 insertions, 12 deletions
diff --git a/hidio.c b/hidio.c
index a06e9ba..8562b0c 100644
--- a/hidio.c
+++ b/hidio.c
@@ -2,6 +2,7 @@
/* */
/* interface to native HID (Human Interface Devices) API */
/* Written by Hans-Christoph Steiner <hans@at.or.at> */
+/* Max/MSP port by Olaf Matthes <olaf.matthes@gmx.de> */
/* */
/* Copyright (c) 2004-2006 Hans-Christoph Steiner */
/* */
@@ -22,12 +23,16 @@
/* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* */
/* --------------------------------------------------------------------------*/
-
+
+#ifdef _WINDOWS
+/* any Windows specific includes go in here */
+#else
#include <unistd.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
+#include <ctype.h>
+#endif
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
#include "hidio.h"
@@ -83,14 +88,15 @@ static void hidio_open(t_hidio *x, t_symbol *s, int argc, t_atom *argv);
void debug_print(t_int message_debug_level, const char *fmt, ...)
{
if(message_debug_level <= global_debug_level)
- {
+ {
char buf[MAXPDSTRING];
va_list ap;
//t_int arg[8];
va_start(ap, fmt);
vsnprintf(buf, MAXPDSTRING-1, fmt, ap);
post(buf);
- va_end(ap);
+ va_end(ap);
+
}
}
@@ -384,8 +390,8 @@ t_int hidio_close(t_hidio *x)
*/
static void hidio_open(t_hidio *x, t_symbol *s, int argc, t_atom *argv)
{
+ short device_number;
debug_print(LOG_DEBUG,"hid_%s",s->s_name);
- short device_number;
pthread_mutex_lock(&x->x_mutex);
device_number = get_device_number_from_arguments(argc, argv);
@@ -830,7 +836,7 @@ int main()
hidio_class = c;
finder_addclass("Devices", "hidio");
- post("hidio: © 2006 by Olaf Matthes");
+ post("hidio: © 2006 by Hans-Christoph Steiner & Olaf Matthes");
/* pre-generate often used symbols */
ps_open = gensym("open");
diff --git a/hidio.h b/hidio.h
index eab0cf0..793de81 100644
--- a/hidio.h
+++ b/hidio.h
@@ -1,9 +1,18 @@
#ifndef _HIDIO_H
#define _HIDIO_H
-#include <stdio.h>
+#include <stdio.h>
+#ifdef _WINDOWS
+#include "pthread.h" /* needs pthread library */
+#define LOG_DEBUG 7
+#define LOG_INFO 6
+#define LOG_WARNING 4
+#define vsnprintf _vsnprintf
+#pragma warning (disable: 4305 4244 4761)
+#else
#include <sys/syslog.h>
-#include <pthread.h>
+#include <pthread.h>
+#endif
#ifdef __linux__
#include <linux/types.h>
@@ -35,7 +44,7 @@ typedef void t_clock;
#define HIDIO_MAJOR_VERSION 0
#define HIDIO_MINOR_VERSION 0
-/* static char *version = "$Revision: 1.4 $"; */
+/* static char *version = "$Revision: 1.5 $"; */
/*------------------------------------------------------------------------------
* GLOBAL DEFINES