Dec. 3rd, 2015

oio11: (Default)
НАСТРОЙКА XTERM

mensh, 10 Июл 2008
XTerm, являясь самой популярной программой в среде Х, обладает несколькими замечательными возможностями, позволяя:
  • одновременно запускать несколько окон оболочки;
  • регулировать размер каждого окна xterm;
  • изменять размер и цвет шрифтов, используемых xterm;
  • выполнять операции копирования/вставки текста между окнами xterm и других программ X;
  • использовать полосу прокрутки для просмотра текста, находящегося за пределами окна.
XTerm не является эмулятором терминала; это окно оболочки .
Постоянно действующие параметры XTerm указываются, как правило, в файле ресурсов, а редко используемые параметры в командной строке.

Параметры командной строки

Параметр Назначение
-bg Цвет фона (по умолчанию — белый)
-cr Цвет текстового курсора (по умолчанию — белый)
-display имя_узла:0 Подключение к Х серверу на данном узле
-e программа [аргументы] Вместо оболочки в окне запускается программа
-fg цвет Цвет текста (по умолчанию — черный)
-fn имя шрифта Выбор указанного шрифта
-geometry геометрия Выбор размеров и местонахождения окна
-ls Запуск оболочки в режиме регистрации
-sb Включение полосы прокрутки

Размеры окна XTerm

Размеры окна xterm проще всего регулируются с помощью параметра командной строки -geometry:

~$ xterm -geometry WidthxHeight
Значение Width соответствует ширине окна в символах, а значение Height — высоте окна (количеству строк).
Многие приложения X, поддерживая параметр -geometry, интерпретируют его как размер в пикселах.
В параметре -geometry можно также задать начальную позицию окна в пикселах:

~$ xterm -geometry WidthxHeight+X+Y
В данном случае X и Y определяют координаты левого верхнего угла окна программы в пикселах. Началом координат считается левый верхний угол экрана.
Как размеры (ширина и высота), так и координаты (X и Y) могут пропускаться.

Полоса прокрутки для XTerm

По умолчанию в окно xterm не включается полоса прокрутки. Для ее включения используется параметр командной строки -sb:

~$ xterm -sb
Средняя кнопка мыши осуществляет прокрутку к нужной позиции. Правая кнопка выполняет прокрутку назад, а левая — вперед.
Параметры командной строки могут быть и постоянными. В качестве примера привожу фрагмент меню fluxbox:

~ mcedit .fluxbox/menu
...
[
exec] (xterm) {xterm -fg black -bg white -rightbar -fn 9x15 -geometry 100x40}
...

Файл ресурсов X

Файлы ресурсов X предоставляют собой мощный механизм для настройки практически любого приложения X.
Для внесения в файл ресурсов всех необходимых параметров он может быть просто скопирован в домашний каталог и затем отредактирован:

~
copy /usr/X11/app-defaults/XTerm .
или просто создан:

~
touch XTerm
Фрагмент содержимого файла XTerm:

~ less XTerm
...
XTerm*foreground: gray
XTerm*background: black
XTerm*cursorColor: green
XTerm*scrollBar: True
XTerm*saveLines: 800
XTerm*font: -misc-fixed-medium-r-normal-*-15-140-75-75-c-90-iso10646-*
XTerm*geometry: 103x46+0+17
...
Пример окна XTerm
Здесь мной были выбраны: серый цвет шрифта, черный цвет фона, зеленый — курсора, полоса прокрутки, содержимое буфера в 800 строк, шрифт fixedдля кодировки utf8, геометрия окна 103x46 символов, координаты 0, 17 px.

Шрифты и цвета XTerm

Программа xlsfonts

Программой xlsfonts можно вывести список всех доступных шрифтов:

~ xlsfonts | less
-adobe-courier-bold-o-normal--0-0-100-100-m-0-iso10646-1
-adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-1
-adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-10
-adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-13
-adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-14
-adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-15
-adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-2
-adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-3
-adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-4
-adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-9
-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso10646-1
-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-1
-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-10
-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-13
-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-14
-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-15
-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-2
-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-3
-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-4
-adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-9
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso10646-1
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso10646-1
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-1
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-1
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-10
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-10
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-13
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-13
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-14
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-14
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-15
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-15
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-2
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-2
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-3
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-3
-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-4
lines 1-37
Для окна XTerm следует выбирать шрифт с фиксированной шириной символов (моноширинный), например Courier или Lucida.
В очень длинных именах моноширинных шрифтов обычно присутствует суффикс m или с.

Программа xfontsel

Для выбора шрифтов весьма удобна программа xfontsel:

~ xfontsel
Графическая программа xfontsel
Выбор параметров в ней рекомендую начинать с выбора кодировки, которая для utf8, например, будет следующей:
Выбор кодировки в xfontsel
Далее выбирается шрифт с необходимыми параметрами:
Выбор шрифта и его параметров в xfontsel
Затем нажимается кнопка select
Теперь имя выбранного шрифта можно вставить в другое окно.

Цветной XTerm

Пример цветного XTerm:
Цветной XTerm
Все настройки находятся в файлах: .bash_profile и .bashrc домашнего каталога.

Меню XTerm

По умолчанию у xterm отсутствует строка меню. Для получения доступа к одному трёх меню xterm необходимо, удерживая клавишу Control, нажать левую (lb), среднюю (mb) или правую (rb) клавишу мыши. Пример:
Ctrl-mb
Выбор меню xterm
Ctrl-mb
Выбор опции в меню xterm
Поддержку строки меню можно задать во время компиляции программы; в этом случае указанные выше меню будут доступны из строки меню.

