Skip to content

Commit

Permalink
#89 removed shell=True / factorize arguments for shell because secutr…
Browse files Browse the repository at this point in the history
…ity reasons
  • Loading branch information
ldrahnik committed Feb 11, 2023
1 parent 949c9b4 commit e651a4c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions asus_touchpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,12 @@ def config_get(key, key_default):
def send_value_to_touchpad_via_i2c(value):
global device_id

cmd = ["i2ctransfer -f -y " + device_id + " w13@0x15 0x05 0x00 0x3d 0x03 0x06 0x00 0x07 0x00 0x0d 0x14 0x03 " + value + " 0xad"]
cmd = ["i2ctransfer", "-f", "-y", device_id, "w13@0x15", "0x05", "0x00", "0x3d", "0x03", "0x06", "0x00", "0x07", "0x00", "0x0d", "0x14", "0x03", value, "0xad"]

try:
subprocess.call(cmd, shell=True)
except OSError as e:
log.error('Error during sending via i2c: \"%s\"', cmd)
pass
subprocess.call(cmd)
except subprocess.CalledProcessError as e:
log.error('Error during sending via i2c: \"%s\"', e.output)


def parse_value_from_config(value):
Expand Down Expand Up @@ -341,7 +340,8 @@ def is_device_enabled(device_name):
try:
getting_device_status_failure_count = 0

propData = subprocess.check_output(['xinput', '--list-props', device_name])
cmd = ['xinput', '--list-props', device_name]
propData = subprocess.check_output(cmd)
propData = propData.decode()

for line in propData.splitlines():
Expand Down Expand Up @@ -485,9 +485,9 @@ def set_touchpad_prop_tap_to_click(value):
global touchpad_name

try:
cmd = "xinput set-prop '" + touchpad_name + "' 'libinput Tapping Enabled' " + str(value)
cmd = ["xinput", "set-prop", touchpad_name, 'libinput Tapping Enabled', str(value)]
log.debug(cmd)
subprocess.check_output(cmd, shell=True)
subprocess.check_output(cmd)
except subprocess.CalledProcessError as e:
log.error(e.output)

Expand Down

0 comments on commit e651a4c

Please sign in to comment.