Reply
Thread Tools
blubbi's Avatar
Posts: 288 | Thanked: 113 times | Joined on Dec 2009 @ Germany
#11
Originally Posted by noobmonkey View Post
not seen luxus, but can check later.
which light intensity? the screen brightness intensity should be in the code above.

(out on lunch, so not near a pc)
No I really mean light intensity of the ambient light recorded by the proximity sensor (or also called ambient light sensor).

If I can make the program react fast enough it might be possible to use it for such photos: http://gallery.olausson.de/v/20082211_-_wings_of_fire/

Since I want to try it again with a way sharper lense and some more experience it would be very nice if the N900 could trigger the Canon EOS 7D as soon as the match ignites. This would reduce the junk images tremendous :-)

Once I know how to read the ambient light intensity the rest should be straight forward ;-)

Cheers
blubbi
 

The Following User Says Thank You to blubbi For This Useful Post:
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#12
Originally Posted by Radicalz38 View Post
I have just managed to play with accelerometer so here's a simple script to output the phone's state.

Code:
from ctypes import *
import os
import sys
import time
from math import atan2
from pprint import pprint

xlib = cdll.LoadLibrary("libX11.so.6")
rr = cdll.LoadLibrary("libXrandr.so.2")

def out_rotate():
    f = open("/sys/class/i2c-adapter/i2c-3/3-001d/coord", 'r' )
    cdinate = [int(w) for w in f.readline().split()]
    f.close()
    return cdinate

print out_rotate()
time.sleep(1)
Why do you load X11 libraries to read from a file and write to the console? And lots of import?
 
blubbi's Avatar
Posts: 288 | Thanked: 113 times | Joined on Dec 2009 @ Germany
#13
Originally Posted by Joorin View Post
Why do you load X11 libraries to read from a file and write to the console? And lots of import?
I guess it is only en excerpt of a program.

Cheers
blubbi
 
Posts: 44 | Thanked: 89 times | Joined on Oct 2009
#14
Hi, am the author of the Luxus program.

I would like to help you and I will, but I seem to have temporary problems. My development PC just died and it will take some days to get it going again. Of course I have the backups but I can't easily access them right now.

Meanwhile I was going to just look at the source code package from the web: http://maemo.org/packages/source/vie...e/luxus/0.4-1/ and copy paste the relevant code lines here for reading the ambient light sensor, but that web address isn't working for me either.

Basically it's really simple, there's a special file somewhere in /proc/sys/dev/something/something that you read, it has the light sensor value in lux units. If you are able to fetch the source code, you can locate the exact path by finding where I am opening some file from a path like that.
 

The Following 2 Users Say Thank You to toninikkanen For This Useful Post:
blubbi's Avatar
Posts: 288 | Thanked: 113 times | Joined on Dec 2009 @ Germany
#15
Hej, no big deal, I'll check your source code (asap maemo is up again)
I could have come up with this idea myself... *stupid me*

Actually I plan to work out and extend this little tool with the developer of "shutter"
My first plan is to test the concept with this kind of photos:
http://gallery.olausson.de/v/20082211_-_wings_of_fire/

I got a new shiny lens (Canon EF 100mm 2.8L IS Macro) which is way sharper then the lens I made those photos.
The N900 combined with the new Lens some more experience and two new Canon flashes (Canon 580EX II) should yield more usable photos and reduces the "luck" in capturing the ignition point.
Hopefully the sensor will provide the data at a high enough freqency, so Ii I can poll the data at a high enough rate it could also be possible to capture lightnings like the CHDK scripts for compact cameras found here:
http://chdk.wikia.com/wiki/UBASIC/Sc...ghtning_Detect

Cheers
Bjoern
 

The Following User Says Thank You to blubbi For This Useful Post:
blubbi's Avatar
Posts: 288 | Thanked: 113 times | Joined on Dec 2009 @ Germany
#16
Here we go for the ambient light meter:

Code:
while true ; do cat /sys/class/i2c-adapter/i2c-2/2-0029/lux ; done
seems quite responsive ;-)

Thanks toninikkanen

Cheers
Bjoern
 

The Following User Says Thank You to blubbi For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#17
Originally Posted by blubbi View Post
Here we go for the ambient light meter:

Code:
while true ; do cat /sys/class/i2c-adapter/i2c-2/2-0029/lux ; done
seems quite responsive ;-)

Thanks toninikkanen

Cheers
Bjoern
Any idea what the Min/Max values are?
Allllllso.... whilst i'm in that folder, what are calib0 and calib1?

(Useful things for healthcheck )
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
blubbi's Avatar
Posts: 288 | Thanked: 113 times | Joined on Dec 2009 @ Germany
#18
Mmmh, I am now playing around with python-pyinotify to poll the file but it did not what I expected...

I get only a response for "process_IN_OPEN", "process_IN_ACCESS" and "process_IN_CLOSE_NOWRITE" but nothing for "process_IN_MODIFY"...

Any other ideas how to poll the file? Or should I build in a "only trigger event if value change caompared to last time"?

Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#

import os, time, pyinotify
import pyinotify

ambient_sensor = '/sys/class/i2c-adapter/i2c-2/2-0029/lux'

wm = pyinotify.WatchManager()  # Watch Manager
mask = pyinotify.ALL_EVENTS

def action(self, the_event):
    value = open(the_event.pathname, 'r').read().strip()
    return value

class EventHandler(pyinotify.ProcessEvent):
    def process_IN_ACCESS(self, event):
	print "ACCESS event:", action(self, event)

    def process_IN_ATTRIB(self, event):
	print "ATTRIB event:", action(self, event)

    def process_IN_CLOSE_NOWRITE(self, event):
	print "CLOSE_NOWRITE event:", action(self, event)

    def process_IN_CLOSE_WRITE(self, event):
	print "CLOSE_WRITE event:", action(self, event)

    def process_IN_CREATE(self, event):
	print "CREATE event:", action(self, event)

    def process_IN_DELETE(self, event):
	print "DELETE event:", action(self, event)

    def process_IN_MODIFY(self, event):
	print "MODIFY event:", action(self, event)

    def process_IN_OPEN(self, event):
	print "OPEN event:", action(self, event)
	

#log.setLevel(10)
notifier = pyinotify.ThreadedNotifier(wm, EventHandler())
notifier.start()

wdd = wm.add_watch(ambient_sensor, mask)
wdd
#wm.rm_watch(wdd.values())

time.sleep(5)
notifier.stop()
Cheers
Bjoern
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#19
Polling a file under /sys typically makes no sense. The files you find there act as handy nameholders for different parts of drivers and doing open + read + close makes the driver create the content on the fly.

So, do not view this as regular files but as something you can read from and get the latest value. There is often a library to use to do the same thing which might be faster since opening and reading from a file is a magnitude slower than performing one break into kernel space with an ioctl.
 

The Following 2 Users Say Thank You to Joorin For This Useful Post:
blubbi's Avatar
Posts: 288 | Thanked: 113 times | Joined on Dec 2009 @ Germany
#20
Originally Posted by Joorin View Post
Polling a file under /sys typically makes no sense. The files you find there act as handy nameholders for different parts of drivers and doing open + read + close makes the driver create the content on the fly.

So, do not view this as regular files but as something you can read from and get the latest value. There is often a library to use to do the same thing which might be faster since opening and reading from a file is a magnitude slower than performing one break into kernel space with an ioctl.
I guess my question is superfluous since you probably would have provided the info which lib to use, but:

Do you have a idea how I can access the file correctly?



Cheers
Bjoern
 
Reply


 
Forum Jump


All times are GMT. The time now is 08:39.