Topic: multiple processes accessing he accelerometer

Have you considered modifying the driver so multiple process can open it, or perhaps have secondary devices that echo the data ( or maybe a /proc eatery that can be read by multiple procs in ascii )

the reason  suggest this is that the Control panel opens the device thus blocking access to any other processes on the device.

Re: multiple processes accessing he accelerometer

I'll send a note to the kernel team.

Re: multiple processes accessing he accelerometer

Hi Duane,

Any news on this?

Re: multiple processes accessing he accelerometer

Not that I know of - I'll ping again.

Re: multiple processes accessing he accelerometer

Thanks, Duane.

The reason why I ask is because, like others have posted, I have been using the accelerometer for "unsupported user configurations". On my Chumby, tilting to the left lowers volume, tiling to the right raises volume, down turns off the LCD, and up toggles between dim and bright (I have a 2008 Chumby).

But, unlike the "screen touch" hacks, hacking the accelerometer required making it unavailable to the Control Panel and thus unavailable to widgets and, of course, Control Panel features (squeeze and tilt for widget changing, for instance).

Anyway, it would be good if it looked like the "screen is being touched" file (I can't remember the name of this file off hand).

Regards,
Jose

Re: multiple processes accessing he accelerometer

One of the issues is that because of the "impact" support in the driver, the accelerometer is "kind of" and eventing mechanism, as opposed to a state.

This is an issue for sharing.  For instance, let's say you had a mouse driver that produced a stream of events for "mouse up", "mouse down", and these events were in a queue - reading the event from the driver removes it from the queue.  If you share this driver between two processes, then one process might get a "mouse up" event, but as a result, the second process doesn't get it since it's been removed from the queue.

I need to see if the accelerometer driver suffers from this issue - if so, that might explain why the original developer chose to make it not  shared.

Re: multiple processes accessing he accelerometer

josep wrote:

Anyway, it would be good if it looked like the "screen is being touched" file (I can't remember the name of this file off hand).

Ah - something I know (as there isn't much of that)... wink

The file you are after is /proc/chumby/touchscreen/coordinates

Re: multiple processes accessing he accelerometer

Hi Duane,

I see the dilema. I guess I was thinking of this file as a read only file. The "state" would be active for a fraction of a second. The user(s) of the file would have to pole the file to see change. This seems a like the same way you would use the /proc/chumby/touchscreen/coordinates (thanks PaperClippy) file. Am I missing something?

Jose

Re: multiple processes accessing he accelerometer

Hi There,

I hate to bump this, but I was wondering if anyone has looked into it.

I have become more dangerous (as far as compiling with the new toolchain, and building code) since the last time I posted, so if nobody has had a chance to look at it, can someone (Duane) point me to where in the code I could look to try to make the device driver output data (maybe not the driver itself) accessable to multiple procs?

Thanks,
Jose

Re: multiple processes accessing he accelerometer

The exclusivity is enforced in "linux-2.6.16/drivers/char/chumby_accel.c" in the "chumby_accel_open" and "chumby_accel_release" functions.

Re: multiple processes accessing he accelerometer

Wow! Thanks for the quick response. I take it yo uhave been looking at it? Does it seem doable?

Re: multiple processes accessing he accelerometer

I took a quick look when I saw your last post - I think it just takes commenting out a couple lines of code.

Re: multiple processes accessing he accelerometer

Hi Duane,

I found the place in the code you suggested. Indeed, it is very easy to change. Is it possible to change only chumby_accel.ko without having to update any of the other files? I'm afraid to brick my chumby if I create the k1 file with only the one ko file.

Thanks,
Jose

Re: multiple processes accessing he accelerometer

I'm pretty sure that this is a loadable kernel module, not compiled into the kernel, so replacing k1 won't work - you'd need to burn a new rfs1 with the module, and that's probably a bit extreme.

You'd just use rmmod to unload the original module, and insmod the new module for a dongle  Another, more tricky (and dangerous) approach is to put your new module on /psp and create a new rcS in /psp to load your module instead of ours.

Re: multiple processes accessing he accelerometer

Hi Duane,

I went the rcS route. As you predicted, the change was pretty minimal. I just had to comment the two lines of code in chumby_accel_open and everything worked as expected. I can now use the accelerometer while it is being used by the control panel.

I have to do a little testing with widgets that use it to see if they are badly affected. So far, I can change widgets using "squeeze and tilt" and still use the accelerometer (tilt back/forward) for turning the display dim/bright/off.

By the way, what is the right procedure for just building the .ko file? I was not sure so I pretty much built the entire firware with the new toolchain. Didn't take that long, but it was way more than I was interested in.

I will let you know.

Thanks,
Jose

Re: multiple processes accessing he accelerometer

I *think* you can compile single modules without building the entire kernel by using "make modules" and specifying the path to the subdirectory:

make SUBDIRS=drivers/the_module_directory modules

Re: multiple processes accessing he accelerometer

Hey Jose,

That kernel driver would be most welcome, if you have the time and/or inclination to post it somewhere or email it.

Brett

Re: multiple processes accessing he accelerometer

Hi Brett,

Sure. I was actually going to ask Duane if there was a place I could post it. I know he was setting up a repository for the users sometime back, but I don't know what happened with that.

By the way, my testing showed no adverse effect when allowing multiple procs to access the device. I tried all the widgets I could find that use the tilt sensor and found no trouble with them. I wrote a user script that checks the state of the tilt sensor every 500 or so ms in the background and reacts to changes (dim screen, change volume, etc.). Now my script,  as well as the control panel, can access the sensor with no notable effects to the control panel.

Seems to work just fine...

Duane: is there a place to post?

Thanks,
Jose

Re: multiple processes accessing he accelerometer

The code repository is at http://gforge.chumby.com/.

It uses a self-signed cert, so don't be too upset if your browser warns your about it.

20 (edited by josep 2009-05-24 14:07:17)

Re: multiple processes accessing he accelerometer

Hi Duane,

The repository does not seem to be working for me. It seems like the confirmation e-mail doesn't ever get sent. Can anyone here help?

Thanks,
Jose

Re: multiple processes accessing he accelerometer

IT will need to look into it on Tuesday/

Normally I get notification of a new project being registered, but I haven't seen one for yours.

22 (edited by josep 2009-05-24 14:07:50)

Re: multiple processes accessing he accelerometer

Hi Duane,

Thanks for looking into it. It's actually more fundamental than that. I don't get the user registration confirmation e-mail.

Regards,
Jose

Re: multiple processes accessing he accelerometer

Ah, well that's a problem.  I'm sure mdkail will be on top of it.

Re: multiple processes accessing he accelerometer

Did a compiled version of this modified module ever get posted anywhere?

Chumby Classic (White) user.  Be forewarned my comments reflect my knowledge of this device.