aboutsummaryrefslogtreecommitdiff
path: root/hidio_darwin.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-05-27 11:25:12 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-05-27 11:25:12 +0000
commita2f3e6eceb49a5117992c595acc6e914ae1d7a4b (patch)
treeea46fbbe701f593fd336a71f0f11328fcba22e5a /hidio_darwin.c
parent71e6d095b72119c5274c744613105f7f676603b9 (diff)
first sketch of output message with variable atom types
svn path=/trunk/externals/io/hidio/; revision=9924
Diffstat (limited to 'hidio_darwin.c')
-rw-r--r--hidio_darwin.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/hidio_darwin.c b/hidio_darwin.c
index 529dc3b..ed157cf 100644
--- a/hidio_darwin.c
+++ b/hidio_darwin.c
@@ -497,7 +497,7 @@ static void hidio_print_element_list(t_hidio *x)
return;
}
post("[hidio] found %d elements:",element_count[x->x_device_number]);
- post("\n TYPE\tCODE\t#\tEVENT NAME");
+ post("\n TYPE\t\tCODE\t#\tcookie\tEVENT NAME");
post("-----------------------------------------------------------");
for(i=0; i<element_count[x->x_device_number]; i++)
{
@@ -506,8 +506,9 @@ static void hidio_print_element_list(t_hidio *x)
HIDGetTypeName((IOHIDElementType) pCurrentHIDElement->type, type_name);
HIDGetUsageName(pCurrentHIDElement->usagePage,
pCurrentHIDElement->usage, usage_name);
- post(" %s\t%s\t%d\t%s, %s", current_element->type->s_name,
+ post(" %s\t%s\t%d\t%d\t%s, %s", current_element->type->s_name,
current_element->name->s_name,(int) current_element->instance,
+ pCurrentHIDElement->cookie,
type_name, usage_name);
}
post("");
@@ -713,13 +714,21 @@ void hidio_get_events(t_hidio *x)
}
}
+
+/* switch to transactions */
+
+void hidio_write_packet(void)
+{
+}
+
+
void hidio_write_event_symbol_int(t_hidio *x, t_symbol *type, t_int code,
t_int instance, t_int value)
{
debug_post(LOG_DEBUG,"hidio_write_event_symbol_float");
}
-void hidio_write_event_symbols(t_hidio *x, t_symbol *type, t_symbol *code,
+void hidio_write_event_symbols(t_hidio *x, t_symbol *type, t_symbol *name,
t_int instance, t_int value)
{
/* TODO handle multiple instances of the same usage, i.e. arrays */
@@ -727,13 +736,14 @@ void hidio_write_event_symbols(t_hidio *x, t_symbol *type, t_symbol *code,
int i;
t_hid_element *current_element;
IOHIDEventStruct event;
- int cookie = (int) instance;
pRecDevice pCurrentHIDDevice = device_pointer[x->x_device_number];
pRecElement pCurrentHIDElement;
for(i=0; i<element_count[x->x_device_number]; i++)
{
current_element = element[x->x_device_number][i];
- if((current_element->type == type) && (current_element->name == code))
+ if((current_element->type == type)
+ && (current_element->name == name)
+ && (current_element->instance == instance))
{
pCurrentHIDElement = current_element->pHIDElement;
break;
@@ -742,12 +752,12 @@ void hidio_write_event_symbols(t_hidio *x, t_symbol *type, t_symbol *code,
post("element usage page and usage: 0x%04x 0x%04x", pCurrentHIDElement->usagePage, pCurrentHIDElement->usage);
event.elementCookie = (IOHIDElementCookie)pCurrentHIDElement->cookie;
event.value = (SInt32)value;
- post("pCurrentHIDElement->cookie, cookie, event.value, value: %d %d %d %f",
- pCurrentHIDElement->cookie, cookie, event.value, value);
+ post("pCurrentHIDElement->cookie %d, event.elementCookie %d, event.value %d, value %d",
+ pCurrentHIDElement->cookie, event.elementCookie, event.value, value);
HIDSetElementValue(pCurrentHIDDevice, pCurrentHIDElement, &event);
}
-void hidio_write_event_ints(t_hidio *x, t_int type, t_int code,
+void hidio_write_event_ints(t_hidio *x, t_int type, t_int name,
t_int instance, t_int value)
{
debug_post(LOG_DEBUG,"hidio_write_event_floats");