Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
79ab1f8a
Commit
79ab1f8a
authored
Oct 12, 2012
by
Pierre Ynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
motion: fail if no sensor is available
Also proper fallback
parent
867738b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
28 deletions
+16
-28
modules/control/motionlib.c
modules/control/motionlib.c
+16
-28
No files found.
modules/control/motionlib.c
View file @
79ab1f8a
...
...
@@ -26,6 +26,7 @@
# include "config.h"
#endif
#include <assert.h>
#include <math.h>
#include <unistd.h>
...
...
@@ -46,7 +47,7 @@
struct
motion_sensors_t
{
enum
{
NO_SENSOR
,
HDAPS_SENSOR
,
AMS_SENSOR
,
APPLESMC_SENSOR
,
enum
{
HDAPS_SENSOR
,
AMS_SENSOR
,
APPLESMC_SENSOR
,
UNIMOTION_SENSOR
}
sensor
;
#ifdef HAVE_MACOS_UNIMOTION
enum
sms_hardware
unimotion_hw
;
...
...
@@ -69,41 +70,27 @@ motion_sensors_t *motion_create( vlc_object_t *obj )
return
NULL
;
}
if
(
access
(
"/sys/devices/platform/hdaps/position"
,
R_OK
)
==
0
)
if
(
access
(
"/sys/devices/platform/hdaps/position"
,
R_OK
)
==
0
&&
(
f
=
fopen
(
"/sys/devices/platform/hdaps/calibrate"
,
"r"
)
)
)
{
/* IBM HDAPS support */
f
=
fopen
(
"/sys/devices/platform/hdaps/calibrate"
,
"r"
);
if
(
f
)
{
motion
->
i_calibrate
=
fscanf
(
f
,
"(%d,%d)"
,
&
i_x
,
&
i_y
)
==
2
?
i_x
:
0
;
fclose
(
f
);
motion
->
sensor
=
HDAPS_SENSOR
;
}
else
{
motion
->
sensor
=
NO_SENSOR
;
}
motion
->
i_calibrate
=
fscanf
(
f
,
"(%d,%d)"
,
&
i_x
,
&
i_y
)
==
2
?
i_x
:
0
;
fclose
(
f
);
motion
->
sensor
=
HDAPS_SENSOR
;
}
else
if
(
access
(
"/sys/devices/ams/x"
,
R_OK
)
==
0
)
{
/* Apple Motion Sensor support */
motion
->
sensor
=
AMS_SENSOR
;
}
else
if
(
access
(
"/sys/devices/platform/applesmc.768/position"
,
R_OK
)
==
0
)
else
if
(
access
(
"/sys/devices/platform/applesmc.768/position"
,
R_OK
)
==
0
&&
(
f
=
fopen
(
"/sys/devices/platform/applesmc.768/calibrate"
,
"r"
)
)
)
{
/* Apple SMC (newer macbooks) */
/* Should be factorised with HDAPS */
f
=
fopen
(
"/sys/devices/platform/applesmc.768/calibrate"
,
"r"
);
if
(
f
)
{
motion
->
i_calibrate
=
fscanf
(
f
,
"(%d,%d)"
,
&
i_x
,
&
i_y
)
==
2
?
i_x
:
0
;
fclose
(
f
);
motion
->
sensor
=
APPLESMC_SENSOR
;
}
else
{
motion
->
sensor
=
NO_SENSOR
;
}
motion
->
i_calibrate
=
fscanf
(
f
,
"(%d,%d)"
,
&
i_x
,
&
i_y
)
==
2
?
i_x
:
0
;
fclose
(
f
);
motion
->
sensor
=
APPLESMC_SENSOR
;
}
#ifdef HAVE_MACOS_UNIMOTION
else
if
(
(
motion
->
unimotion_hw
=
detect_sms
())
)
...
...
@@ -112,7 +99,9 @@ motion_sensors_t *motion_create( vlc_object_t *obj )
else
{
/* No motion sensor support */
motion
->
sensor
=
NO_SENSOR
;
msg_Err
(
obj
,
"No motion sensor available"
);
free
(
motion
);
return
NULL
;
}
memset
(
motion
->
p_oldx
,
0
,
sizeof
(
motion
->
p_oldx
)
);
...
...
@@ -199,9 +188,8 @@ static int GetOrientation( motion_sensors_t *motion )
else
return
0
;
#endif
case
NO_SENSOR
:
default:
return
0
;
assert
(
0
)
;
}
}
...
...
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