[PD-cvs] externals/io/hidio hidio.c, 1.11, 1.12 hidio.h, 1.9, 1.10 hidio_darwin.c, 1.3, 1.4 hidio_types.c, 1.1, 1.2

Olaf Matthes olafmatt at users.sourceforge.net
Fri Dec 8 12:28:28 CET 2006


Update of /cvsroot/pure-data/externals/io/hidio
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26094

Modified Files:
	hidio.c hidio.h hidio_darwin.c hidio_types.c 
Log Message:
some changes to compile for Max again on OS X, still crashes when starting to poll


Index: hidio_types.c
===================================================================
RCS file: /cvsroot/pure-data/externals/io/hidio/hidio_types.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** hidio_types.c	8 Dec 2006 06:33:26 -0000	1.1
--- hidio_types.c	8 Dec 2006 11:28:25 -0000	1.2
***************
*** 1,4 ****
! 
  #include "m_pd.h"
  #include "hidio.h"
  
--- 1,7 ----
! #ifdef PD
  #include "m_pd.h"
+ #else
+ #include "ext.h"
+ #endif
  #include "hidio.h"
  

Index: hidio.h
===================================================================
RCS file: /cvsroot/pure-data/externals/io/hidio/hidio.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** hidio.h	8 Dec 2006 06:33:26 -0000	1.9
--- hidio.h	8 Dec 2006 11:28:25 -0000	1.10
***************
*** 77,83 ****
  #define REQUEST_READ 2
  #define REQUEST_SEND 3
! #define REQUEST_INFO 4
! #define REQUEST_CLOSE 5
! #define REQUEST_QUIT 6
  
  
--- 77,84 ----
  #define REQUEST_READ 2
  #define REQUEST_SEND 3
! #define REQUEST_PRINT 4
! #define REQUEST_INFO 5
! #define REQUEST_CLOSE 6
! #define REQUEST_QUIT 7
  
  
***************
*** 184,188 ****
  void hidio_build_device_list(void);
  void hidio_get_events(t_hidio *x);
! void hidio_print(t_hidio* x); /* print info to the console */
  void hidio_platform_specific_info(t_hidio* x); /* device info on the status outlet */
  void hidio_platform_specific_free(t_hidio *x);
--- 185,189 ----
  void hidio_build_device_list(void);
  void hidio_get_events(t_hidio *x);
! void hidio_doprint(t_hidio* x); /* print info to the console */
  void hidio_platform_specific_info(t_hidio* x); /* device info on the status outlet */
  void hidio_platform_specific_free(t_hidio *x);
***************
*** 193,197 ****
  										unsigned short usage);
  
- 
  /* cross-platform force feedback functions */
  t_int hidio_ff_autocenter(t_hidio *x, t_float value);
--- 194,197 ----

Index: hidio_darwin.c
===================================================================
RCS file: /cvsroot/pure-data/externals/io/hidio/hidio_darwin.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** hidio_darwin.c	8 Dec 2006 06:33:26 -0000	1.3
--- hidio_darwin.c	8 Dec 2006 11:28:25 -0000	1.4
***************
*** 739,743 ****
  
  /* TODO: this should be dumped for [devices( and [elements( messages */
