[PD-cvs] externals/hcs/hid TODO, 1.27, 1.28 hid.c, 1.27, 1.28 hid.h, 1.26, 1.27 hid_darwin.c, 1.26, 1.27 hid_linux.c, 1.18, 1.19

Hans-Christoph Steiner eighthave at users.sourceforge.net
Tue Aug 15 03:50:20 CEST 2006


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

Modified Files:
	TODO hid.c hid.h hid_darwin.c hid_linux.c 
Log Message:


- renamed variables for clarity

- added section to test the new instance tracking in output messages


Index: TODO
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/TODO,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** TODO	2 Jun 2006 23:41:36 -0000	1.27
--- TODO	15 Aug 2006 01:50:17 -0000	1.28
***************
*** 24,44 ****
  = array lookups for symbols
  
- - make arrays to lookup symbols by usagepage# and usage#
- 
- - advantage: much fewer symbol lookups
- 
- - disadvantage: much more RAM used.
- 
- implementation idea #1:
- 
- make hid-specific gensym() function which checks an array for the symbol by
- #.  If it doesn't exist, it looks up the symbol and adds it to the array.  The
- array size should be dynamically allocated so that [hid] doesn't use massive
- amounts of memory.
- 
- If no vendor-defined pages are used, then the array could be quite small.  If
- only one usage page is used, then it would also be not too big.  Otherwise, it
- could use 10+ megs of RAM... hmm..
- 
  implementation idea #2:
  
--- 24,27 ----
***************
*** 60,63 ****
--- 43,55 ----
  compare against
  
+ 
+ ______________________________________________________________________________
+ = make only the first executed instance fetch the data
+ 
+  the function is ugen_getsortno() -- returns
+ an integer which increases eachtime DSP is restarted.  You can add the
+ function call (to the ugen chain for instance) each time you see
+ ugen_getsortno() return an integer greater than the previous one you've
+ 
  ______________________________________________________________________________
  = output one value per poll
