aboutsummaryrefslogtreecommitdiff
path: root/hid.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2004-11-06 01:03:01 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2004-11-06 01:03:01 +0000
commit3b32b7a05d935dc75321a5f7bfab6aad19d07fff (patch)
tree70b49d647bf447ffab632894d1a423b5c1f113b2 /hid.c
parentc0cf43d9e8b028a899af16a16e81dfe4729b6c95 (diff)
mice and joysticks work under MacOS X now, but there is much work left to be done in terms of translating HID Manager to Linux Input events.
svn path=/trunk/externals/hcs/hid/; revision=2220
Diffstat (limited to 'hid.c')
-rw-r--r--hid.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/hid.c b/hid.c
index 47938a8..f6e62fe 100644
--- a/hid.c
+++ b/hid.c
@@ -35,6 +35,18 @@
#define DEFAULT_DELAY 5
/*------------------------------------------------------------------------------
+ * FUNCTION PROTOTYPES
+ */
+
+void hid_start(t_hid *x);
+void hid_stop(t_hid *x);
+t_int hid_open(t_hid *x, t_float f);
+t_int hid_close(t_hid *x);
+t_int hid_read(t_hid *x,int fd);
+void hid_delay(t_hid *x, t_float f);
+static void hid_float(t_hid* x, t_floatarg f);
+
+/*------------------------------------------------------------------------------
* IMPLEMENTATION
*/
@@ -68,6 +80,9 @@ t_int hid_close(t_hid *x)
t_int hid_open(t_hid *x, t_float f)
{
DEBUG(post("hid_open"););
+
+/* store running state so that it can be restored after the device has been opened */
+ t_int started = x->x_started;
hid_close(x);
@@ -82,10 +97,15 @@ t_int hid_open(t_hid *x, t_float f)
if (hid_open_device(x,x->x_device_number))
{
error("[hid] can not open device %d",x->x_device_number);
- post("\\================================ [hid] ================================/\n");
+ post("\\================================ [hid] ================================/\n");
return (1);
}
+/* restore the polling state so that when I [tgl] is used to start/stop [hid],
+ * the [tgl]'s state will continue to accurately reflect [hid]'s state
+ */
+ hid_float(x,started);
+
post("\\================================ [hid] ================================/\n");
return (0);
}