Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-php-extension
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-php-extension
Commits
dd32d2b0
Commit
dd32d2b0
authored
Sep 29, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handling missing sesnors on porft 0
parent
7dbb2566
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
elphel_php.c
src/ext/elphel/elphel_php.c
+7
-3
No files found.
src/ext/elphel/elphel_php.c
View file @
dd32d2b0
...
...
@@ -2378,7 +2378,7 @@ static void php_elphel_init_globals(zend_elphel_globals *elphel_globals)
DEV393_PATH
(
DEV393_EXIF_META2
),
DEV393_PATH
(
DEV393_EXIF_META3
)};
//DEV393_PATH(DEV393_CIRCBUF0
int
total_hist_entries
;
int
i
;
int
port
;
//! open "/dev/sensorpars" and mmap array - only once
for
(
port
=
0
;
port
<
SENSOR_PORTS
;
port
++
){
...
...
@@ -2435,12 +2435,16 @@ static void php_elphel_init_globals(zend_elphel_globals *elphel_globals)
php_error_docref
(
NULL
TSRMLS_CC
,
E_ERROR
,
"Can not open file %s"
,
DEV393_PATH
(
DEV393_HISTOGRAM
));
return
;
}
total_hist_entries
=
lseek
(
elphel_globals
->
fd_histogram_cache
,
LSEEK_HIST_SET_CHN
+
0
,
SEEK_END
);
/// specify port/sub-channel is needed
for
(
i
=
0
;
i
<
16
;
i
++
)
{
// Channel 0 is not always present (lseek returns -1)
total_hist_entries
=
lseek
(
elphel_globals
->
fd_histogram_cache
,
LSEEK_HIST_SET_CHN
+
i
,
SEEK_END
);
/// specify port/sub-channel is needed
if
(
total_hist_entries
>
0
)
break
;
}
//! now try to mmap
elphel_globals
->
histogram_cache
=
(
struct
histogram_stuct_t
*
)
mmap
(
0
,
sizeof
(
struct
histogram_stuct_t
)
*
total_hist_entries
,
PROT_READ
,
MAP_SHARED
,
elphel_globals
->
fd_histogram_cache
,
0
);
if
((
int
)
elphel_globals
->
histogram_cache
==
-
1
)
{
elphel_globals
->
histogram_cache
=
NULL
;
php_error_docref
(
NULL
TSRMLS_CC
,
E_ERROR
,
"Error in mmap histogram_cache
"
);
php_error_docref
(
NULL
TSRMLS_CC
,
E_ERROR
,
"Error in mmap histogram_cache
, total_hist_entries=0x%x"
,
total_hist_entries
);
close
(
elphel_globals
->
fd_histogram_cache
);
elphel_globals
->
fd_histogram_cache
=
-
1
;
return
;
...
...
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