***************
*** 97,100 ****
--- 89,107 ----
  - device string  [name Trackpad( 
  
+ ______________________________________________________________________________
+ = get tablets working on Mac OS X
+ 
+ http://www.versiontracker.com/php/feedback/article.php?story=20051221163326829
+ 
+ http://www.wacom-europe.com/forum/topic.asp?TOPIC_ID=2719&ARCHIVE=
+ 
+ ______________________________________________________________________________
+ = block devices like mice/keyboards etc from outputting
+ 
+ at least document the procedure needed
+ 
+ Mac OS X:
+ http://lists.apple.com/archives/usb/2005/Aug/msg00068.html
+ 
  
  

Index: hid_darwin.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/hid_darwin.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** hid_darwin.c	2 Jun 2006 23:41:36 -0000	1.26
--- hid_darwin.c	15 Aug 2006 01:50:17 -0000	1.27
***************
*** 3,7 ****
   *  Apple Darwin HID Manager support for Pd [hid] object
   *
!  *  some code from SuperCollider3's SC_HID.cpp by Jan Truetzschler v. Falkenstein
   *
   *  Copyright (c) 2004 Hans-Christoph All rights reserved.
--- 3,7 ----
   *  Apple Darwin HID Manager support for Pd [hid] object
   *
!  *  some code from SuperCollider3's SC_HID.cpp by Jan Truetzschler Falkenstein
   *
   *  Copyright (c) 2004 Hans-Christoph All rights reserved.
***************
*** 302,306 ****
  short get_device_number_by_id(unsigned short vendor_id, unsigned short product_id)
  {
! 	debug_print(LOG_DEBUG,"get_device_number_from_usage_list");
  
  	pRecDevice    pCurrentHIDDevice;
--- 302,306 ----
  short get_device_number_by_id(unsigned short vendor_id, unsigned short product_id)
  {
! 	debug_print(LOG_DEBUG,"get_device_number_from_usage");
  
  	pRecDevice    pCurrentHIDDevice;
***************
*** 332,339 ****
  }
  
! short get_device_number_from_usage_list(short device_number, 
! 										unsigned short usage_page, unsigned short usage)
  {
! //	debug_print(LOG_DEBUG,"get_device_number_from_usage_list");
  
  	pRecDevice    pCurrentHIDDevice;
--- 332,340 ----
  }
  
! short get_device_number_from_usage(short device_number, 
! 										unsigned short usage_page, 
! 										unsigned short usage)
  {
! //	debug_print(LOG_DEBUG,"get_device_number_from_usage");
  
  	pRecDevice    pCurrentHIDDevice;

Index: hid.h
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/hid.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** hid.h	2 Jun 2006 23:41:36 -0000	1.26
--- hid.h	15 Aug 2006 01:50:17 -0000	1.27
***************
*** 119,123 ****
  void hid_platform_specific_free(t_hid *x);
  short get_device_number_by_id(unsigned short vendor_id, unsigned short product_id);
! short get_device_number_from_usage_list(short device_number, 
  										unsigned short usage_page, 
  										unsigned short usage);
--- 119,123 ----
  void hid_platform_specific_free(t_hid *x);
  short get_device_number_by_id(unsigned short vendor_id, unsigned short product_id);
! short get_device_number_from_usage(short device_number, 
  										unsigned short usage_page, 
  										unsigned short usage);

Index: hid_linux.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/hid_linux.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** hid_linux.c	2 Jun 2006 20:06:50 -0000	1.18
--- hid_linux.c	15 Aug 2006 01:50:17 -0000	1.19
***************
*** 44,55 ****
  /* ------------------------------------------------------------------------------ */
  
! /* JMZ: i changed the convert functions (and the get-event function too!) to return
!  * t_symbol* instead of writing into a fixed-sized buffer (which was way too
!  * small and those made this object crash)
!  * in order to change as little lines as possible the callback functions to the
!  * hid-object still use (char*): so we convert a char[] into a symbol and then 
!  * extract the (char*) out of it to make it a symbol again
!  * LATER: use t_symbol's all over, since it is very flexible (with respect to length)
!  * and sooner or later the strings are converted to t_symbol anyhow...
   *
   * Why? bug-fixing
--- 44,55 ----
  /* ------------------------------------------------------------------------------ */
  
! /* JMZ: i changed the convert functions (and the get-event function too!) to
!  * return t_symbol* instead of writing into a fixed-sized buffer (which was
!  * way too small and those made this object crash) in order to change as
!  * little lines as possible the callback functions to the hid-object still use
!  * (char*): so we convert a char[] into a symbol and then extract the (char*)
!  * out of it to make it a symbol again LATER: use t_symbol's all over, since
!  * it is very flexible (with respect to length) and sooner or later the
!  * strings are converted to t_symbol anyhow...
   *
   * Why? bug-fixing
***************
*** 511,515 ****
  }
  
! t_int get_device_number_from_usage_list(t_int device_number, 
                                          unsigned short usage_page, 
                                          unsigned short usage)
--- 511,515 ----
  }
  
! t_int get_device_number_from_usage(t_int device_number, 
                                          unsigned short usage_page, 
                                          unsigned short usage)

Index: hid.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/hid/hid.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** hid.c	2 Jun 2006 23:41:36 -0000	1.27
--- hid.c	15 Aug 2006 01:50:17 -0000	1.28
***************
*** 150,158 ****
  {
  	short device_number = -1;
! 	unsigned short usage_number;
  	unsigned int usage;
  	unsigned short vendor_id;
  	unsigned short product_id;
! 	char usage_string[MAXPDSTRING] = "";
  	t_symbol *first_argument;
  	t_symbol *second_argument;
--- 150,158 ----
  {
  	short device_number = -1;
! 	unsigned short device_type_instance;
  	unsigned int usage;
  	unsigned short vendor_id;
  	unsigned short product_id;
! 	char device_type_string[MAXPDSTRING] = "";
  	t_symbol *first_argument;
  	t_symbol *second_argument;
***************
*** 163,166 ****
--- 163,167 ----
  		if(first_argument == &s_) 
  		{ // single float arg means device #
+ 			post("first_argument == &s_");
  			device_number = (short) atom_getfloatarg(0,argc,argv);
  			if(device_number < 0) device_number = -1;
***************
*** 168,180 ****
  		}
  		else
! 		{ // single symbol arg means first instance of usage
! 			debug_print(LOG_DEBUG,"[hid] setting device via usagepage/usage");
! 			atom_string(argv, usage_string, MAXPDSTRING-1);
! 			usage = name_to_usage(usage_string);
! 			device_number = get_device_number_from_usage_list(0, 
! 															  usage >> 16, 
! 															  usage & 0xffff);
  			debug_print(LOG_INFO,"[hid] using 0x%04x 0x%04x for %s",
! 						usage, usage >> 16, usage & 0xffff, usage_string);
  		}
  	}
--- 169,179 ----
  		}
  		else
! 		{ // single symbol arg means first instance of a device type
! 			atom_string(argv, device_type_string, MAXPDSTRING-1);
! 			usage = name_to_usage(device_type_string);
! 			device_number = get_device_number_from_usage(0, usage >> 16, 
! 														 usage & 0xffff);
  			debug_print(LOG_INFO,"[hid] using 0x%04x 0x%04x for %s",
! 						usage >> 16, usage & 0xffff, device_type_string);
  		}
  	}
***************
*** 185,194 ****
  		if( second_argument == &s_ ) 
  		{ /* a symbol then a float means match on usage */
! 			atom_string(argv, usage_string, MAXPDSTRING-1);
! 			usage = name_to_usage(usage_string);
! 			usage_number = atom_getfloatarg(1,argc,argv);
  			debug_print(LOG_DEBUG,"[hid] looking for %s at #%d",
! 						usage_string,usage_number);
! 			device_number = get_device_number_from_usage_list(usage_number,
  															  usage >> 16, 
  															  usage & 0xffff);
--- 184,193 ----
  		if( second_argument == &s_ ) 
  		{ /* a symbol then a float means match on usage */
! 			atom_string(argv, device_type_string, MAXPDSTRING-1);
! 			usage = name_to_usage(device_type_string);
! 			device_type_instance = atom_getfloatarg(1,argc,argv);
  			debug_print(LOG_DEBUG,"[hid] looking for %s at #%d",
! 						device_type_string, device_type_instance);
! 			device_number = get_device_number_from_usage(device_type_instance,
  															  usage >> 16, 
  															  usage & 0xffff);
***************
*** 212,219 ****
--- 211,228 ----
  		(output_data->relative) )  // relative data should always be output
  	{
+ #if 1
+ 		// this is [hid] compatible
  		t_atom event_data[2];
  		SETSYMBOL(event_data, output_data->name);
  		SETFLOAT(event_data + 1, output_data->value);
  		outlet_anything(x->x_data_outlet,output_data->type,2,event_data);
+ #else
+ 		// this outputs instance number, for [hid] v2
+ 		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);
+ #endif
  	}
  }





More information about the Pd-cvs mailing list