LINUX.ORG.RU

Как позвать мышку по имени?

 ,


0

2

Есть мышки и трэкбол. Чувствительность их в скрипте например задаю так:

# DNS
xinput --set-prop "pointer:G-SPY USB Gaming Mouse" "Device Accel Constant Deceleration" 3
xinput --set-prop "pointer:G-SPY USB Gaming Mouse" "Device Accel Velocity Scaling" 2

# Murble
xinput --set-prop "pointer:Logitech USB Trackball" "Device Accel Constant Deceleration" 0.8
xinput --set-prop "pointer:Logitech USB Trackball" "Device Accel Velocity Scaling" 3
Но вот добавилась еще одна мышь. И в xinput это выглядит так:
> xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ USB Laser Game Mouse                    	id=8	[slave  pointer  (2)]
⎜   ↳ USB Laser Game Mouse                    	id=10	[slave  pointer  (2)]
⎜   ↳ Generic USB Keyboard                    	id=13	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Power Button                            	id=7	[slave  keyboard (3)]
    ↳ USB Laser Game Mouse                    	id=9	[slave  keyboard (3)]
    ↳ UVC Camera (046d:0825)                  	id=11	[slave  keyboard (3)]
    ↳ Generic USB Keyboard                    	id=12	[slave  keyboard (3)]
И я теперь не понимаю как установить параметры для мыши «USB Laser Game Mouse». Вот что получаю:
> xinput --set-prop "pointer:USB Laser Game Mouse" "Device Accel Velocity Scaling" 5
Warning: There are multiple devices matching 'pointer:USB Laser Game Mouse'.
To ensure the correct one is selected, please use the device ID, or prefix the
device name with 'pointer:' or 'keyboard:' as appropriate.

unable to find device pointer:USB Laser Game Mouse
Работает только по id. Т.е так:
xinput --set-prop 8 "Device Accel Velocity Scaling" 5
И выходит что настроится или нет зависит только от того как повезет при загрузке...

Как починить?

★★★★★

Посмотрите, может по выводу ″xinput --list --long″ будут различия. Или по выводу ″xinput list-props ID″ смотреть ″Device Node″, а потом по этому ″Device Node″ запрашивать udevadm.

mky ★★★★★
()

попробуй задать чувствительность через xset. можно крутить acceleration и threshold

Deleted
()
Ответ на: комментарий от mky

Посмотрите, может по выводу ″xinput --list --long″ будут различия.

Ну так различия то есть. Например в поддерживаемых кнопках. Но толку. Это же не имени.

ли по выводу ″xinput list-props ID″ смотреть ″Device Node″, а потом по этому ″Device Node″ запрашивать udevadm.

Вот это я не совсем понял. Ну вот ест у меня такой выхлоп:

[quote] xinput list-props 8[br][/quote]Device 'USB Laser Game Mouse':
	Device Enabled (152):	1
	Coordinate Transformation Matrix (154):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (283):	3
	Device Accel Constant Deceleration (284):	5.000000
	Device Accel Adaptive Deceleration (285):	1.000000
	Device Accel Velocity Scaling (286):	2.000000
	Device Product ID (272):	1241, 64257
	Device Node (273):	"/dev/input/event4"
	Evdev Axis Inversion (287):	0, 0
	Evdev Axes Swap (289):	0
	Axis Labels (290):	"Rel X" (162), "Rel Y" (163), "Rel Horiz Wheel" (281), "Rel Vert Wheel" (282)
	Button Labels (291):	"Button Left" (155), "Button Middle" (156), "Button Right" (157), "Button Wheel Up" (158), "Button Wheel Down" (159), "Button Horiz Wheel Left" (160), "Button Horiz Wheel Right" (161), "Button Side" (276), "Button Extra" (277), "Button Forward" (278), "Button Back" (279), "Button Task" (280), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275), "Button Unknown" (275)
	Evdev Scrolling Distance (292):	1, 1, 1
	Evdev Middle Button Emulation (293):	0
	Evdev Middle Button Timeout (294):	50
	Evdev Third Button Emulation (295):	0
	Evdev Third Button Emulation Timeout (296):	1000
	Evdev Third Button Emulation Button (297):	3
	Evdev Third Button Emulation Threshold (298):	20
	Evdev Wheel Emulation (299):	0
	Evdev Wheel Emulation Axes (300):	0, 0, 4, 5
	Evdev Wheel Emulation Inertia (301):	10
	Evdev Wheel Emulation Timeout (302):	200
	Evdev Wheel Emulation Button (303):	4
	Evdev Drag Lock Buttons (304):	0
