All pastes #380162 Raw Edit

Someone

public text v1 · immutable
#380162 ·published 2007-03-03 20:55 UTC
rendered paste body
Index: lib/python/linux_event.py
===================================================================
RCS file: /cvs/emc2/lib/python/linux_event.py,v
retrieving revision 1.5
diff -u -r1.5 linux_event.py
--- lib/python/linux_event.py	27 Feb 2007 01:50:45 -0000	1.5
+++ lib/python/linux_event.py	3 Mar 2007 20:54:44 -0000
@@ -36,6 +36,7 @@
     elif o == 'EV_LED': map = LED_invert    
     elif o == 'EV_ABS': map = ABS_invert    
     elif o == 'EV_REL': map = REL_invert    
+    elif o == 'EV_FF': map = FF_invert    
     else: map = {}
 
     sz = max(map) + 1
@@ -616,6 +617,16 @@
 	'LED_MAIL': 0x09,
 	'LED_CHARGING': 0x0a,
 }
+FF = {
+	'FF_RUMBLE': 0x50,
+	'FF_PERIODIC': 0x51,
+	'FF_CONSTANT': 0x52,
+	'FF_SPRING': 0x53,
+	'FF_FRICTION': 0x54,
+	'FF_DAMPER': 0x55,
+	'FF_INERTIA': 0x56,
+	'FF_RAMP': 0x57,
+}
 
 def i(x):
     return x - 2**32
@@ -648,6 +659,7 @@
 KEY_invert = invert(KEY)
 LED_invert = invert(LED)
 REL_invert = invert(REL)
+FF_invert = invert(FF)
 del invert
 KEYBTN_invert = KEY_invert.copy()
 KEYBTN_invert.update(BTN_invert)
Index: src/hal/user_comps/hal_input.py
===================================================================
RCS file: /cvs/emc2/src/hal/user_comps/hal_input.py,v
retrieving revision 1.9
diff -u -r1.9 hal_input.py
--- src/hal/user_comps/hal_input.py	3 Mar 2007 17:49:00 -0000	1.9
+++ src/hal/user_comps/hal_input.py	3 Mar 2007 20:54:46 -0000
@@ -104,6 +104,11 @@
 	    comp.newparam("%s.%s-invert" % (idx, name), hal.HAL_BIT, hal.HAL_RW)
 	    self.last[name] = 0
 	    self.device.write_event('EV_LED', led, 0)
+
+	for forces in self.device.get_bits('EV_FF'):
+	    forces = tohalname(forces)
+	    self.codes.add(forces)
+	    comp.newpin("%s.%s" % (idx, forces), hal.HAL_BIT, hal.HAL_OUT)
 	
     def get(self, name):
 	name = "%s.%s" % (self.idx, name)