You are not logged in.

#1 2021-11-22 10:31:56

dlk
Member
Registered: 2021-02-26
Posts: 25

Dell xps 13 2 in 1 (7390) detecting tablet mode

I am running on arch with dwm (heavily modified in order to be usable in tablet mode) and i am trying to automate the opening and closing of onboard (a virtual keyboard). In order to detect the "tabletness" of the laptop i decided to watch into udev and i noticed that while turning around the lid are fired some events regarding thermal something
output of udevadm monitor -up (meaning only udev events not kernel ones and showing properties)

UDEV  [154.714375] change   /devices/virtual/thermal/thermal_zone0 (thermal)
ACTION=change
DEVPATH=/devices/virtual/thermal/thermal_zone0
SUBSYSTEM=thermal
NAME=INT3400 Thermal
TEMP=-274000
TRIP=
EVENT=6
SEQNUM=4449
USEC_INITIALIZED=154714132

the problem is that when i change from laptop to tablet mode two of these are fired and the same is the other way around.
My question is how can use these events to do what i want?
As of right now i added a udev rule like this:

ACTION=="change", SUBSYSTEM=="thermal", DEVPATH=="/devices/virtual/thermal/thermal_zone0", RUN+="/home/mattia/.scripts/autonboard"

where the autonboard script contains this:

#! /bin/sh
ciao=$(ps -e | grep " onboard" | awk '{print $1}')
echo $ciao
[[ $ciao > 0 ]] && kill -9 $ciao  || onboard&

but since this is run twice during the "mode change" the end result is that onboard is killed in tablet mode
thx in advance for the help
PS: sorry for the shitty english but it isnt my first language and i am quite tired right now wink
PPS: i excluded kernel events because they are identical to the udev ones

Last edited by dlk (2021-11-22 10:43:38)

Offline

#2 2021-11-22 10:39:59

dlk
Member
Registered: 2021-02-26
Posts: 25

Re: Dell xps 13 2 in 1 (7390) detecting tablet mode

full output of udevadm monitor -up from laptop (around 100 degrees) to tablet (360 degrees):

monitor will print the received events for:
UDEV - the event which udev sends out after rule processing

UDEV  [1429.304440] change   /devices/virtual/thermal/thermal_zone0 (thermal)
ACTION=change
DEVPATH=/devices/virtual/thermal/thermal_zone0
SUBSYSTEM=thermal
NAME=INT3400 Thermal
TEMP=-274000
TRIP=
EVENT=6
SEQNUM=4478
USEC_INITIALIZED=1429304206

UDEV  [1432.954850] change   /devices/virtual/thermal/thermal_zone0 (thermal)
ACTION=change
DEVPATH=/devices/virtual/thermal/thermal_zone0
SUBSYSTEM=thermal
NAME=INT3400 Thermal
TEMP=-274000
TRIP=
EVENT=6
SEQNUM=4479
USEC_INITIALIZED=1432954693

the first event is fired around 180 degs
the degs are referring to how much the lid is open (0= fully closed 360=fully opened(the back of the lid touching the back of the laptop body))

Last edited by dlk (2021-11-22 10:46:03)

Offline

Board footer

Powered by FluxBB