Jump to content
5 posts in this topic

Recommended Posts

Hello,

i have worked with a real Mac , it´s has very cool Programs like "iAlertU" or "SeisMac".

 

I have a Hackintosh Installation on my Lenovo Thinkpad T61, it´s works very good. But I know that the Notebook have a "Sudden Motion Sensor" like a MAC but a different Device.

 

I have searched for Drivers for Mac but I dont found it. I found only Driver for Linux and Windows

 

I think it is Possible to make it Works on MAC, here very Interesting Link :

 

http://www.almaden.ibm.com/cs/people/marksmith/sdl.html

 

On the Site writes :

 

Mac OS X

Similar changes can be made to SDL for the accelerometers in Macintoshes. However, the interface to the accelerometer in such machines is not public. Amit Singh, of kernelthread.com will be releasing his source for The Apple Motion Sensor As a Human Interface Device with his book, Mac OS X Internals. That code should be easily adaptable for SDL. It is also interesting to note that the Macintoshes' accelerometers measure and expose X, Y, and Z (or vertical) acceleration components, making "jump when I jump" style game-play possible

 

 

Here this is from a Another Site that tells the Hardware Names :

 

  • IBM / Lenovo: Analog Devices model ADXL320 two-axis accelerometer chip, with dynamic range of +/- 5g and bandwidth upto 2.5kHz
  • Apple: Kionix KXM52-1050 three-axis accelerometer chip, with dynamic range of +/- 2g and bandwidth up to 1.5KHz

 

Link : http://www.notebookreview.com/default.asp?newsID=3486

 

 

I have Read about IBM´s sensor.dll , but I dont found it and I searched only in the Internet

but a Coder has write a "Example" from the .dll , Im not really sure but I think it´s the Source code from the dll ?! right? :

 

Application :

 

--readaps.c

 

   // Small Example to read the APS (g-sensor) chip on thinkpads on Windows.

  #define _WIN32_WINNT 0x0500
  #include <windows.h>

  #include "Sensor.h"


  int CALLBACK WinMain(HINSTANCE a, HINSTANCE s, LPSTR d, int f) {
   xACCEL accData;
   ShockproofGetAccelerometerData(&accData);
   printf("Status: %d  \n",accData.status);
   printf("x:  %d, y:  %d \n",accData.x,accData.y);
   printf("xx: %d, yy: %d \n",accData.xx,accData.yy);
   printf("x0: %d, y0: %d \n",accData.x0,accData.y0);
   printf("temp: %d \n",accData.temp);
   return 0;
  }

 

-----------------

 

 

--sensor.h

 

