-
×InformationNeed Windows 11 help?Check documents on compatibility, FAQs, upgrade information and available fixes.
Windows 11 Support Center. -
-
×InformationNeed Windows 11 help?Check documents on compatibility, FAQs, upgrade information and available fixes.
Windows 11 Support Center. -
- HP Community
- Notebooks
- Notebook Video, Display and Touch
- HP-Specter-x360-15-df0009nl brightness and auto screen rotat...

Create an account on the HP Community to personalize your profile and ask a question
Your account also allows you to connect with HP support faster, access a personal dashboard to manage all of your devices in one place, view warranty information, case status and more.
It has been a while since anyone has replied. Simply ask a new question if you would like to start the discussion again.
09-22-2019 01:45 PM
Product: HP-Specter-x360-15-df0009n
Operating System: Linux
Good morning,
I want to share this script I created for HP-Specter-x360-15-df0009nl.
Allows you to change the screen brightness and make it rotate automatically.
It must be executed when the window manager is started
I tested it with Kubuntu 19.4
HP-Spectre-x360-15-df0009nl.sh
#!/bin/bash
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
abs() {
[[ $[ $@ ] -lt 0 ]] && echo "$[ ($@) * -1 ]" || echo "$[ $@ ]"
}
statePrev="-":
buffer=1000000
while :
do
#-------------brightness
Current=$(cat /sys/class/backlight/intel_backlight/device/intel_backlight/brightness)
set=$(bc -l <<< "1 / (120000 / $Current)")
if [ $oldset = $set ]; then
echo ""
else
xrandr --output eDP-1 --brightness $set
oldset=$set
fi
#-------------orientation
angleX=$(cat /sys/bus/iio/devices/iio:device*/in_incli_x_raw)
angleY=$(cat /sys/bus/iio/devices/iio:device*/in_incli_y_raw)
ABSangleX=$(abs $angleX)
ABSangleY=$(abs $angleY)
#echo angleX $angleX
#echo angleY $angleY
#tmpval=$(bc -l <<< "$ABSangleX + $buffer")
tmpval=$((($ABSangleX + $buffer)))
if [ $ABSangleY -gt $tmpval ]; then
#echo "$ABSangleY > $tmpval"
if [ $angleY -gt 0 ]; then
state="left"
xinput set-prop "ELAN2514:00 04F3:2975 Pen (0)" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
xinput set-prop "SYNA327F:00 06CB:CD4F Touchpad" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
xinput set-prop 12 --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
else
state="right"
xinput set-prop "ELAN2514:00 04F3:2975 Pen (0)" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
xinput set-prop "SYNA327F:00 06CB:CD4F Touchpad" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
xinput set-prop 12 --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
fi
fi
#tmpval=$(bc -l <<< "$ABSangleX - $buffer")
tmpval=$((($ABSangleX - $buffer)))
if [ $ABSangleY -lt $tmpval ]; then
#echo "$ABSangleY < $tmpval"
if [ $angleX -gt 0 ]; then
#echo "$ABSangleY > 0"
state="normal"
xinput set-prop "ELAN2514:00 04F3:2975 Pen (0)" --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0
xinput set-prop "SYNA327F:00 06CB:CD4F Touchpad" --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0
xinput set-prop 12 --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0
else
state="inverted"
xinput set-prop "ELAN2514:00 04F3:2975 Pen (0)" --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
xinput set-prop "SYNA327F:00 06CB:CD4F Touchpad" --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
xinput set-prop 12 --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
fi
fi
#echo "current $state prev $statePrev "
if [ $state = $statePrev ]; then
echo ""
else
statePrev=$state
xrandr -o $state
fi
sleep 0.5
done
1 REPLY 1
09-23-2019 01:04 AM
this version solves the problem that sometimes a different id is assigned to the touchscreen
#!/bin/bash
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
abs() {
[[ $[ $@ ] -lt 0 ]] && echo "$[ ($@) * -1 ]" || echo "$[ $@ ]"
}
statePrev="-":
buffer=1000000
oldset=2;
#find touch id
touch=$(xinput | grep ELAN2514:00 |grep pointer|grep -v Pen)
id=`expr "$touch" : '.*id=\([0-9]*\)'`
echo "id touchscreen=$id"
while :
do
#-------------brightness
Current=$(cat /sys/class/backlight/intel_backlight/device/intel_backlight/brightness)
set=$(bc -l <<< "1 / (120000 / $Current)")
if [ $oldset = $set ]; then
echo "">/dev/null
else
xrandr --output eDP-1 --brightness $set
oldset=$set
fi
#-------------orientation
angleX=$(cat /sys/bus/iio/devices/iio:device*/in_incli_x_raw)
angleY=$(cat /sys/bus/iio/devices/iio:device*/in_incli_y_raw)
ABSangleX=$(abs $angleX)
ABSangleY=$(abs $angleY)
#echo angleX $angleX
#echo angleY $angleY
#tmpval=$(bc -l <<< "$ABSangleX + $buffer")
tmpval=$((($ABSangleX + $buffer)))
if [ $ABSangleY -gt $tmpval ]; then
#echo "$ABSangleY > $tmpval"
if [ $angleY -gt 0 ]; then
state="left"
xinput set-prop "ELAN2514:00 04F3:2975 Pen (0)" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
xinput set-prop "SYNA327F:00 06CB:CD4F Touchpad" --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
xinput set-prop $id --type=float "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
else
state="right"
xinput set-prop "ELAN2514:00 04F3:2975 Pen (0)" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
xinput set-prop "SYNA327F:00 06CB:CD4F Touchpad" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
xinput set-prop $id --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
fi
fi
#tmpval=$(bc -l <<< "$ABSangleX - $buffer")
tmpval=$((($ABSangleX - $buffer)))
if [ $ABSangleY -lt $tmpval ]; then
#echo "$ABSangleY < $tmpval"
if [ $angleX -gt 0 ]; then
#echo "$ABSangleY > 0"
state="normal"
xinput set-prop "ELAN2514:00 04F3:2975 Pen (0)" --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0
xinput set-prop "SYNA327F:00 06CB:CD4F Touchpad" --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0
xinput set-prop $id --type=float "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0
else
state="inverted"
xinput set-prop "ELAN2514:00 04F3:2975 Pen (0)" --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
xinput set-prop "SYNA327F:00 06CB:CD4F Touchpad" --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
xinput set-prop $id --type=float "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
fi
fi
#echo "current $state prev $statePrev "
if [ $state = $statePrev ]; then
echo "">/dev/null
else
statePrev=$state
xrandr -o $state
fi
sleep 0.5
done
Be alert for scammers posting fake support phone numbers and/or email addresses on the community.
If you think you have received a fake HP Support message, please report it to us by clicking on "Flag Post".
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.
Didn't find what you were looking for?
Ask the community
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the <a href="https://www8.hp.com/us/en/terms-of-use.html" class="udrlinesmall">Terms of Use</a> and <a href="/t5/custom/page/page-id/hp.rulespage" class="udrlinesmall"> Rules of Participation</a>.