Changeset 173420e8c2bb2d4c20278dae3beebd2f6aaf52e5
- Timestamp:
- 30/05/08 13:27:31
(4 months ago)
- Author:
- Antoine Cellerier <dionoea@videolan.org>
- git-committer:
- Antoine Cellerier <dionoea@videolan.org> 1212146851 +0200
- git-parent:
[74400291c2e06e05e51f9e959b4149f25012543c]
- git-author:
- Antoine Cellerier <dionoea@videolan.org> 1212146740 +0200
- Message:
Add support for applesmc motion sensors (macbooks) on linux. (Untested
since the sensor doesn't want to work on my laptop)
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r13ae40b |
r173420e |
|
| 50 | 50 | struct intf_sys_t |
|---|
| 51 | 51 | { |
|---|
| 52 | | enum { NO_SENSOR, HDAPS_SENSOR, AMS_SENSOR, UNIMOTION_SENSOR } sensor; |
|---|
| | 52 | enum { NO_SENSOR, HDAPS_SENSOR, AMS_SENSOR, APPLESMC_SENSOR, |
|---|
| | 53 | UNIMOTION_SENSOR } sensor; |
|---|
| 53 | 54 | #ifdef __APPLE__ |
|---|
| 54 | 55 | enum sms_hardware unimotion_hw; |
|---|
| … | … | |
| 77 | 78 | set_category( CAT_INTERFACE ); |
|---|
| 78 | 79 | set_description( N_("motion control interface") ); |
|---|
| | 80 | set_help( N_("Use HDAPS, AMS, APPLESMC or UNIMOTION motion sensors " \ |
|---|
| | 81 | "to rotate the video") ) |
|---|
| 79 | 82 | |
|---|
| 80 | 83 | add_bool( "motion-use-rotate", 0, NULL, |
|---|
| … | … | |
| 121 | 124 | /* Apple Motion Sensor support */ |
|---|
| 122 | 125 | p_intf->p_sys->sensor = AMS_SENSOR; |
|---|
| | 126 | } |
|---|
| | 127 | else if( access( "/sys/devices/applesmc.768/position", R_OK ) == 0 ) |
|---|
| | 128 | { |
|---|
| | 129 | /* Apple SMC (newer macbooks) */ |
|---|
| | 130 | /* Should be factorised with HDAPS */ |
|---|
| | 131 | f = fopen( "/sys/devices/applesmc.768/calibrate", "r" ); |
|---|
| | 132 | if( f ) |
|---|
| | 133 | { |
|---|
| | 134 | i_x = i_y = 0; |
|---|
| | 135 | fscanf( f, "(%d,%d)", &i_x, &i_y ); |
|---|
| | 136 | fclose( f ); |
|---|
| | 137 | p_intf->p_sys->i_calibrate = i_x; |
|---|
| | 138 | p_intf->p_sys->sensor = APPLESMC_SENSOR; |
|---|
| | 139 | } |
|---|
| | 140 | else |
|---|
| | 141 | { |
|---|
| | 142 | p_intf->p_sys->sensor = NO_SENSOR; |
|---|
| | 143 | } |
|---|
| 123 | 144 | } |
|---|
| 124 | 145 | #ifdef __APPLE__ |
|---|
| … | … | |
| 243 | 264 | { |
|---|
| 244 | 265 | FILE *f; |
|---|
| 245 | | int i_x, i_y; |
|---|
| 246 | | #ifdef __APPLE__ |
|---|
| 247 | | int i_z; |
|---|
| 248 | | #endif |
|---|
| | 266 | int i_x, i_y, i_z = 0; |
|---|
| | 267 | |
|---|
| 249 | 268 | switch( p_intf->p_sys->sensor ) |
|---|
| 250 | 269 | { |
|---|
| … | … | |
| 273 | 292 | |
|---|
| 274 | 293 | return - i_x * 30; /* FIXME: arbitrary */ |
|---|
| | 294 | |
|---|
| | 295 | case APPLESMC_SENSOR: |
|---|
| | 296 | f = fopen( "/sys/devices/applesmc.768/position", "r" ); |
|---|
| | 297 | if( !f ) |
|---|
| | 298 | { |
|---|
| | 299 | return 0; |
|---|
| | 300 | } |
|---|
| | 301 | |
|---|
| | 302 | i_x = i_y = i_z = 0; |
|---|
| | 303 | fscanf( f, "(%d,%d,%d)", &i_x, &i_y, &i_z ); |
|---|
| | 304 | fclose( f ); |
|---|
| | 305 | |
|---|
| | 306 | return ( i_x - p_intf->p_sys->i_calibrate ) * 10; |
|---|
| | 307 | |
|---|
| 275 | 308 | #ifdef __APPLE__ |
|---|
| 276 | 309 | case UNIMOTION_SENSOR: |
|---|