Problem description: Ubutnu does not support the keyboard drive of the notebook, especially the function key driver. My notebook is ToshibaSatelliteP75A and my computer is a new product of 14 years, even if the latest Ubuntu Desktop System has no corresponding driver, you have to make a shortcut key to control the touchpad. Who made us choose Linux. Ubuntu14.04 knowledge http://www.linuxidc.com/Linux/2 for downloading, installing, and configuring
Problem description:
Ubutnu does not support the keyboard driver of the notebook, especially the function key driver. My notebook is Toshiba Satellite P75A, and my computer is a new product of 14 years, even if the latest Ubuntu Desktop System has no corresponding driver, you have to make a shortcut key to control the touchpad. Who made us choose Linux.
Ubuntu 14.04Download, install, and configure a http://www.linuxidc.com/Linux/2014-04/100370.htm of related knowledge.
Ubuntu 14.04: Http://www.linuxidc.com/Linux/2014-04/100352.htm
Ubuntu 14.04 text tutorial on hard drive installation in Windows 7Http://www.linuxidc.com/Linux/2014-04/100369.htm
Script code:
The solution is to use a Python script to automatically obtain the startup status of the current touchpad and respond accordingly.
Source code:
#! /Usr/bin/env python
Import OS
Def check_touchpad_state (dev_num ):
Dev_state = OS. popen ('xinput list-props % s' % str (dev_num ))
For lines in dev_state.readlines ():
If 'device enabled' in lines:
Sig = lines [-3:-1]. strip ()
Signal = int (sig)
Print ('signal now: % d' % signal)
Return signal
Def get_dev_num (dev_name = 'synps/2 Synaptics TouchPad '):
Dev_state = OS. popen ('xinput list ')
For lines in dev_state.readlines ():
If dev_name in lines:
Print (lines)
Station = lines. find ('Id = ')
Dev_num = lines [station + 3: station + 5]
Dev_num = int (dev_num)
Print ('dev _ num: % d' % dev_num)
Return dev_num
Dev_state.close ()
Def change_state (state_value, dev_num ):
Print ('State _ value = ', state_value)
State = not state_value
If state = True:
State = 1
# Else:
# State = 0
# Print ('State = ', state, str (state ))
Tem = OS. popen ("xinput set-prop % s 'device enabled' % s" % (str (dev_num), str (state )))
Tem. close ()
Def main ():
Dev_num = get_dev_num ()
State = check_touchpad_state (dev_num)
Change_state (state, dev_num)
If _ name _ = '_ main __':
Main ()
Source code explanation:
Popen to obtain linux Command output:
Xinput list-props
Judge the touchpad status based on the output, and change 1 to 0 and 1 to 1.
Shortcut Key Definition:
Chmod + x adds executable permissions to your python script, ln-s performs soft link to/usr/local/bin, and then:
Open System settings and add shortcut keys in keyboard-Shortcut Key customization. Execute the command to execute the executable script we have written.
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2014-04/100612.htm