// Example Header file for "Sensor.dll" on Thinkpads

  // Information gathered from multiple Webpages including:
  // http://www.hirax.net/misc/misc/sensor.txt
  // http://www-03.ibm.com/developerworks/blogs/page/johnston?entry=python_and_thinkpad
  // http://www.chronosilence.org/my.blog/posterity/hacks/thinkpad-aps.grey

  typedef struct {
   INT status; // Current internal state
   USHORT x; // raw value
   USHORT y; // raw value
   USHORT xx; // avg. of 40ms
   USHORT yy; // avg. of 40ms
   CHAR temp; // raw value (could be deg celsius?)
   USHORT x0; // Used for "auto-center"
   USHORT y0; // Used for "auto-center" 
  } xACCEL,*xLPACCEL;

  /* Status: (based on observation)
   0:   unmoved, ok
   1-4: recently moved, currently unmoved
   6-7: disk parked due to movements.
   11:  disk unparked due to repeated movements, ignoring further movements.
   12:  ignoring movements temporarily due to user request (via HDAPS settings)
  *(

  /*
  x_normalized = ( x - avg_x_when_flat ) / ( max_x - avg_x_when_flat )
  radians_x = arcsine ( x_normalized )
  degrees_x = radians_x * 180 / PI
*/

  VOID ShockproofGetAccelerometerData(xLPACCEL accData);

  typedef struct {
   int status;
  } ShockStatus;
  /*
  STATUS_RUNNING = range(0, 4)
  STATUS_STOPPED = range(8, 9)
  STATUS_AUTO_IGNORE = range(13, 13)
*/

  VOID ShockproofGetShockStatus(ShockStatus * shockStatus);

  #ifdef NOTYET
  VOID ShockproofGetVersion(char * string1,char * string2);
  // No params
  VOID ShockproofGetAccelerometerMutex();
  VOID ShockproofReleaseAccelerometerMutex();
  VOID ShockproofInvokeSnooze();
  #endif

  #ifdef NOTDEF
  Ordinal		 Address		 Name
  00000001	 10001960	 ShockproofCallSMAPIBIOS
  00000002	 10001310	 ShockproofControl
  00000003	 100018D0	 ShockproofEnableDisableSnooze
  00000004	 100015E0	 ShockproofGetAccelerometerData	 
  00000005	 10001640	 ShockproofGetAccelerometerDataEx
  00000006	 10001560	 ShockproofGetAccelerometerMutex
  00000007	 100012B0	 ShockproofGetAutoDisable
  00000008	 100014F0	 ShockproofGetShockStatus
  00000009	 10001500	 ShockproofGetSlaveCPUinfo
  0000000A	 10001480	 ShockproofGetUnloadCnt
  0000000B	 10001360	 ShockproofGetVersion
  0000000C	 10001B30	 ShockproofInformMouseDevChange
  0000000D	 100019C0	 ShockproofInformPENevent
  0000000E	 100016A0	 ShockproofInformPMevent
  0000000F	 10001A20	 ShockproofInformTabletLIDstate
  00000010	 10001810	 ShockproofInvokeSnooze
  00000011	 10001780	 ShockproofManualSensitivitySetting
  00000012	 100015B0	 ShockproofReleaseAccelerometerMutex
  00000013	 10001270	 ShockproofSetAutoDisable
  00000014	 10001840	 ShockproofSnoozeSetting
  00000015	 100016D0	 ShockproofTaskComplete
  #endif

 

 

 

-------

 

--Sensor.def

 

   EXPORTS
  ShockproofCallSMAPIBIOS
  ShockproofControl
  ShockproofEnableDisableSnooze
  ShockproofGetAccelerometerData
  ShockproofGetAccelerometerDataEx
  ShockproofGetAccelerometerMutex
  ShockproofGetAutoDisable
  ShockproofGetShockStatus
  ShockproofGetSlaveCPUinfo
  ShockproofGetUnloadCnt
  ShockproofGetVersion
  ShockproofInformMouseDevChange
  ShockproofInformPENevent
  ShockproofInformPMevent
  ShockproofInformTabletLIDstate
  ShockproofInvokeSnooze
  ShockproofManualSensitivitySetting
  ShockproofReleaseAccelerometerMutex
  ShockproofSetAutoDisable
  ShockproofSnoozeSetting
  ShockproofTaskComplete

 

-------

 

--Makefile

 

   all: ReadAps.exe

  libSensor.a: Sensor.def
   dlltool --dllname Sensor.dll --def Sensor.def --output-lib libSensor.a -k

  ReadAps.exe: libSensor.a readaps.o
   ${CC} -o ReadAps.exe readaps.o -L. -lSensor

  readaps.o: Sensor.h

  clean:
   rm -f libSensor.a ReadAps.exe readaps.o

 

 

 

My Programming Skills are Bad but i understand the base things (I learn it )

 

I hope Some Coders are interessted on this, I hope some people make MAC Driver for this that "we" the IBM/LENOVO Notebook users with Hacintosh use and feel the Sensor. Like .... a Mac!

 

Please hold this Thread "alive"

 

Bye

SameX

Link to comment
https://www.insanelymac.com/forum/topic/154914-motion-sensor-for-ibmlenovo/
Share on other sites

  • 1 month later...
  • 1 year later...
×
×
  • Create New...