Bell volume is reset

Mark Hills mark at pogo.org.uk
Sun Apr 4 18:31:15 PDT 2010


For a while now I have been bugged by a problem where 'xset b off' (to set 
bell volume to 0) was ignored in .xinitrc, but worked if typed into an 
xterm later. When I noticed that switching to console and back to X also 
resets the bell volume for XBell() to 50%, I began to look more closely.

It seems that the 'bell volume' percentage used by ProcBell 
(dix/devices.c):

  int base = keybd->kbdfeed->ctrl.bell;

is being reset back to 50.

Even though xset successfully sets it to zero, it is changed back in both 
cases -- shortly after the first 'xset' call, and when switching from 
console to X.

The reset happens in DeepCopyKeyboardClasses (called by 
ChangeMasterDeviceClasses, Xi/exevents.c). Indeed, preventing this copy of 
'kbdfeed' makes the bug go away, but what is the correct fix? I wondered 
if:

* DeepCopyKeyboardClasses is being called when it shouldn't be, because
  of (dce->flags & DEVCHANGE_KEYBOARD_EVENT) event; or

* DeepCopyKeyboardClasses is somehow mis-coping; or

* DoChangeKeyboardControl (dix/devices.c) should set ctrl.bell at the
  source of the copy, as well as the destination.

In the first case, DEVCHANGE_KEYBOARD_EVENT originates from 
dix/getevents.c:

  static EventListPtr
  updateFromMaster(EventListPtr events, DeviceIntPtr dev, int type, int *num_events)
  {
      DeviceIntPtr master;

      master = GetMaster(dev, (type & DEVCHANGE_POINTER_EVENT) ? MASTER_POINTER : MASTER_KEYBOARD);

      if (master && master->last.slave != dev)
      {
          CreateClassesChangedEvent(events, master, dev, type);
  [...]

Is this function calling CreateClassesChangeEvent() too readily, 
generating extra events which reset the 'bell' variable?

Or, should these events be able to happen without resetting this variable?

It seems that other attributes such as keyboard repeat rate etc. are not 
affected. As I can't find any reports of anything similar (it's been 
affecting me since around xorg-server-1.7.0 on Arch Linux on Dell D420) I 
can only imagine it is due to the order of operations on this hardware, or 
some similar oddity. xorg.conf is attached. My diagnosis comes from 
xorg-server-1.7.5.902 from the Git repo.

Thanks

-- 
Mark
-------------- next part --------------
Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
	InputDevice    "Mouse0" "SendCoreEvents"
#	InputDevice    "Mouse1" "SendCoreEvents"
	InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "ServerFlags"
	Option "AutoAddDevices" "False"
EndSection

Section "Files"
	ModulePath   "/usr/lib/xorg/modules"
	FontPath     "/usr/share/fonts/misc"
	FontPath     "/usr/share/fonts/75dpi:unscaled"
	FontPath     "/usr/share/fonts/100dpi:unscaled"
EndSection

Section "Module"
#	Load  "glx"
#	Load  "extmod"
#	Load  "xtrap"
#	Load  "dbe"
#	Load  "dri"
#	Load  "freetype"
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
	Option      "XkbLayout" "gb"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
EndSection

#Section "InputDevice"
#	Identifier  "Mouse1"
#	Driver      "synaptics"
#EndSection

Section "Monitor"
	Identifier   "Monitor0"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "NoAccel"            	# [<bool>]
        #Option     "SWcursor"           	# [<bool>]
        #Option     "ColorKey"           	# <i>
        #Option     "CacheLines"         	# <i>
        #Option     "Dac6Bit"            	# [<bool>]
        #Option     "DRI"                	# [<bool>]
        #Option     "NoDDC"              	# [<bool>]
        #Option     "ShowCache"          	# [<bool>]
        #Option     "XvMCSurfaces"       	# <i>
        #Option     "PageFlip"           	# [<bool>]
	Identifier  "Card0"
	Driver      "intel"
	VendorName  "Intel Corporation"
	BoardName   "Mobile 945GM/GMS, 943/940GML Express"
	BusID       "PCI:0:2:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport  0 0
		Depth     24
	EndSubSection
EndSection



More information about the xorg-devel mailing list