[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ANN: apple motion sensor reverse engineered



On Fri, 2005-08-26 at 12:16 +0200, Stelian Pop wrote:
> Le vendredi 19 août 2005 à 13:21 +0200, Johannes Berg a écrit :
> 
> > Hi,
> > 
> > I have successfully reverse engineered the AMS
> [...]
> > Have fun. Maybe I'll see a real driver that can even handle interrupts
> > (I have no idea how to get the interrupt GPIO stuff from the PROM/OF)
> > when I get back online after the weekend? ;)
> 
> Well, it took a bit longer since I was taking some days off :)
> 
> An initial working implementation (_with_ interrupts) is available at:
> 	http://www.popies.net/ams/
> 
> This version does not implement an input device but makes the x/y/z
> values available through /sys attributes (/sys/devices/ams/{x,y,z}).
> I'm not sure the input device is really useful.

To play neverball :)

> Also missing from the code is the action to take when an interrupt is
> detected (currently it only prints a message). Should it park the hard
> drive heads like OSX does (and if yes, how to do that ?) ? Or should the
> action be configurable ? (something like telling the driver what
> userspace program to launch when the freefall/shock is detected. But I
> fear that in the freefall case it will take too long for the program to
> execute and the shock will happen before the drive heads were safely
> parked).

Probably some kind of system wide notifier that the IDE driver can hook
on, or maybe temporarily a special hook in ide-pmac. I can write it, but
I first want to discuss that with others. We also need to block the
queue to make sure no request unparks it during free fall and unlock it
when coming back from free fall :) The IDE driver has some facilities
for doing those things via power management that I might be able to hook
on.

> The driver could also be enhanced by adding some /sys attributes to set
> the thresholds, enable/disable the device etc. 
> 
> Comments are welcomed.
> 
> Stelian.
> -- 
> Stelian Pop <stelian@popies.net>
> 
> 



Reply to: