Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
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-web-393
Commits
bc8e3690
Commit
bc8e3690
authored
Feb 14, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed lba_end for 2TB SSD overflows integer - changed to float
parent
b56e6f93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
eyesis4pi_interface.php
src/eyesis4pi/eyesis4pi_interface.php
+31
-4
No files found.
src/eyesis4pi/eyesis4pi_interface.php
View file @
bc8e3690
...
@@ -44,6 +44,14 @@ $file_lba_current = $sysfs_lba_path."lba_current";
...
@@ -44,6 +44,14 @@ $file_lba_current = $sysfs_lba_path."lba_current";
$file_lba_end
=
$sysfs_lba_path
.
"lba_end"
;
$file_lba_end
=
$sysfs_lba_path
.
"lba_end"
;
switch
(
$cmd
){
switch
(
$cmd
){
case
"external_drive"
:
switch_sata_connection
(
"external"
);
echo
"
$cmd
ok"
;
break
;
case
"internal_drive"
:
switch_sata_connection
(
"internal"
);
echo
"
$cmd
ok"
;
break
;
case
"symlink"
:
case
"symlink"
:
if
(
is_link
(
$symlink
))
die
(
"already exists"
);
if
(
is_link
(
$symlink
))
die
(
"already exists"
);
die
(
symlink
(
$mountpoint
,
$symlink
));
die
(
symlink
(
$mountpoint
,
$symlink
));
...
@@ -61,11 +69,12 @@ switch($cmd){
...
@@ -61,11 +69,12 @@ switch($cmd){
$lba_current
=
0
;
$lba_current
=
0
;
$lba_end
=
0
;
$lba_end
=
0
;
if
(
is_file
(
$file_lba_start
))
$lba_start
=
in
tval
(
trim
(
file_get_contents
(
$file_lba_start
)));
if
(
is_file
(
$file_lba_start
))
$lba_start
=
floa
tval
(
trim
(
file_get_contents
(
$file_lba_start
)));
if
(
is_file
(
$file_lba_current
))
$lba_current
=
in
tval
(
trim
(
file_get_contents
(
$file_lba_current
)));
if
(
is_file
(
$file_lba_current
))
$lba_current
=
floa
tval
(
trim
(
file_get_contents
(
$file_lba_current
)));
if
(
is_file
(
$file_lba_end
))
$lba_end
=
in
tval
(
trim
(
file_get_contents
(
$file_lba_end
)));
if
(
is_file
(
$file_lba_end
))
$lba_end
=
floa
tval
(
trim
(
file_get_contents
(
$file_lba_end
)));
if
((
$lba_start
!=
0
)
&&
(
$lba_current
!=
0
)
&&
(
$lba_end
!=
0
)){
if
((
$lba_start
!=
0
)
&&
(
$lba_current
!=
0
)
&&
(
$lba_end
!=
0
)){
//$size = ((($lba_end>>10)&0x003fffff) - (($lba_current>>10)&0x003fffff))/2/1024;
$size
=
(
$lba_end
-
$lba_current
)
/
2
/
1024
/
1024
;
$size
=
(
$lba_end
-
$lba_current
)
/
2
/
1024
/
1024
;
$sda2
=
round
(
$size
,
2
);
$sda2
=
round
(
$size
,
2
);
$sda2
.=
"G"
;
$sda2
.=
"G"
;
...
@@ -143,5 +152,23 @@ switch($cmd){
...
@@ -143,5 +152,23 @@ switch($cmd){
default
:
default
:
print
(
"nothing has been done"
);
print
(
"nothing has been done"
);
}
}
function
switch_sata_connection
(
$mode
){
global
$mountpoint
;
exec
(
"umount
$mountpoint
"
);
exec
(
"rmmod ahci_elphel"
);
if
(
$mode
==
"external"
){
exec
(
"/usr/local/bin/x393sata_control.py set_zynq_esata"
);
}
else
if
(
$mode
==
"internal"
){
exec
(
"/usr/local/bin/x393sata_control.py set_zynq_ssd"
);
}
exec
(
"modprobe ahci_elphel >/dev/null 2>&1 &"
);
sleep
(
2
);
exec
(
"echo 1 > /sys/devices/soc0/amba@0/80000000.elphel-ahci/load_module"
);
}
?>
?>
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