[Bugs] #3059 UNSP: TA python sample for device i/o

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Fri Aug 26 19:42:17 EDT 2011


#3059: TA python sample for device i/o
------------------------------------------+---------------------------------
    Reporter:  tonyforster                |          Owner:  walter                     
        Type:  enhancement                |         Status:  new                        
    Priority:  Unspecified by Maintainer  |      Milestone:  Unspecified by Release Team
   Component:  Turtleart                  |        Version:  Unspecified                
    Severity:  Unspecified                |       Keywords:                             
Distribution:  Unspecified                |   Status_field:  Unconfirmed                
------------------------------------------+---------------------------------
 needs a few more examples


 #Copyright (c) 2010-11, Walter Bender, Tony Forster
 #
 # This  Python block returns with the brightness sensor value in the heap
 # a range of parameters can be measured, for example, substitute any of
 these strings
 # for the string in the program below
 #
 # /sys/devices/platform/olpc-battery.0/power_supply/olpc-
 battery/current_now
 # /sys/devices/platform/olpc-battery.0/power_supply/olpc-
 battery/voltage_now
 # /sys/devices/platform/dcon/backlight/dcon-bl/actual_brightness


 def myblock(tw, x):
 # ignores second argument
     fh  = open('/sys/devices/platform/olpc-ols.0/power_state')  #the light
 sensor
     string = fh.read()
     fh.close()
     tw.lc.heap.append(string)
 #append reading to heap


 # if you can work out how to use them:
 # accelerometer is /dev/input/event0, power button is /dev/input/event1,
 # lid switch is /dev/input/event2, ebook /dev/input/event3, headphone jack
 # /dev/input/event7, microphone jack /dev/input/event8 (doesn't ?),
 # rotate, cursor, and game pad keys
 # /dev/input/event10.

-- 
Ticket URL: <http://bugs.sugarlabs.org/ticket/3059>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list