mirror of
https://github.com/brain-hackers/brain-config.git
synced 2024-12-22 12:10:07 +09:00
Added support for pixel doubling using xrandr on x86.
This commit is contained in:
parent
9500dc0377
commit
7461512d3d
171
raspi-config
171
raspi-config
@ -288,11 +288,19 @@ do_overscan() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_pixdub() {
|
get_pixdub() {
|
||||||
FBW=$(get_config_var framebuffer_width $CONFIG)
|
if is_pi ; then
|
||||||
if [ $FBW -eq 0 ]; then
|
FBW=$(get_config_var framebuffer_width $CONFIG)
|
||||||
echo 1
|
if [ $FBW -eq 0 ]; then
|
||||||
|
echo 1
|
||||||
|
else
|
||||||
|
echo 0
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo 0
|
if [ -e /etc/profile.d/pd.sh ] ; then
|
||||||
|
echo 0
|
||||||
|
else
|
||||||
|
echo 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,28 +324,46 @@ do_pixdub() {
|
|||||||
else
|
else
|
||||||
RET=$1
|
RET=$1
|
||||||
fi
|
fi
|
||||||
if [ $RET -eq 0 ] ; then
|
if is_pi ; then
|
||||||
XVAL=$(xrandr 2>&1 | grep current | cut -f2 -d, | cut -f3 -d' ')
|
if [ $RET -eq 0 ] ; then
|
||||||
YVAL=$(xrandr 2>&1 | grep current | cut -f2 -d, | cut -f5 -d' ')
|
XVAL=$(xrandr 2>&1 | grep current | cut -f2 -d, | cut -f3 -d' ')
|
||||||
if is_number $XVAL || is_number $YVAL ; then
|
YVAL=$(xrandr 2>&1 | grep current | cut -f2 -d, | cut -f5 -d' ')
|
||||||
if [ "$INTERACTIVE" = True ]; then
|
if is_number $XVAL || is_number $YVAL ; then
|
||||||
whiptail --msgbox "Could not read current screen dimensions - unable to enable pixel doubling" 20 60 1
|
if [ "$INTERACTIVE" = True ]; then
|
||||||
fi
|
whiptail --msgbox "Could not read current screen dimensions - unable to enable pixel doubling" 20 60 1
|
||||||
return 1
|
fi
|
||||||
fi
|
return 1
|
||||||
NEWX=`expr $XVAL / 2`
|
fi
|
||||||
NEWY=`expr $YVAL / 2`
|
NEWX=`expr $XVAL / 2`
|
||||||
set_config_var framebuffer_width $NEWX $CONFIG
|
NEWY=`expr $YVAL / 2`
|
||||||
set_config_var framebuffer_height $NEWY $CONFIG
|
set_config_var framebuffer_width $NEWX $CONFIG
|
||||||
set_config_var scaling_kernel 8 $CONFIG
|
set_config_var framebuffer_height $NEWY $CONFIG
|
||||||
STATUS=enabled
|
set_config_var scaling_kernel 8 $CONFIG
|
||||||
elif [ $RET -eq 1 ]; then
|
STATUS=enabled
|
||||||
clear_config_var framebuffer_width $CONFIG
|
elif [ $RET -eq 1 ]; then
|
||||||
clear_config_var framebuffer_height $CONFIG
|
clear_config_var framebuffer_width $CONFIG
|
||||||
clear_config_var scaling_kernel $CONFIG
|
clear_config_var framebuffer_height $CONFIG
|
||||||
STATUS=disabled
|
clear_config_var scaling_kernel $CONFIG
|
||||||
|
STATUS=disabled
|
||||||
|
else
|
||||||
|
return $RET
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
return $RET
|
if [ -e /etc/profile.d/pd.sh ] ; then
|
||||||
|
rm /etc/profile.d/pd.sh
|
||||||
|
fi
|
||||||
|
if [ $RET -eq 0 ] ; then
|
||||||
|
DEV=$(xrandr | grep -w connected | cut -f1 -d' ')
|
||||||
|
for item in $DEV
|
||||||
|
do
|
||||||
|
echo xrandr --output $item --scale 0.5x0.5 >> /etc/profile.d/pd.sh
|
||||||
|
done
|
||||||
|
STATUS=enabled
|
||||||
|
elif [ $RET -eq 1 ]; then
|
||||||
|
STATUS=disabled
|
||||||
|
else
|
||||||
|
return $RET
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $RET -eq $CURRENT ]; then
|
if [ $RET -eq $CURRENT ]; then
|
||||||
ASK_TO_REBOOT=1
|
ASK_TO_REBOOT=1
|
||||||
@ -1653,35 +1679,31 @@ do_internationalisation_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_interface_menu() {
|
do_interface_menu() {
|
||||||
if ! is_pi ; then
|
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
|
||||||
do_ssh
|
"P1 Camera" "Enable/Disable connection to the Raspberry Pi Camera" \
|
||||||
else
|
"P2 SSH" "Enable/Disable remote command line access to your Pi using SSH" \
|
||||||
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
|
"P3 VNC" "Enable/Disable graphical remote access to your Pi using RealVNC" \
|
||||||
"P1 Camera" "Enable/Disable connection to the Raspberry Pi Camera" \
|
"P4 SPI" "Enable/Disable automatic loading of SPI kernel module" \
|
||||||
"P2 SSH" "Enable/Disable remote command line access to your Pi using SSH" \
|
"P5 I2C" "Enable/Disable automatic loading of I2C kernel module" \
|
||||||
"P3 VNC" "Enable/Disable graphical remote access to your Pi using RealVNC" \
|
"P6 Serial" "Enable/Disable shell and kernel messages on the serial connection" \
|
||||||
"P4 SPI" "Enable/Disable automatic loading of SPI kernel module" \
|
"P7 1-Wire" "Enable/Disable one-wire interface" \
|
||||||
"P5 I2C" "Enable/Disable automatic loading of I2C kernel module" \
|
"P8 Remote GPIO" "Enable/Disable remote access to GPIO pins" \
|
||||||
"P6 Serial" "Enable/Disable shell and kernel messages on the serial connection" \
|
3>&1 1>&2 2>&3)
|
||||||
"P7 1-Wire" "Enable/Disable one-wire interface" \
|
RET=$?
|
||||||
"P8 Remote GPIO" "Enable/Disable remote access to GPIO pins" \
|
if [ $RET -eq 1 ]; then
|
||||||
3>&1 1>&2 2>&3)
|
return 0
|
||||||
RET=$?
|
elif [ $RET -eq 0 ]; then
|
||||||
if [ $RET -eq 1 ]; then
|
case "$FUN" in
|
||||||
return 0
|
P1\ *) do_camera ;;
|
||||||
elif [ $RET -eq 0 ]; then
|
P2\ *) do_ssh ;;
|
||||||
case "$FUN" in
|
P3\ *) do_vnc ;;
|
||||||
P1\ *) do_camera ;;
|
P4\ *) do_spi ;;
|
||||||
P2\ *) do_ssh ;;
|
P5\ *) do_i2c ;;
|
||||||
P3\ *) do_vnc ;;
|
P6\ *) do_serial ;;
|
||||||
P4\ *) do_spi ;;
|
P7\ *) do_onewire ;;
|
||||||
P5\ *) do_i2c ;;
|
P8\ *) do_rgpio ;;
|
||||||
P6\ *) do_serial ;;
|
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
|
||||||
P7\ *) do_onewire ;;
|
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
|
||||||
P8\ *) do_rgpio ;;
|
|
||||||
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
|
|
||||||
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1783,10 +1805,11 @@ if [ "$INTERACTIVE" = True ]; then
|
|||||||
else
|
else
|
||||||
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \
|
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \
|
||||||
"1 Change User Password" "Change password for the current user" \
|
"1 Change User Password" "Change password for the current user" \
|
||||||
"2 Hostname" "Set the visible name for this PC on a network" \
|
"2 Network Options" "Configure network settings" \
|
||||||
"3 Boot Options" "Configure options for start-up" \
|
"3 Boot Options" "Configure options for start-up" \
|
||||||
"4 Localisation Options" "Set up language and regional settings to match your location" \
|
"4 Localisation Options" "Set up language and regional settings to match your location" \
|
||||||
"5 SSH" "Enable/Disable remote command line access to your PC using SSH" \
|
"5 SSH" "Enable/Disable remote command line access to your PC using SSH" \
|
||||||
|
"6 Pixel Doubling" "Enable/Disable 2x2 pixel mapping" \
|
||||||
"8 Update" "Update this tool to the latest version" \
|
"8 Update" "Update this tool to the latest version" \
|
||||||
"9 About raspi-config" "Information about this configuration tool" \
|
"9 About raspi-config" "Information about this configuration tool" \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
@ -1795,18 +1818,32 @@ if [ "$INTERACTIVE" = True ]; then
|
|||||||
if [ $RET -eq 1 ]; then
|
if [ $RET -eq 1 ]; then
|
||||||
do_finish
|
do_finish
|
||||||
elif [ $RET -eq 0 ]; then
|
elif [ $RET -eq 0 ]; then
|
||||||
case "$FUN" in
|
if is_pi ; then
|
||||||
1\ *) do_change_pass ;;
|
case "$FUN" in
|
||||||
2\ *) do_network_menu ;;
|
1\ *) do_change_pass ;;
|
||||||
3\ *) do_boot_menu ;;
|
2\ *) do_network_menu ;;
|
||||||
4\ *) do_internationalisation_menu ;;
|
3\ *) do_boot_menu ;;
|
||||||
5\ *) do_interface_menu ;;
|
4\ *) do_internationalisation_menu ;;
|
||||||
6\ *) do_overclock ;;
|
5\ *) do_interface_menu ;;
|
||||||
7\ *) do_advanced_menu ;;
|
6\ *) do_overclock ;;
|
||||||
8\ *) do_update ;;
|
7\ *) do_advanced_menu ;;
|
||||||
9\ *) do_about ;;
|
8\ *) do_update ;;
|
||||||
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
|
9\ *) do_about ;;
|
||||||
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
|
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
|
||||||
|
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
|
||||||
|
else
|
||||||
|
case "$FUN" in
|
||||||
|
1\ *) do_change_pass ;;
|
||||||
|
2\ *) do_network_menu ;;
|
||||||
|
3\ *) do_boot_menu ;;
|
||||||
|
4\ *) do_internationalisation_menu ;;
|
||||||
|
5\ *) do_ssh ;;
|
||||||
|
6\ *) do_pixdub ;;
|
||||||
|
8\ *) do_update ;;
|
||||||
|
9\ *) do_about ;;
|
||||||
|
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
|
||||||
|
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user