[PD-cvs] externals/hcs/hid hid_menu.pd, NONE, 1.1 Makefile, 1.8, 1.9 TODO, 1.17, 1.18 hid.c, 1.18, 1.19 hid.h, 1.14, 1.15 hid_darwin.c, 1.15, 1.16

Hans-Christoph Steiner eighthave at users.sourceforge.net
Tue Jun 7 00:39:52 CEST 2005


Update of /cvsroot/pure-data/externals/hcs/hid
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32400

Modified Files:
	Makefile TODO hid.c hid.h hid_darwin.c 
Added Files:
	hid_menu.pd 
Log Message:


- cleaned up CFLAGS and tried higher optimization, which failed to build

- implemented a second outlet which outputs data upon [refresh( to build a
  popup menu to select the device by name using a [popup].  This uncovered a
  bug, which is not fixed, it seems that everytime you open a device, that
  device gets added again to the list of devices


Index: hid_darwin.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/hid_darwin.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** hid_darwin.c	4 Jun 2005 15:51:39 -0000	1.15
--- hid_darwin.c	6 Jun 2005 22:39:50 -0000	1.16
***************
*** 53,58 ****
  #include "hid.h"
  
! #define DEBUG(x)
! //#define DEBUG(x) x 
  
  /*==============================================================================
--- 53,58 ----
  #include "hid.h"
  
! //#define DEBUG(x)
! #define DEBUG(x) x 
  
  /*==============================================================================
***************
*** 294,297 ****
--- 294,312 ----
  }
  
+ void hid_output_device_name(t_hid *x, char *manufacturer, char *product) 
+ {
+ 	char      *device_name;
+ 	t_symbol  *device_name_symbol;
+ 
+ 	device_name = malloc( strlen(manufacturer) + 1 + strlen(product) + 1 );
+ //	device_name = malloc( 7 + strlen(manufacturer) + 1 + strlen(product) + 1 );
+ //	strcpy( device_name, "append " );
+ 	strcat( device_name, manufacturer );
+ 	strcat ( device_name, " ");
+ 	strcat( device_name, product );
+ //	outlet_anything( x->x_device_name_outlet, gensym( device_name ),0,NULL );
+ 	outlet_symbol( x->x_device_name_outlet, gensym( device_name ) );
+ }
+ 
  /* ============================================================================== */
  /* Pd [hid] FUNCTIONS */
***************
*** 478,483 ****
  	}
  
! // this doesn't seem to be needed at all
! //   result = HIDCreateOpenDeviceInterface(pCurrentHIDDevice);
  
  	post("[hid] opened device %d: %s %s",
--- 493,497 ----
  	}
  
! 	hid_output_device_name( x, pCurrentHIDDevice->manufacturer, pCurrentHIDDevice->product );
  
  	post("[hid] opened device %d: %s %s",
***************
*** 522,528 ****
  	DEBUG(post("hid_build_device_list"););
  
! 	// returns false if no device found
  	if(HIDBuildDeviceList (NULL, NULL)) 
  		error("[hid]: no HID devices found\n");
  	
  	return (0);
--- 536,555 ----
  	DEBUG(post("hid_build_device_list"););
  
! 	pRecDevice    pCurrentHIDDevice;
! 	t_atom        device_name_atoms[2];
! 	
! // returns false if no device found
  	if(HIDBuildDeviceList (NULL, NULL)) 
  		error("[hid]: no HID devices found\n");
+ 
+ 	/* send the [menu( msg to set the [hid_menu] to blank */
+ 	outlet_anything( x->x_device_name_outlet, gensym( "menu" ),0,NULL );
+ 
+ 	pCurrentHIDDevice = HIDGetFirstDevice();
+ 	while ( pCurrentHIDDevice != NULL )
+ 	{
+ 		hid_output_device_name( x, pCurrentHIDDevice->manufacturer, pCurrentHIDDevice->product );
+ 		pCurrentHIDDevice = HIDGetNextDevice(pCurrentHIDDevice);
+ 	} 
  	
  	return (0);

Index: hid.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/hid.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** hid.c	4 Jun 2005 15:51:39 -0000	1.18
--- hid.c	6 Jun 2005 22:39:50 -0000	1.19
***************
*** 51,55 ****
  void hid_output_event(t_hid *x, char *type, char *code, t_float value)
  {
! 	t_atom event_data[4];
  	
  	SETSYMBOL(event_data, gensym(type));	   /* type */
--- 51,55 ----
  void hid_output_event(t_hid *x, char *type, char *code, t_float value)
  {
! 	t_atom event_data[3];
  	
  	SETSYMBOL(event_data, gensym(type));	   /* type */
***************
*** 57,61 ****
  	SETFLOAT(event_data + 2, value);	         /* value */
  
! 	outlet_anything(x->x_obj.te_outlet,atom_gensym(event_data),2,event_data+1);
  }
  
--- 57,61 ----
  	SETFLOAT(event_data + 2, value);	         /* value */
  
! 	outlet_anything(x->x_data_outlet,atom_gensym(event_data),2,event_data+1);
  }
  
***************
*** 116,123 ****
  
  
! /* closed / same device          open */
! /* open / same device            no action */
! /* closed / different device     open */
! /* open / different device       close open */
  
  t_int hid_open(t_hid *x, t_float f) 
--- 116,127 ----
  
  
! /* hid_open behavoir
!  * current state                 action
!  * ---------------------------------------
!  * closed / same device          open 
!  * open / same device            no action 
!  * closed / different device     open 
!  * open / different device       close open 
!  */
  
  t_int hid_open(t_hid *x, t_float f) 
***************
*** 242,247 ****
  
    /* create anything outlet used for HID data */ 
!   outlet_new(&x->x_obj, 0);
! 
    /* find and report the list of devices */
    hid_build_device_list(x);
--- 246,252 ----
  
    /* create anything outlet used for HID data */ 
!   x->x_data_outlet = outlet_new(&x->x_obj, 0);
!   x->x_device_name_outlet = outlet_new(&x->x_obj, 0);
!   
    /* find and report the list of devices */
    hid_build_device_list(x);

--- NEW FILE: hid_menu.pd ---
#N canvas 469 172 252 29 10;
#X obj 131 138 inlet;
#X obj 15 350 outlet;
#X obj 1 2 popup 250 25 grey90 HID_device none;
#X msg 15 318 open \$1;
#X obj 251 141 prepend append;
#X msg 131 203 options;
#X obj 131 176 route menu;
#X connect 0 0 6 0;
#X connect 2 0 3 0;
#X connect 3 0 1 0;
#X connect 4 0 2 0;
#X connect 5 0 2 0;
#X connect 6 0 5 0;
#X connect 6 1 4 0;
#X coords 0 0 1 1 252 29 1;

Index: Makefile
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/Makefile,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Makefile	4 Jun 2005 15:51:39 -0000	1.8
--- Makefile	6 Jun 2005 22:39:50 -0000	1.9
***************
*** 31,36 ****
  PDEXECUTABLE = ../../../pd/bin/pd
  
! CFLAGS = -DUNIX -DPD -O2 -funroll-loops -fomit-frame-pointer \
!     -Wall -W -Wno-shadow -Wstrict-prototypes -Wno-unused
  
  INCLUDE =  -I./ -I../../../pd/src -I./HID\ Utilities\ Source
--- 31,40 ----
  PDEXECUTABLE = ../../../pd/bin/pd
  
! # generic optimization
! OPT_FLAGS = -O3
! # G4 7450 optimization  (gives errors)
! #OPT_FLAGS = -fast -mcpu=7450 -maltivec
! 
! CFLAGS = $(OPT_FLAGS) -Wall -W -Wno-shadow -Wstrict-prototypes -Wno-unused
  
  INCLUDE =  -I./ -I../../../pd/src -I./HID\ Utilities\ Source

Index: TODO
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/TODO,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** TODO	4 Jun 2005 15:56:45 -0000	1.17
--- TODO	6 Jun 2005 22:39:50 -0000	1.18
***************
*** 1,2 ****
--- 1,9 ----
+ ==============================================================================
+ = make fake names in input_arrays.c
+ 
+ Instead of having "NULL" names, make up names using the event type, and the
+ code number, i.e. abs_41, rel_15
+ 
+ 
  
  ==============================================================================

Index: hid.h
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/hid.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** hid.h	28 Apr 2005 04:29:58 -0000	1.14
--- hid.h	6 Jun 2005 22:39:50 -0000	1.15
***************
*** 31,34 ****
--- 31,36 ----
  		t_int               x_started;
  		t_int               x_device_open;
+ 		t_outlet            *x_data_outlet;
+ 		t_outlet            *x_device_name_outlet;
  } t_hid;
  





More information about the Pd-cvs mailing list