Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
173420e8
Commit
173420e8
authored
May 30, 2008
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for applesmc motion sensors (macbooks) on linux. (Untested
since the sensor doesn't want to work on my laptop)
parent
74400291
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
5 deletions
+38
-5
modules/control/motion.c
modules/control/motion.c
+38
-5
No files found.
modules/control/motion.c
View file @
173420e8
...
...
@@ -49,7 +49,8 @@
*****************************************************************************/
struct
intf_sys_t
{
enum
{
NO_SENSOR
,
HDAPS_SENSOR
,
AMS_SENSOR
,
UNIMOTION_SENSOR
}
sensor
;
enum
{
NO_SENSOR
,
HDAPS_SENSOR
,
AMS_SENSOR
,
APPLESMC_SENSOR
,
UNIMOTION_SENSOR
}
sensor
;
#ifdef __APPLE__
enum
sms_hardware
unimotion_hw
;
#endif
...
...
@@ -76,6 +77,8 @@ vlc_module_begin();
set_shortname
(
N_
(
"motion"
));
set_category
(
CAT_INTERFACE
);
set_description
(
N_
(
"motion control interface"
)
);
set_help
(
N_
(
"Use HDAPS, AMS, APPLESMC or UNIMOTION motion sensors "
\
"to rotate the video"
)
)
add_bool
(
"motion-use-rotate"
,
0
,
NULL
,
USE_ROTATE_TEXT
,
USE_ROTATE_TEXT
,
false
);
...
...
@@ -121,6 +124,24 @@ int Open ( vlc_object_t *p_this )
/* Apple Motion Sensor support */
p_intf
->
p_sys
->
sensor
=
AMS_SENSOR
;
}
else
if
(
access
(
"/sys/devices/applesmc.768/position"
,
R_OK
)
==
0
)
{
/* Apple SMC (newer macbooks) */
/* Should be factorised with HDAPS */
f
=
fopen
(
"/sys/devices/applesmc.768/calibrate"
,
"r"
);
if
(
f
)
{
i_x
=
i_y
=
0
;
fscanf
(
f
,
"(%d,%d)"
,
&
i_x
,
&
i_y
);
fclose
(
f
);
p_intf
->
p_sys
->
i_calibrate
=
i_x
;
p_intf
->
p_sys
->
sensor
=
APPLESMC_SENSOR
;
}
else
{
p_intf
->
p_sys
->
sensor
=
NO_SENSOR
;
}
}
#ifdef __APPLE__
else
if
(
p_intf
->
p_sys
->
unimotion_hw
=
detect_sms
()
)
p_intf
->
p_sys
->
sensor
=
UNIMOTION_SENSOR
;
...
...
@@ -242,10 +263,8 @@ static void RunIntf( intf_thread_t *p_intf )
static
int
GetOrientation
(
intf_thread_t
*
p_intf
)
{
FILE
*
f
;
int
i_x
,
i_y
;
#ifdef __APPLE__
int
i_z
;
#endif
int
i_x
,
i_y
,
i_z
=
0
;
switch
(
p_intf
->
p_sys
->
sensor
)
{
case
HDAPS_SENSOR
:
...
...
@@ -272,6 +291,20 @@ static int GetOrientation( intf_thread_t *p_intf )
fclose
(
f
);
return
-
i_x
*
30
;
/* FIXME: arbitrary */
case
APPLESMC_SENSOR
:
f
=
fopen
(
"/sys/devices/applesmc.768/position"
,
"r"
);
if
(
!
f
)
{
return
0
;
}
i_x
=
i_y
=
i_z
=
0
;
fscanf
(
f
,
"(%d,%d,%d)"
,
&
i_x
,
&
i_y
,
&
i_z
);
fclose
(
f
);
return
(
i_x
-
p_intf
->
p_sys
->
i_calibrate
)
*
10
;
#ifdef __APPLE__
case
UNIMOTION_SENSOR
:
if
(
read_sms_raw
(
p_intf
->
p_sys
->
unimotion_hw
,
&
i_x
,
&
i_y
,
&
i_z
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment