-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added getedid script #968
Added getedid script #968
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first code review
Hope it is useful
@@ -0,0 +1,254 @@ | |||
#!/bin/sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add LE header
rm -fr /storage/.config/firmware | ||
sys_reboot | ||
else | ||
echo "You don't have a backup file for $file. You didn't used this script to create the custom EDID" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did not use
sys_reboot | ||
else | ||
echo "You don't have a backup file for $file. You didn't used this script to create the custom EDID" | ||
echo "Therefore we can't be sure the script working prooerly. Exiting" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is working properly
check_file() { | ||
# check boot system | ||
boot="$([ -d /sys/firmware/efi ] && echo UEFI || echo BIOS)" | ||
if [ "$boot" = "BIOS" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be clearer:
if -d... then
boot=... sys_path=...
else
boot=... sys_path=...
fi
|
||
#check which file is available | ||
if [ -f "$sys_path"/syslinux.cfg ] && [ -f "$sys_path"/extlinux.conf ];then | ||
echo "Your system contains both. A /flash/syslinux.cfg and a /flash/extlinux.conf file" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both a
check_content() { | ||
# check if changes are already made to $file and exit if yes | ||
if [ "$(grep "APPEND" $file)" = " APPEND boot=LABEL=System disk=LABEL=Storage ssh quiet" ]; then | ||
echo "You alread did some changes to $file. Exiting." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i do not understand, how can you know that the user made exactly these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK this is the standard content of the APPEND line after a fresh install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe != instead of = then, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True ;)
echo "You didn't created a custom EDID yet or you didn't use this script for this task." | ||
echo "Therefore we can't ensure the script working properly." | ||
echo "Exiting" | ||
exit 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you exit in rw mode, move mount_rw between if and else
mv /storage/.config/xorg.conf /storage/.config/xorg.le.backup | ||
else | ||
echo "You don't have a xorg.conf in your .config folder. Exiting" | ||
exit 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here, too: you exit in rw mode
sed -i 's/"ModeDebug" "true"/"ModeDebug" "false"/g' /storage/.config/xorg.conf | ||
|
||
# set port and uncomment lines | ||
sed -i "s/# Option \"ConnectedMonitor\" \"DFP-0\"/ Option \"ConnectedMonitor\" \"$nv_port\"/g" /storage/.config/xorg.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the seded lines invariable (they exist and are never edited)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lines I change by using sed can ofc be edited by the user before. But therefore I check if a xorg.conf already exists and exit if yes. If the user already did some changes to the xorg.conf, he's also able to do that a 2nd time ;) and then won't need that script
fi | ||
|
||
#check which file is available | ||
if [ -f "$sys_path"/syslinux.cfg ] && [ -f "$sys_path"/extlinux.conf ];then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"$sys_path"/syslinux.cfg
->"$sys_path/syslinux.cfg"
"$sys_path"/extlinux.conf
->"$sys_path/extlinux.conf"
and the same wherever this has been repeated. Presumably it works as it is, but I find it a little odd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, will do
Did some changes ^^ |
Don't forget to install the script... https://github.com/LibreELEC/LibreELEC.tv/blob/master/packages/sysutils/busybox/package.mk#L158-L165 |
You should also |
help() { | ||
echo "This script generates a custom EDID depending on your GPU" | ||
echo "" | ||
echo "To check which GPU you are using, use: ./getedid gpu" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming this script will eventually be on the users PATH, you shouldn't then instruct them to use ./getedid gpu
because this won't work - it assumes the script is in the users current directory, when it won't be.
Change all uses of ./getedid
to simply getedid
.
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>. | ||
+################################################################################ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two ++ here - cut & paste error? Please remove the "+" at the beginning of the line.
echo "" | ||
echo "To check which GPU you are using, use: ./getedid gpu" | ||
echo "" | ||
echo "To create a custon EDID, just use this script like: ./getedid start" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getedid start
is a little odd, what am I starting? Why not getedid create
as this is more in keeping with the other delete
and restore
options.
#check which output is connnected: | ||
for i in /sys/class/drm/*; do | ||
if [ "$(cat "$i"/status 2>/dev/null)" = "connected" ]; then | ||
hdmi="$(echo "$i" | cut -d / -f 5 | sed 's/card[0-9]-//g')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, you need to keep the card0-
prefix, at least on my Skylake, in which case you just need:
hdmi="$(basename "$i")"
|
||
#create edid | ||
mkdir -p /storage/.config/firmware/edid | ||
cat "/sys/class/drm/$hdmi/edid" > /storage/.config/firmware/edid/edid.bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Binary data... dunno, maybe use cp
instead?
|
||
# mounting /flash to rw | ||
mount_rw() { | ||
mount -o remout,rw /flash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remount
|
||
#remount /flash to rw | ||
mount_rw | ||
mv /storage/edid.cpio "$sys_path" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sys_path
isn't known at this point, you haven't called check_file
yet...
# check syslinux.cfg and/or extlinux.conf | ||
check_file() { | ||
# check boot system | ||
if [ -d /sys/firmware/efi]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a space before ]
.
fi | ||
|
||
#check which file is available | ||
if [ -f "$sys_path/syslinux.cfg" ] && [ -f "$sys_path/extlinux.conf" ];then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space between ;
and then
I'd also rewrite the condition thus:
if [ -f "$sys_path/syslinux.cfg" -a -f "$sys_path/extlinux.conf" ]; then
# check boot system | ||
if [ -d /sys/firmware/efi]; then | ||
boot="UEFI" | ||
sys_path="flash/EFI/BOOT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing /
- should be:
sys_path="/flash/EFI/BOOT"
For intel, are both |
changes done ^^ |
This is a newer version for the getedid script which contains the changes @MilhouseVH mentioned in the previous PR