http://www.linuxcookbook.ru/xtermsettings
oio11: (Default)

Awesome Window Manager 3.x Cheat Sheet by fievel

Default shortcuts for awesome window manager (http://awesome.naquadah.org). The list is copied from awesome man-page.
 
 
 

Awesome

Config­uration file is $XDG_C­ONF­IG_­HOM­E/a­wes­ome­/rc.lua
1 should be $HOME/.config

Mouse Buttons

Butt­on1
Left
Butt­on2
Middle (scrol­l-wheel click)
Butt­on3
Right
Butt­on4
Scroll­-wheel up
Butt­on5
Scroll­-whell down
For a classical right-­handled mouse

Keys

Mod4
Windows key
For a classical PC keyboard

Window Manager Control (Keyboard)

Mod4 + Control + r
Restart awesome.
Mod4 + Shift + q
Quit awesome.
Mod4 + r
Run prompt.
Mod4 + x
Run Lua code prompt.
Mod4 + Return
Spawn terminal emulator.
Mod4 + w
Open main menu.

Clients (Keyboard)

Mod4 + m
Maximize client.
Mod4 + n
Minimize client.
Mod4 + Control + n
Restore client.
Mod4 + f
Set client fullsc­reen.
Mod4 + Shift + c
Kill focused client.
Mod4 + t
Set client on-top.
 

Navigation (Mouse)

Butt­on1 on tag name
View tag
Button4, Button5 on tag name
Switch to previous or next tag.
Button4, Button5 on root window
Switch to previous or next tag.
Button1, Button3, Button4, Button5 on layout symbol
Switch to previous or next layout.
 

Navigation (Keyboard)

Mod4 + j
Focus next client.
Mod4 + k
Focus previous client.
Mod4 + u
Focus first urgent client.
Mod4 + Left
View previous tag.
Mod4 + Right
View next tag.
Mod4 + 1-9
Switch to tag 1-9.
Mod4 + Control + j
Focus next screen.
Mod4 + Control + k
Focus previous screen.
Mod4 + Escape
Focus previously selected tag set.

Layout Modifi­cation (Mouse)

Mod4 + Button1on tag name
Tag current client with this tag only.
Mod4 + Button3on tag name
Toggle this tag for client.
Butt­on3 on tag name
Add this tag to current view.
Mod4 + Button1on client window
Move window.
Mod4 + Button3on client window
Resize window.
 

Layout Modifi­cation Key Bindings

Mod4 + Shift + j
Switch client with next client.
Mod4 + Shift + k
Switch client with previous client.
Mod4 + o
Send client to next screen.
Mod4 + h
Decrease master width factor by 5%.
Mod4 + l
Increase master width factor by 5%.
Mod4 + Shift + h
Increase number of master windows by 1.
Mod4 + Shift + l
Decrease number of master windows by 1.
Mod4 + Control + h
Increase number of columns for non-master windows by 1.
Mod4 + Control + l
Decrease number of columns for non-master windows by 1.
Mod4 + space
Switch to next layout.
Mod4 + Shift + space
Switch to previous layout.
Mod4 + Control + space
Toggle client floating status.
Mod4 + Control + Return
Swap focused client with master.
Mod4 + Control + 1-9
Toggle tag view.
Mod4 + Shift + 1-9
Tag client with tag.
Mod4 + Shift + Control + 1-9
Toggle tag on client.

Personal shortcuts

 
 
 
 
 
 
 
 
 
This is an empty section where you can put your personal shortcuts
 
 

http://www.cheatography.com/fievel/cheat-sheets/awesome-window-manager-3-x/
oio11: (Default)
Gentoo Wiki Archives - UDEV

Contents

Introduction

Normally, devices get assigned device nodes (/dev/sda) when the kernel probes them at boot and continue until the machine is shut down. With transient devices such as USB gadgets that are added and removed from the system dynamically, there is no guarantee that a device will be assigned the same node everytime it is plugged in. This can negate the effectiveness of /etc/fstaband play havoc with the scripting/programming of the gadgets.
UDEV seeks to alleviate this problem by having devices assigned not only to the "standard" device node, but an additional specific "custom" node determined by the system administrator.
For example, a particular USB flash drive may be assigned to a particular "custom" node based on the model and serial numbers of the gadget. This could allow a particular flash drive to be assigned to /dev/co_fd (company flash drive), which /etc/fstabcould then mount to, say, /mnt/company_data. While another flash drive of the same model, but different serial number, might be assigned to /dev/my_fd (my flash drive) which is mounted to /mnt/my_data.

Writing custom udev rules

D.Drake has written excellent instructions on writing custom udev rules. The latest version can be found athttp://www.reactivated.net/writing_udev_rules.html .
In short, place your custom rules here:
# nano /etc/udev/rules.d/10-local.rules 
And re-start udev with:
# udevstart 
or just have udev rescan sysfs with:
# udevtrigger 

Example rules

Note: It looks like the SYSFS keyword have been renamed to ATTRS in the latest stable version of udev in portage

change Logitech USB mouse resolution on every insertion

SYSFS{manufacturer}=="Logitech", SYSFS{product}=="USB-PS/2 Optical Mouse", NAME="input/%k", MODE="0644", RUN+="/usr/bin/logitech_applet -s 800" 

mount USB-Sticks

One can use the following rule to auto-mount usb sticks:
# mount block device when added SUBSYSTEM=="block", ACTION=="add", RUN+="/usr/local/bin/mount-device.sh /dev/%k" 

mount-device.sh

To do anything useful you need the script /usr/local/bin/mount-device.sh:
#!/bin/sh  DEVICE="$1" GID=`grep plugdev /etc/group | cut -d: -f 3`  if [ "$DEVICE" = "" ] ; then exit 1 ; fi  # wait a moment till' hal has information about the device sleep 2  HAL_UDI=`hal-find-by-property --key block.device --string "$DEVICE"`  function get_hal_label {     CUR_UDI=$1     LABEL=""     COUNTER=0;     while [ -z "$LABEL" -a $COUNTER -lt 4 ]; do 	LABEL=`hal-get-property --key volume.label --udi "$CUR_UDI" 2>/dev/null` 	if [ -z "$LABEL" ]; then 	    LABEL=`hal-get-property --key storage.serial --udi "$CUR_UDI" 2>/dev/null` 	fi 	CUR_UDI=`hal-get-property --key info.parent --udi "$CUR_UDI" 2>/dev/null` 	let COUNTER=COUNTER+1     done          if [ -z $LABEL ]; then 	LABEL=${DEVICE##/dev/}     fi }  function get_hal_removable {     CUR_UDI=$1     REMOVABLE=""     COUNTER=0     while [ -z "$REMOVABLE" -a $COUNTER -lt 4 ]; do 	REMOVABLE=`hal-get-property --key storage.removable --udi "$CUR_UDI" 2>/dev/null` 	if [ -z "$REMOVABLE" ]; then 	    BUS=`hal-get-property --key storage.bus --udi "$CUR_UDI" 2>/dev/null` 	    if [ "$BUS" = "usb" ]; then 		REMOVABLE="true" 	    fi 	fi 	CUR_UDI=`hal-get-property --key info.parent --udi "$CUR_UDI" 2>/dev/null` 	let COUNTER=COUNTER+1     done          if [ -z "$REMOVABLE" ]; then 	logger "assuming $HAL_UDI is removable for safety reasons" 	REMOVABLE="true"     fi }  if [ -z "$HAL_UDI" ]; then # can't find device in hal db     logger "hald didn't know about $DEVICE"     LABEL=${DEVICE##/dev/} else # device found in hal db.     get_hal_label "$HAL_UDI"     get_hal_removable "$HAL_UDI" fi  logger "Mounting HAL_UDI $HAL_UDI as $DEVICE to $LABEL (removable: $REMOVABLE)"  SYNC_OPT=""  if [ $REMOVABLE = "true" ]; then     SYNC_OPT="--sync" fi  pmount --umask 007 $SYNC_OPT "$DEVICE" "$LABEL"  # if you do not want to use pmount (why should you?) #MOUNTPOINT=/media/${LABEL} #mkdir -p "$MOUNTPOINT" && #touch "$MOUNTPOINT"/.created_by_pmount && #mount "$DEVICE" "$MOUNTPOINT" -o gid=$GID,umask=007 || #rm "$MOUNTPOINT"/.created_by_pmount && #rmdir "$MOUNTPOINT" 

The file .created_by_pmount is created to make pumount remove the mount point after unmounting the filesystem. Typically /usr/lib/hal/hal-unmount.sh calls pumount when unplugging the USB stick. Therefore pmount should be installed!

References

Useful commands

'rc-update -s' - show what's been updated and at what level 'less /proc/scsi/scsi' 'ls /sys' 
'udevinfo' - 'udevinfo -n /dev/hda -q all'              'udevinfo -q all -d | less'              'udevinfo -a -p /sys/class/scsi_generic/sg0' - look at a device chain              'udevinfo -a -p $(udevinfo -q path -n /dev/hda)' - look at device chain via the /dev node (check dmesg for newly added hardware) 

Troubleshooting guidance

UDEV troubleshooting algorithm, as of version 081 http://www.reactivated.net/writing_udev_rules.html remains the definitive reference. The following guidance may also be of use.

  1. Edit /etc/udev/udev.conf udev_log line needs to read:
    udev_log="debug"
  2. You may need to reboot, and then figure where the output is going. Mine went to /var/log/everything/current
  3. Try something in /etc/udev/rules.d/10-udev.rules, udevcontrol reload_rules.
  4. Cycle your USB device.
  5. If success (you got the desired rule to fire, /dev/whatever is groovy), GOTO 8
  6. Else, read /var/log/everything/current
  7. Attempt to pinpoint the /etc/udev/rules.d/50-udev.rules entry that _did_ fire. Google. Try www.gentoo-wiki.info. Try forums.gentoo.org. Try bugzilla. Try the #gentoo* channels on freenode. Slaughter chicken, examine entrails.
  8. UDEV automatically translates "unsafe" characters into underscores which can cause problems with some rules. Therefore, if your rule(s) depend on special names and don't seem to be working, manually check /sys to confirm. As an example, I had a recent peroblem with udevinfo giving me 'ATTRS{name}=="cx88 IR _Hauppauge Nova-T DVB-T"' whereas the rule would only work with 'ATTRS{name}=="cx88 IR (Hauppauge Nova-T DVB-T"'. If you are unsure of what the name really is, try hooking the value directly out of sysfs e.g.
    cat /sys/class/input/input6/name
    cx88 IR (Hauppauge Nova-T DVB-T

    You have been warned!
  9. GOTO 2.
  10. Rejoice and knock one out, you did it. Restore /etc/udev/udev.conf.

Important files

  • /etc/udev/udev.conf - main config file
  • /lib/udev-state/devices.tar.bz2 - is NOT actively being used to hold a list of /dev's, they're being created at boot. How?
  • /dev/.udev.tdb - udev database - binary - created at boot (probably holds dev list ??)
  • /etc/udev/rules.d/50-udev.rules - default udev rules
  • /etc/udev/rules.d/10-local.rules - adminstrator's rules - the lower number causes it to be read first on boot
  • /etc/dev.d - holds programs to be executed after device handling.

Further hints relating to udev

The udevd daemon requires Unix Domain Sockets in order to operate. If the unix module is not built into the kernel, it is neccessary to apply a Fix to allow Unix Domain Sockets as a module to the startup scripts. This loads the necessary support module, before the udevd daemon is started.

Last modified: Tue, 08 Apr 2008 19:53:00 +1000 Hits: 68,365

http://www.gentoo-wiki.info/UDEV
oio11: (Default)
Gentoo Wiki Archives

HOWTO_Evdev_Input

Note: If your using Xorg 7.3 (>=xorg-server-1.4) and newer, follow this guide

This article is outdated. Please update this article with new information to match with the current portage tree and gentoo releases, and remove information about really old versions of software, then remove {{Update}} from this article's source.
 

Contents

Introduction

This guide will explain how to get newer mice working on XFree86 or Xorg with all the buttons being functional. Older methods of mouse setup will leave buttons mapped incorrectly or not functioning altogether. Certain options must be changed in your xorg.conf (for XOrg Foundation version of X) to use a newer protocol which will recognize those buttons. Also, you may have to compile the mouse driver as a module rather than building it into the kernel to get access to some of the button functions.
An already functional xorg.conf is required to use this guide. Please seehttp://www.gentoo.org/doc/en/xorg-config.xml for more information regarding automatic generation of one.
Monolithic XOrg builds 6.8 and lower have information contained in Legacy Monolithicand Legacy Monolithic/Individual Configurations. See that information for historical purposes only.
The following mice need to be reviewed and added, but will likely work:
  • Logitech MX610 Left-Handed
  • Logitech MX518
  • Logitech MX400
  • Logitech V270 Bluetooth
  • Logitech V200 Wireless
  • Logitech V320 Wireless
  • Logitech V150
  • Logitech V100
  • Logitech LX5 Wireless
  • Logitech Notebook Optical Plus
  • Logitech Kids Series Mice
  • Logitech Cordless Mini
  • Logitech MX Revolution
  • Logitech VX Revolution
  • Any Logitech Trackballs
  • Microsoft Basic Optical
  • Microsoft Comfort Optical 1000
  • Microsoft Compact Optical
  • Microsoft IntellMouse Bluetooth
  • Microsoft Wheel Mouse Optical 1.1
  • Microsoft Wireless Laser Mouse 5000 & 6000
  • Microsoft Wireless Optical 2000, 3000, 5000
  • Razer Copperhead
  • Razer Krait
This guide is now loosely based on one from the Gentoo Forums written by meowsqueak. Here's a link to that thread.

XOrg 6.9 or Greater, evdev, and USB Mice

Credit to linuX-gamers.net for writing an initial howto.
For XOrg 6.9 or greater, you'll want to use the new evdev driver for USB mice. This will allow all the mouse buttons to function, and nine times out of ten, you won't have to remap buttons to get things working properly.
First, make sure your kernel has evdev built into it:
Linux Kernel Configuration: Kernel Configuration (2.6.16 Example)
Device Drivers  --->
    Input Device Support  --->
        <*> Event Interface
    USB Support  --->
        <*> USB Human Interface Device (full HID) support
        [*] HID input layer support
If you build evdev as a module, you'll want to have it load on startup by adding the appropriate line in your /etc/modules.autoload.d/kernel-2.6:
File: /etc/modules.autoload.d/kernel-2.6
# /etc/modules.autoload.d/kernel-2.6:  kernel modules to load when system boots.
#
# Note that this file is for 2.6 kernels.
#
# Add the names of modules that you'd like to load when the system
# starts into this file, one per line.  Comments begin with # and
# are ignored.  Read man modules.autoload for additional details.

# For example:
# 3c59x

evdev
usbhid
Now run update-modules to commit the changes to /etc/modules.autoload.d/kernel-2.6.

Next, you'll need to have modular XOrg's evdev support installed:
emerge --ask --verbose xf86-input-evdev
If you built evdev as a kernel module, let's make sure it's loaded and ready to go:
You can see if the module evdev is loaded by:
lsmod
If it's not listed, load it with:
modprobe evdev
Now let's find out the location of your mice by reading the /proc/bus/input/devices file:
cat /proc/bus/input/devices

I: Bus=0003 Vendor=046d Product=c50e Version=2500
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:1d.0-2/input0
H: Handlers=mouse0 event0 kbd
B: EV=120007
B: KEY=ffff0000 10000 0 0 0 0 0 0 0
B: REL=103
B: LED=fc00
This system location information can be added to the /etc/X11/xorg.conf file several ways.

Option 1: Configure by Device

The first is by using the device address, in this case /dev/input/event0:
File: /etc/X11/xorg.conf
Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "evdev"
        Option      "Device" "/dev/input/event0"
EndSection

Option 2: Configure by Autodetection

The second way is to use the evdev driver in the way it was intended to detect a mouse:
File: /etc/X11/xorg.conf
Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "evdev"
        Option      "evBits"        "+1-2"
        Option      "keyBits"       "~272-287"
        Option      "relBits"       "~0-2 ~6 ~8"
        Option      "Pass"          "3"
EndSection
Restart XOrg and try things out. Your mouse should now be working!

Upgrading From XOrg 7.0 to 7.1 or higher

Previously this HOWTO explained how to use static UDEV device nodes to use mice in XOrg. The evdev driver in XOrg 7.1 no longer supports this method, or any method of altering the original device files. The original device file must be used. Using the old method will cause /dev/input/eventX files to come up missing and will cause errors when XOrg tries to call the mouse either by Name or Device ID. Revert any changes made to /etc/udev/rules.d/010_local.rules by commenting out the added lines or deleting the file, then restart UDEV by:
udevstart

Upgrading to XOrg 7.3 or higher

The value "AlwaysCore" in Input device is deprecated. The following must now be used in ServerLayout:
File: /etc/X11/xorg.conf
InputDevice "Mouse0" "SendCoreEvents"
For more information, check the Gentoo Forums: http://forums.gentoo.org/viewtopic-t-591248.html

Individual Mouse Configurations

This section has been moved to Individual Configurations. Please post if your mouse requires any special xmodmap, xinput, or other settings to function properly.

Multiple Mice Support

For additional mice support you'll have to add another InputDevice section. The following is an example of a two mouse setup, with the wireless as the default pointer:
File: /etc/X11/xorg.conf
Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "evdev"
        Option      "Device" "/dev/input/event0"
EndSection

Section "InputDevice"
        Identifier  "Mouse1"
        Driver      "evdev"
        Option      "Device" "/dev/input/event1"
EndSection
You'll then have to modify your ServerLayout section:
File: /etc/X11/xorg.conf
Section "ServerLayout"
#....Rest of serverlayout section
        InputDevice    "Mouse0" "SendCoreEvents"
        InputDevice    "Mouse1" "SendCoreEvents"
#....Rest of serverlayout section
EndSection
Restart your X server to use the new configuration.

Button Remapping

evdev Options

FIXME: Explain how to use evdev xorg.conf options to remap buttons.

Xmodmap

When using the correct configuration in xorg.conf does not produce the desired results, you may have to manually remap the mouse buttons to the correct function. The Xmodmap program will do this for you. Use this only as a last resort when your evdev or mouse driver is not functioning in an expected fashion. The syntax is:
xmodmap -e "pointer = (remapping of mouse buttons)"
For instance, if you want to remap button 2 to button 3 and you have a 12 button mouse, simply:
xmodmap -e "pointer = 1 3 2 4 5 6 7 8 9 10 11 12"
You can test the results of your remapping by running the program xev and pressing the button in question while keeping the cursor inside the black box in the window. It will give you a lot of information you don't need, but it will tell you which button X thinks it is once it's remapped. By default, X does sees all buttons as a 1-to-1 physical mapping with what the mouse driver tells it.
To have X load your mapping each time it's started, simply place it inside the /etc/X11/Xmodmap file. For user-based mappings, you can use ~/.Xmodmap. They are formatted as such:
File: ~/.Xmodmap or /etc/X11/Xmodmap
pointer = 1 3 2 4 5 6 7 8 9 10 11 12

KDM and KDE

When using KDM and KDE, your /etc/X11/xinit/xinitrc may be ignored. To automatically call xmodmap (only for yourself), you can use the Autostart folder of kde:
File: ~/.kde/Autostart/Xmodmap
#!/bin/sh
xmodmap /etc/X11/Xmodmap
Alternatively, you can add the following line to ${kdedir}/share/config/kdm/Xstartup to remap your mouse buttons/wheel for all users of the system:
File: ${kdedir}/share/config/kdm/Xstartup
/usr/bin/xmodmap -e "pointer = 1 2 3 6 7 4 5"
Another way is to add the following lines to ${kdedir}/share/config/kdm/Xsession to fix the .Xmodmap issue for all users:
File: ${kdedir}/share/config/kdm/Xsession
/usr/bin/xmodmap -e "pointer = default"
if [ -f "$HOME/.Xmodmap" ]
then
    /usr/bin/xmodmap "$HOME/.Xmodmap"
fi
Note: Touching files in ${kdedir} may mean merging configuration files on a point release, or copying these changes to new files on a major release.
If you'd rather not touch files in ${kdedir}, then have each user create a ~/.xprofile file containing the following:
File: ~/.xprofile
/usr/bin/xmodmap -e "pointer = 1 2 3 6 7 4 5"
or
File: ~/.xprofile
/usr/bin/xmodmap .Xmodmap
If you don't like this way, there is yet another one: put the xmodmap line in the /etc/xprofile file and make it executable:
File: /etc/xprofile
xmodmap /etc/X11/Xmodmap

GDM and GNOME

When using GDM your /etc/X11/xinit/xinitrc may be ignored. To fix this, use the .Xmodmap loading feature of gdm:
File: ~/.Xmodmap
pointer = 1 2 3 6 7 4 5
You will be prompted by gdm at the next login to enable the new mapping.
To apply the setting for all users, place the same line in /etc/X11/Xmodmap.

Multiple Mice and Xinput

Xmodmap will only affect the first mouse in your xorg.conf ServerLayout section. Your second mouse will not be able to be mapped.
(You may use the "xsetpointer" command to view and change which mouse is considered first. emerge xsetpointerto try it out.
If you want to change the buttons of additional mouse devices, you can use Xinput instead of XmodmapXinput can be simply obtained:
emerge --ask --verbose xinput
To rearrange the buttons use:
xinput set-button-map <device name> <new button order>
To determine the device name either have a look in your xorg.conf or use: xinput list or xsetpointer -l
Example: This works quite well:
xinput set-button-map Mouse1 1 2 3 6 7 8 4 5
If you use the "evdev"-driver, you'll notice that xinput has the annoying "feature" of appending the physical address to the Identifier you gave the device in your xorg.conf. You can use a bit of grep and sed magic to tend to this problem (Thexorg.conf-Identifier is "Mouse3" in this example):
xinput set-button-map `xinput list | grep -o '"Mouse3.*"' | sed -e 's/"//g'` 1 9 3 4 5 6 7 8 2

XOrg.conf ButtonMapping

FIXME: Explain more clearly how ButtonMapping works and why the values entered into the variable do what they do. Also confirm as to whether this variable is specified for the evdev driver.
Newer versions of XOrg contain a new variable for mapping mouse buttons from within xorg.conf. XOrg 7.0 starts by assigning 11 buttons, taking 4 5 6 7 as scroll buttons and leaving 7 physical buttons. There is no need to use xmodmap to modify what buttons point where as there seems to be a new option for that within xorg.conf, "ButtonMapping". In fact, without any editing xorg.conf seems to have the following default:
Option "ButtonMapping" "1 2 3 8 9 10 11" 
The syntax is as follows:
File: /etc/X11/xorg.conf
Section "InputDevice"
      Identifier  "Mouse1"
      Driver      "mouse"
      Option      "Device" "/dev/input/mice"
      Option      "Protocol" "auto"
      Option      "ButtonMapping" "1 2 3 6 7"
EndSection
Note: This method is found to work with the "mouse" driver and trackballs, however is not known to work with evdev.
References:

Tips & Tricks

Open Text In Firefox/Mozilla Tab

Here's a nice little script you can bind to one of your mouse buttons with your window manager. It opens the currently selected text (usually a URL) in a new mozilla or firefox tab. Remove references to wmctrl if you don't like it changing your workspace:
File: clipurl
#!/bin/bash
# opens a new tab at selected URL in mozilla-like browser
#
# Copyright 2004 David Antliff <OMITdavid.antliffOMIT@OMITgmail.com>
# This program is distributed under the terms of the GPL version 2.
#
# Last changed:
# 20041207

# Where to find/open the browser
DISPLAY=:0.0
SCREEN=7

if test -z "$BROWSER"
then
    BROWSER='/usr/bin/mozilla'
fi


# fix URLs that span multiple lines and may have injected spaces
# (e.g. Pine)
URL=`xclip -o | tr '\n' ' ' | sed 's/\s//g'`
echo clipurl: $URL

PING=`$BROWSER -remote 'ping()' 2>&1`


if test -z "$PING"
then
    echo $BROWSER: opening new tab
    wmctrl -s $SCREEN
    $BROWSER -remote "openURL($URL,new-tab)" &
else
    echo $BROWSER: starting new session
    wmctrl -s $SCREEN
    $BROWSER $URL &
fi

Troubleshooting

Uncontrollable mouse in SDL apps

It seems that with evdev, DGA gets broken in SDL: mouse jumps and moves down-right all the time.
To fix this you have to add this to your xorg.conf :
File: /etc/X11/xorg.conf
   Section "Module"
       ...
       SubSection  "extmod"
         Option    "omit xfree86-dga"   # don't initialise the DGA extension
       EndSubSection
       ...
   EndSection

Last modified: Mon, 15 Sep 2008 15:22:00 +1000 Hits: 196,749

http://www.gentoo-wiki.info/HOWTO_Evdev_Input
oio11: (Default)
Manually Mounting a USB Flash Drive in Linux

By Jason Jones
Posted: 16 Feb 2005
*note* Before you begin trying to do this manually, make sure Linux has not all ready mounted your drive to your Desktop automatically.
There are two ways to manually mount your flash drive in Linux.
The first way we’ll describe should be used if you are going to rarely mount your drive, or only mount it once.
The second way we’ll explain should be used if you plan on using your flash drive on a more regular basis.

procedure to manually mount drive once

Plug in the flash drive into one of the USB ports on your computer.
These usually are found on the back-side of your computer. Some newer models also have some ports on the front panel.
After you’ve plugged it in, you’ll want to open a terminal window and become the “root” user. This user is the only one which can access the commands to manually mount your drive. To become the root user, type in the following commands.
[jason@linux:~> su Password: linux:/home/jason # 
When it asks for your password, enter the root password. (You won’t see any typing on the screen when you enter your password. This is normal, and makes your computer more secure.)
After you’ve become root, enter the following command into the same terminal window to see if your computer has recognized the flash drive you plugged in.
linux:/home/jason # lsusb Bus 002 Device 003: ID 08ec:0010 M-Systems Flash Disk Pioneers DiskOnKey Bus 002 Device 001: ID 0000:0000 Bus 001 Device 001: ID 0000:0000 linux:/home/jason # 
This information tells me that the system recognized one USB device named “M-Systems Flash Disk Pioneers DiskOnKey” That is good. Yours will most likely have a different name, so look for the name of your flash disk’s manufacturer in the output.
*note* My system only has one USB device plugged in. If you have multiple devices plugged in, it will recognize them as well as your flash device, so your output will most likely look very differently than mine.
If your output doesn’t list anything that looks like your flash drive, I’d recommend trying different USB ports on your computer to see if it can get listed. You must get your computer to recognize your flash drive in order to continue with this tutorial.
After successful recognition of your USB drive, you’ll want to create a directory where your USB drive will be mounted. I entered the following commands into the same terminal window to do this.
linux:/home/jason # cd Desktop/ linux:/home/jason/Desktop # mkdir flash linux:/home/jason/Desktop # 
  • The “cd Desktop” command tells the computer to go into the Desktop directory (this is where I want to make the directory, so I can access the flash drive directly from my Desktop)
  • The “mkdir flash” command makes a directory named “flash” which we’re going to use to mount the flash drive.
With that done, we need to get the appropriate device which is attached to your flash drive.
To do this, simply issue the following command in the same terminal window.
dmesg | grep -i “SCSI device”
linux:/home/jason/Desktop # dmesg | grep -i "SCSI device" SCSI device sda: 31520 512-byte hdwr sectors (16 MB) SCSI device sda: 31520 512-byte hdwr sectors (16 MB) SCSI device sda: 31520 512-byte hdwr sectors (16 MB) linux:/home/jason/Desktop # 
As you can see, there are three lines of output, but they are all the same. The information we’re interested in is the output immediately after “SCSI device”. On my machine it’s sda.
This is the device we’re looking for. On most machines this will be the case. If you’ve got a newer machine with an SATA drive or a SCSI drive in it, the output will most likely be quite different. The words you’ll be looking for will probably be sdb or sdc. To make sure you select the correct device, simply look for some information that describes your flash drive. For example, my flash drive has 16 megabytes of storage on it. On the output, the words (16 MB) would be a good indicator of that being my flash drive.
When you’ve found the correct device (sda, sdb, sdc, etc…) enter the following command into the same terminal window:
linux:/home/jason/Desktop # pwd /home/jason/Desktop linux:/home/jason/Desktop # mount -t vfat -o uid=jason,gid=users /dev/sda /home/jason/Desktop/flash linux:/home/jason/Desktop # 
There’s quite a bit there, so let’s break it down.
  • “pwd” is used to see where the path is to your Desktop, so we can accurately mount the flash drive. You’ll use the line after it later.
  • The next command is the command to mount your flash drive to the flash directory. Let’s break that down so we can understand it.
    • “mount” is the command used.
    • “-t vfat” tells the command to mount the “vfat” filesystem (which most flash drives are).
    • “-o uid=jason,gid=users” makes the mount accessible by the “jason” user. You’ll want to change this to the user with which you use to log in. Example: if you use the username “jhamilton” to log in, you’d use “-o uid=jhamilton,gid=users” instead.
    • “/dev/sda” points to the correct device. Make sure you use the same device you found earlier. Example: If you found your correct device to be “sdc” earlier, you’d use “/dev/sdc” instead.
    • “/home/jason/Desktop/flash” is the directory to which you want the device to be mounted. You’ll want to use the results of the “pwd” command here. Example: If the line after the “pwd” command was “/home/jhamilton/Desktop” you’d use “/home/jhamilton/Desktop/flash” instead.
Your flash drive is now mounted and ready to use. If you followed the instructions exactly, there is a new folder on your desktop named “flash” which can be used to put files, images, music, or anything else you want!
When you’re done copying, simply pop out the drive and you’re on your way.

procedure to manually mount drive for repeated use

This is the way you should mount your drive if you plan on using it often.
Plug in the flash drive into one of the USB ports on your computer.
These usually are found on the back-side of your computer. Some newer models also have some ports on the front panel.
After you’ve plugged it in, you’ll want to open a terminal window and become the “root” user. This user is the only one which can access the commands to manually mount your drive. To become the root user, type in the following commands.
[jason@linux:~> su Password: linux:/home/jason # 
When it asks for your password, enter the root password. (You won’t see any typing on the screen when you enter your password. This is normal, and makes your computer more secure.)
After you’ve become root, enter the following command into the same terminal window to see if your computer has recognized the flash drive you plugged in.
linux:/home/jason # lsusb Bus 002 Device 003: ID 08ec:0010 M-Systems Flash Disk Pioneers DiskOnKey Bus 002 Device 001: ID 0000:0000 Bus 001 Device 001: ID 0000:0000 linux:/home/jason # 
This information tells me that the system recognized one USB device named “M-Systems Flash Disk Pioneers DiskOnKey” That is good. Yours will most likely have a different name, so look for the name of your flash disk’s manufacturer or name in the output.
*note* My system only has one USB device plugged in. If you have multiple devices plugged in, it will recognize them as well as your flash device, so your output will most likely look very differently than mine.
If your output doesn’t list anything that looks like your flash drive, I’d recommend trying different USB ports on your computer to see if it can get listed. You must get your computer to recognize your flash drive in order to continue with this tutorial.
After successful recognition of your USB drive, you’ll want to create a directory where your USB drive will be mounted. I entered the following commands into the same terminal window to do this.
linux:/home/jason # cd Desktop/ linux:/home/jason/Desktop # mkdir flash linux:/home/jason/Desktop # 
  • The “cd Desktop” command tells the computer to go into the Desktop directory (this is where I want to make the directory, so I can access the flash drive directly from my Desktop)
  • The “mkdir flash” command makes a directory named “flash” which we’re going to use to mount the flash drive.
With that done, we need to get the appropriate device which is attached to your flash drive.
To do this, simply issue the following command in the same terminal window.
dmesg | grep -i “SCSI device”
linux:/home/jason/Desktop # dmesg | grep -i "SCSI device" SCSI device sda: 31520 512-byte hdwr sectors (16 MB) SCSI device sda: 31520 512-byte hdwr sectors (16 MB) SCSI device sda: 31520 512-byte hdwr sectors (16 MB) linux:/home/jason/Desktop # 
As you can see, there are three lines of output, but they are all the same. The information we’re interested in is the output immediately after “SCSI device”. On my machine it’s sda.
This is the device we’re looking for. On most machines this will be the case. If you’ve got a newer machine with an SATA drive or a SCSI drive in it, the output will most likely be quite different. The words you’ll be looking for will probably be sdb or sdc. To make sure you select the correct device, simply look for some information that describes your flash drive. For example, my flash drive has 16 megabytes of storage on it. On the output, the words (16 MB) would be a good indicator of that being my flash drive.
Now, enter the simple command as follows:
linux:/home/jason/Desktop # pwd /home/jason/Desktop linux:/home/jason/Desktop # 
This command is simply to tell us what the path is to your Desktop. We’ll be using this later.
After that is done, the first thing to do is make a backup of a *very* important file named “/etc/fstab” by issuing the following command:
linux:/home/jason # cp /etc/fstab /etc/fstab.bak linux:/home/jason # 
Now, we’re going to need to tell your computer to set itself up to mount your flash drive every time your computer is turned on. To do this you’ll need to add something like the following line to the “/etc/fstab” file. (yours might vary a little bit depending on the information you’ve received previously)
/dev/sda /home/jason/Desktop/flash vfat users,noauto,uid=jason,gid=users 0 0
Some of the information might be different for you. If you didn’t find sda for your device before, you’ll have to enter the appropriate device. Example: If you found “sdc” for your device, you would change the “/dev/sda” line to “/dev/sdc“.
You will also change the /home/jason/Desktop/flash line to the appropriate directory. Example: If the line after the “pwd” command was “/home/jhamilton/Desktop” you’d use “/home/jhamilton/Desktop/flash” instead of “/home/jason/Desktop/flash”.
Also, you’ll need to change the “uid=jason” line to reflect the username you enter when you start Linux. Example: If you type in “JHamilton” when you log into NLD, you’ll want to change “uid=jason” to “uid=JHamilton“.
With that, you should be good to go.
Now we’re gonna enter the command to alter the /etc/fstab file. To do this issue the following command in your terminal window:
*note* Be sure to use your own info from above!
linux:/home/jason/Desktop # echo "/dev/sda /home/jason/Desktop/flash vfat users,noauto,uid=jason,gid=users 0 0" >> /etc/fstab linux:/home/jason/Desktop # 
Now your /etc/fstab file has been altered, and you’re ready to mount your flash drive.
to do so, simply enter the following commands:
linux:/home/jason/Desktop # exit linux:/home/jason/Desktop # mount flash linux:/home/jason/Desktop # 
And your flash drive should be mounted! You can now drag ‘n’ drop things into your “flash” folder on your Desktop!
When you turn your computer off, in order to mount it again, simply go to your Desktop directory in a new terminal by typing “cd Desktop” and then type in “mount flash” and it’ll be mounted again.
Disclaimer: As with everything else at SUSE Conversations, this content is definitely not supported by SUSE (so don't even think of calling Support if you try something and it blows up).  It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.

https://www.suse.com/communities/blog/manually-mounting-a-usb-flash-drive-in-linux/

oio11: (Default)
Saturday, December 1, 2007

How To Mount USB flash drive from Command Line
 
Mounting a USB flash drive in GNOME (or another Linux desktop environment) is as easy as plug and play. Yet, occasionally, you need to mount one on a server which does not run X, then you must know how to do it on the command line.

  1. Become root.

    $ sudo -s


  2. Plug in USB drive to a USB port.

  3. Identify the correct partition name corresponding to the USB drive.

    For my Debian system, it is sda, and partition 1.
    $ dmesg |grep -i 'SCSI device'
    ...
    SCSI device sda: 3903488 512-byte hdwr sectors (1999 MB)

    Alternatively,
     $ grep  SCSI /var/log/messages
    ...
    Dec 1 11:52:26 tiger kernel: SCSI device sda: 3903488 512-byte hdwr sectors (1999 MB)

  4. Mount the partition to an existing mount point (directory).

    $ mkdir -p /mnt/myusb
    $ mount -t vfat -o rw,users /dev/sda1 /mnt/myusb

    users give non-root users the ability to unmount the drive.

    You can verify the drive is indeed mounted as follows:
     $ mount

    You should see a line in the output that looks like:

    /dev/sda1 on /mnt/myusb type vfat (rw,noexec,nosuid,nodev)


To retrieve the USB drive:

  1. You must unmount the partition before physically unplugging the USB device.


    $ umount /mnt/myusb

    You can run the mount command again (with no argument) to verify that the volume is indeed mounted.

  2. Unplug USB drive.


http://linuxcommando.blogspot.com/2007/12/how-to-mount-usb-flash-drive-from.html

October 2025

S M T W T F S
   1234
567891011
12131415161718
19202122 232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 27th, 2026 08:48 am
Powered by Dreamwidth Studios