Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-camogm
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-camogm
Commits
076161cd
Commit
076161cd
authored
Mar 23, 2017
by
Mikhail Karpenko
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check compressors' state and get disk parameters before recording starts
parent
b2b27ca4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
camogm.c
src/camogm.c
+29
-17
No files found.
src/camogm.c
View file @
076161cd
...
@@ -166,6 +166,7 @@ static uint64_t get_disk_size(const char *name);
...
@@ -166,6 +166,7 @@ static uint64_t get_disk_size(const char *name);
static
int
get_sysfs_name
(
const
char
*
dev_name
,
char
*
sys_name
,
size_t
str_sz
,
int
type
);
static
int
get_sysfs_name
(
const
char
*
dev_name
,
char
*
sys_name
,
size_t
str_sz
,
int
type
);
static
int
get_disk_range
(
const
char
*
name
,
struct
range
*
rng
);
static
int
get_disk_range
(
const
char
*
name
,
struct
range
*
rng
);
static
int
set_disk_range
(
const
struct
range
*
rng
);
static
int
set_disk_range
(
const
struct
range
*
rng
);
static
void
get_disk_info
(
camogm_state
*
state
);
int
open_files
(
camogm_state
*
state
);
int
open_files
(
camogm_state
*
state
);
unsigned
long
getGPValue
(
unsigned
int
port
,
unsigned
long
GPNumber
);
unsigned
long
getGPValue
(
unsigned
int
port
,
unsigned
long
GPNumber
);
void
setGValue
(
unsigned
int
port
,
unsigned
long
GNumber
,
unsigned
long
value
);
void
setGValue
(
unsigned
int
port
,
unsigned
long
GNumber
,
unsigned
long
value
);
...
@@ -841,14 +842,24 @@ void camogm_set_ignore_fps(camogm_state *state, int d)
...
@@ -841,14 +842,24 @@ void camogm_set_ignore_fps(camogm_state *state, int d)
*/
*/
void
camogm_set_prefix
(
camogm_state
*
state
,
const
char
*
p
,
path_type
type
)
void
camogm_set_prefix
(
camogm_state
*
state
,
const
char
*
p
,
path_type
type
)
{
{
struct
range
rng
=
{
0
};
if
(
type
==
FILE_PATH
)
{
if
(
type
==
FILE_PATH
)
{
strncpy
(
state
->
path_prefix
,
p
,
sizeof
(
state
->
path_prefix
)
-
1
);
strncpy
(
state
->
path_prefix
,
p
,
sizeof
(
state
->
path_prefix
)
-
1
);
state
->
path_prefix
[
sizeof
(
state
->
path_prefix
)
-
1
]
=
'\0'
;
state
->
path_prefix
[
sizeof
(
state
->
path_prefix
)
-
1
]
=
'\0'
;
}
else
if
(
type
==
RAW_PATH
&&
(
strncmp
(
p
,
"/dev/"
,
5
)
==
0
))
{
}
else
if
(
type
==
RAW_PATH
&&
(
strncmp
(
p
,
"/dev/"
,
5
)
==
0
))
{
strncpy
(
state
->
rawdev
.
rawdev_path
,
p
,
sizeof
(
state
->
rawdev
.
rawdev_path
)
-
1
);
strncpy
(
state
->
rawdev
.
rawdev_path
,
p
,
sizeof
(
state
->
rawdev
.
rawdev_path
)
-
1
);
state
->
rawdev
.
rawdev_path
[
sizeof
(
state
->
rawdev
.
rawdev_path
)
-
1
]
=
'\0'
;
state
->
rawdev
.
rawdev_path
[
sizeof
(
state
->
rawdev
.
rawdev_path
)
-
1
]
=
'\0'
;
}
}
/**
* @brief Get disk size, first LBA, last LBA and save these parameters in state structure.
* @param[in] state a pointer to a structure containing current state
* @return None
*/
void
get_disk_info
(
camogm_state
*
state
)
{
struct
range
rng
=
{
0
};
state
->
rawdev
.
end_pos
=
get_disk_size
(
state
->
rawdev
.
rawdev_path
);
state
->
rawdev
.
end_pos
=
get_disk_size
(
state
->
rawdev
.
rawdev_path
);
if
(
state
->
rawdev
.
end_pos
==
0
)
{
if
(
state
->
rawdev
.
end_pos
==
0
)
{
state
->
rawdev_op
=
0
;
state
->
rawdev_op
=
0
;
...
@@ -865,7 +876,6 @@ void camogm_set_prefix(camogm_state *state, const char * p, path_type type)
...
@@ -865,7 +876,6 @@ void camogm_set_prefix(camogm_state *state, const char * p, path_type type)
}
else
{
}
else
{
D0
(
fprintf
(
debug_file
,
"ERROR: unable to get disk size and starting sector
\n
"
));
D0
(
fprintf
(
debug_file
,
"ERROR: unable to get disk size and starting sector
\n
"
));
}
}
}
}
}
/** @brief Set timescale @e d, default = 1,000,000 */
/** @brief Set timescale @e d, default = 1,000,000 */
...
@@ -1263,6 +1273,8 @@ int parse_cmd(camogm_state *state, FILE* npipe)
...
@@ -1263,6 +1273,8 @@ int parse_cmd(camogm_state *state, FILE* npipe)
}
}
// now cmd is trimmed, arg is NULL or a pointer to trimmed command arguments
// now cmd is trimmed, arg is NULL or a pointer to trimmed command arguments
if
(
strcmp
(
cmd
,
"start"
)
==
0
)
{
if
(
strcmp
(
cmd
,
"start"
)
==
0
)
{
check_compressors
(
state
);
get_disk_info
(
state
);
camogm_start
(
state
);
camogm_start
(
state
);
return
1
;
return
1
;
}
else
if
(
strcmp
(
cmd
,
"reset"
)
==
0
)
{
// will reset pointer to the last acquired frame (if any)
}
else
if
(
strcmp
(
cmd
,
"reset"
)
==
0
)
{
// will reset pointer to the last acquired frame (if any)
...
...
Mikhail Karpenko
@mikhail
mentioned in commit
df1c1959
·
May 12, 2017
mentioned in commit
df1c1959
mentioned in commit df1c1959282df9f5dc20dbcfc5632d20f470178f
Toggle commit list
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