个人工具

UbuntuHelp:BadDeviceError

来自Ubuntu中文

跳转至: 导航, 搜索

Removing the 'BadDevice' Errors

This page describes how to get rid of the BadDevice errors when starting a GUI application from a Terminal:

X Error: BadDevice, invalid or uninitialized input device 170
  Major opcode:  146
  Minor opcode:  3
  Resource id:  0x0
Failed to open device
X Error: BadDevice, invalid or uninitialized input device 170
  Major opcode:  146
  Minor opcode:  3
  Resource id:  0x0
Failed to open device

The Fix

To stop these errors from appearing you need to modify your /etc/X11/xorg.conf file and remove the relevant parts. First we'll make a backup, just in case. Open the file by pressing Alt+F2 and putting in:

gksu gedit /etc/X11/xorg.conf

For Ubuntu, or

kdesu kate /etc/X11/xorg.conf

For Kubuntu Then choose File -> Save As and save it as xorg.conf.backup Now to change the file, Find this part:

Section "InputDevice"
	Driver		"wacom"
	Identifier	"stylus"
	Option		"Device"	"/dev/input/wacom"
	Option		"Type"		"stylus"
	Option		"ForceDevice"	"ISDV4"		# Tablet PC ONLY
EndSection

Section "InputDevice"
	Driver		"wacom"
	Identifier	"eraser"
	Option		"Device"	"/dev/input/wacom"
	Option		"Type"		"eraser"
	Option		"ForceDevice"	"ISDV4"		# Tablet PC ONLY
EndSection

Section "InputDevice"
	Driver		"wacom"
	Identifier	"cursor"
	Option		"Device"	"/dev/input/wacom"
	Option		"Type"		"cursor"
	Option		"ForceDevice"	"ISDV4"		# Tablet PC ONLY
EndSection

and either delete or comment out the lines. (To comment out the lines you put a '#' character at the beginning of each line) Then find the lines:

	InputDevice     "stylus"	"SendCoreEvents"
	InputDevice     "cursor"	"SendCoreEvents"
	InputDevice     "eraser"	"SendCoreEvents"

In the Section "ServerLayout" section and delete/comment out those too. Once you've done that, choose File -> Save As and save it as xorg.conf to replace the origional. You will then have to restart the X server for the settings to take effect. First save anything you are working on and logout, then from the login screen menu choose "Restart the X server", then you can log back in.

If Something Went Wrong

If, after you chose to restart the X server, you don't get the login screen back, then the you may have not competed the steps properly or just made a mistake somewhere, but that's why we created a backup. Login to the console and from there run this command:

sudo cp /etc/X11/xorg.conf.backup /etc/X11/xorg.conf

That will restore your X configuration back to how it was before, then restart the login manager: In Ubuntu

sudo /etc/init.d/gdm restart

In Kubuntu

sudo /etc/init.d/kdm restart

Then you can log back in and try again.