! void hidio_print(t_hidio *x)
  {
  	if( !HIDHaveDeviceList() ) hidio_build_device_list();
--- 739,743 ----
  
  /* TODO: this should be dumped for [devices( and [elements( messages */
! void hidio_doprint(t_hidio *x)
  {
  	if( !HIDHaveDeviceList() ) hidio_build_device_list();

Index: hidio.c
===================================================================
RCS file: /cvsroot/pure-data/externals/io/hidio/hidio.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** hidio.c	8 Dec 2006 06:33:26 -0000	1.11
--- hidio.c	8 Dec 2006 11:28:25 -0000	1.12
***************
*** 132,136 ****
  	SETFLOAT(output_atom, output_value);
  #else
! 	atom_setlong(output_atom, output_value);
  #endif /* PD */
  	outlet_anything( x->x_status_outlet, selector, 1, output_atom);
--- 132,136 ----
  	SETFLOAT(output_atom, output_value);
  #else
! 	atom_setlong(output_atom, (long)output_value);
  #endif /* PD */
  	outlet_anything( x->x_status_outlet, selector, 1, output_atom);
***************
*** 167,176 ****
  		for(i=0;i<element_count[x->x_device_number];++i)
  		{
  			SETSYMBOL(output_data, element[x->x_device_number][i]->type);
  			SETSYMBOL(output_data + 1, element[x->x_device_number][i]->name);
- #ifdef PD
  			SETFLOAT(output_data + 2, element[x->x_device_number][i]->min);
  			SETFLOAT(output_data + 3, element[x->x_device_number][i]->max);
  #else
  			atom_setlong(output_data + 2, element[x->x_device_number][i]->min);
  			atom_setlong(output_data + 3, element[x->x_device_number][i]->max);
--- 167,178 ----
  		for(i=0;i<element_count[x->x_device_number];++i)
  		{
+ #ifdef PD
  			SETSYMBOL(output_data, element[x->x_device_number][i]->type);
  			SETSYMBOL(output_data + 1, element[x->x_device_number][i]->name);
  			SETFLOAT(output_data + 2, element[x->x_device_number][i]->min);
  			SETFLOAT(output_data + 3, element[x->x_device_number][i]->max);
  #else
+ 			atom_setsym(output_data, element[x->x_device_number][i]->type);
+ 			atom_setsym(output_data + 1, element[x->x_device_number][i]->name);
  			atom_setlong(output_data + 2, element[x->x_device_number][i]->min);
  			atom_setlong(output_data + 3, element[x->x_device_number][i]->max);
***************
*** 292,299 ****
  	{
  		t_atom event_data[3];
  		SETSYMBOL(event_data, output_data->name);
  		SETFLOAT(event_data + 1, output_data->instance);
  		SETFLOAT(event_data + 2, output_data->value);
! 		outlet_anything(x->x_data_outlet,output_data->type,3,event_data);
  	} 
  }
--- 294,308 ----
  	{
  		t_atom event_data[3];
+ #ifdef PD
  		SETSYMBOL(event_data, output_data->name);
  		SETFLOAT(event_data + 1, output_data->instance);
  		SETFLOAT(event_data + 2, output_data->value);
! #else
! 		atom_setsym(event_data, output_data->name);
! 		atom_setsym(event_data, output_data->name);
! 		atom_setlong(event_data + 1, (long)output_data->instance);
! 		atom_setlong(event_data + 2, (long)output_data->value);
! #endif
! 		outlet_anything(x->x_data_outlet, output_data->type, 3, event_data);
  	} 
  }
***************
*** 425,432 ****
  	double right_now = clock_getlogicaltime();
  #else
! /* TODO: this should use gettime() not systime_ms().  This needs to be logical
!  * time, not system time because the idea is that only one instance should get
!  * events from the OS in each slice of logical time <hans at at.or.at> */
! 	double right_now = (double)systime_ms();
  #endif /* PD */
  	t_hid_element *current_element;
--- 434,439 ----
  	double right_now = clock_getlogicaltime();
  #else
! 	double right_now;
! 	clock_getftime(&right_now);
  #endif /* PD */
  	t_hid_element *current_element;
***************
*** 470,473 ****
--- 477,488 ----
  }
  
+ static void hidio_print(t_hidio *x)
+ {
+ 	pthread_mutex_lock(&x->x_mutex);
+ 	x->x_requestcode = REQUEST_PRINT;
+ 	pthread_cond_signal(&x->x_requestcondition);
+ 	pthread_mutex_unlock(&x->x_mutex);
+ }
+ 
  static void hidio_info(t_hidio *x)
  {
***************
*** 580,583 ****
--- 595,607 ----
  			pthread_cond_signal(&x->x_answercondition);
  		}
+ 		else if (x->x_requestcode == REQUEST_PRINT)
+ 		{
+ 			pthread_mutex_unlock(&x->x_mutex);
+ 			hidio_doprint(x);
+ 			pthread_mutex_lock(&x->x_mutex);
+ 			if (x->x_requestcode == REQUEST_PRINT)
+ 				x->x_requestcode = REQUEST_NOTHING;
+ 			pthread_cond_signal(&x->x_answercondition);
+ 		}
  		else if (x->x_requestcode == REQUEST_INFO)
  		{





More information about the Pd-cvs mailing list