И чем это может помочь?

попробуй задать чувствительность через xset. можно крутить acceleration и threshold

Что-то у меня с ним никогда не сросталось... Но попробую.

Suntechnic ★★★★★
() автор топика
Ответ на: комментарий от Suntechnic

Я считал, что у вас проблема в том, как определить id нужной мыши в скрипте, чтобы потом по этому id устанавливать чувствительность. Но судя по вашиму комментарию, проблема в чём-то другом.

mky ★★★★★
()
xinput --list --short \
| perl -ne 'print if s/.*USB Laser Game Mouse[[:space:]]+id=([[:digit:]])+[[:space:]]+.*/\1/' \
| xargs --replace xinput --set-prop {} "Device Accel Velocity Scaling" 5


?

ArcFi
()

usbid, надеюсь, разные? :)

ИМХО, проще положить фрагмент настройки в /etc/X11/xorg.conf.d/99-xyz.conf наподобие

$ cat /etc/X11/xorg.conf.d/99-razer.conf 
Section "InputClass"
	Identifier      "hi-res mouse"
	MatchProduct    "Razer Razer DeathAdder 2013"
	MatchIsPointer  "yes"
	Option	    "SendCoreEvents" "on"
	Option	    "Emulate3Buttons" "on"
	Option	    "AccelerationScheme" "predictable"
	Option	    "ConstantDeceleration" "1.8"
EndSection

заменив MatchProduct -> MatchUSBID.

barti_ddu
()
Ответ на: комментарий от mky

Нет. Проблема в том как установить чувствительность не прибегая к поиску id.

Пока у меня в скрипте так:

ids=$(xinput --list | awk -v search="USB Laser Game Mouse" \
    '$0 ~ search {match($0, /id=[0-9]+/);\
                  if (RSTART) \
                    print substr($0, RSTART+3, RLENGTH-3)\
                 }'\
     )
id=${ids[0]};

for i in $ids
do
    xinput --set-prop $i 'Device Accel Profile' 3
    xinput --set-prop $i 'Device Accel Constant Deceleration' 5.2
    xinput --set-prop $i 'Device Accel Velocity Scaling' 1.8
done
Однако это как-то костыльно. И невозможно использовать в xorg.conf

Suntechnic ★★★★★
() автор топика
Ответ на: комментарий от ArcFi

Ну я вон написал выше как у меня есть. Это ничем не лучше. Вопрос именно в том чтобы без id вообще обойтись.

Suntechnic ★★★★★
() автор топика
Ответ на: комментарий от Suntechnic

Что хочешь (например, «MyMouse») :)

ключевые параметры- «MatchProduct»/«MatchUSBID»

Кстати, xinput у меня тоже ругается:

$ xinput --list-props "pointer:Razer Razer DeathAdder 2013"
Warning: There are multiple devices matching 'pointer:Razer Razer DeathAdder 2013'.
To ensure the correct one is selected, please use the device ID, or prefix the
device name with 'pointer:' or 'keyboard:' as appropriate.

unable to find device pointer:Razer Razer DeathAdder 2013

С настройкой через xorg.conf- работает.

barti_ddu
()
Ответ на: комментарий от Suntechnic

Это ничем не лучше.

Лучше тем, что вообще не зависит от ID.
Недостаток в том, что к устройствам с одним именем применяются одинаковые параметры.

ArcFi
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.