Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] Ati Remote Control under Linux
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Antares
Apprentice
Apprentice


Joined: 04 Apr 2005
Posts: 184
Location: France

PostPosted: Wed Jul 06, 2005 6:58 pm    Post subject: [HOWTO] Ati Remote Control under Linux Reply with quote

This a short HOWTO to optimise your ATI REMOTE CONTROL under linux. ( disponible en francais )
Excuse my english and feel free to correct me. :D

CONFIGURATION OF YOUR SYSTEM

First, enable the ati_remote module in your kernel :

Code:
Symbol: USB_ATI_REMOTE
 Prompt: ATI / X10 USB RF remote control
   Defined at drivers/usb/input/Kconfig:223
   Depends on: USB && INPUT
   Location:
     -> Device Drivers
     -> USB support


and add a new section in your /etc/X11/xorg.conf file :

Code:
Section "InputDevice"
Identifier "My ati remote control"
Driver "mouse"
Option "Protocol" "PS/2"
Option "Device" "/dev/input/mice"
Option "SendCoreEvents"
EndSection


and declare it in the "ServerLayout" section :

Code:
InputDevice "My ati remote control" "CorePointer"


Now you can launch you ATI remote control :

Code:
# modprobe ati_remote
# echo "ati_remote" >> /etc/modules.autoload.d/kernel-2.6


MAPPING YOUR ATI

Your ati remote control is an extension of your keyboard. Thus, if you modify some keys of your ati, you'll modify some of your keyboard too. Be aware of this.

I use 3 tools to map my ati remote control : xbindkeys, xvkbd and xmodmap.
--> xbindkeys to map permanently some keys of the ati remote control
--> xvkbd to emulate key combinations
--> xmodmap to map temporarily the remote control

First you have to set up you xbindkeys configuration :
To get the keycode of a key, juste do this :

Code:
# xbindkeys -k


and press the key you want the code

For example, with the space key of my keyboard :

Code:
# xbindkeys -k
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.
 "NoCommand"
     m:0x10 + c:65
     Mod2 + space


So you have to edit your ~/.xbindkeysrc file just like that :
"Command to execute when the key is pressed"
KEYCODE (for example m:0x10 + c:65)

Here comes the use of xvkbd to have a key combination linked to a single key on your ati remote control.
Xvkbd is a software that will emulate your key combination.
You can use it like that :

# xvkbd -text "KEY COMBINATION"

You can put modifiers in your key combination, using those expressions :
- \r - Return
- \t - Tab
- \b - Backspace
- \e - Escape
- \d - Delete
- \S - Shift (modify the next character)
- \C - Control (modify the next character)
- \A - Alt (modify the next character)
- \M - Meta (modify the next character)
- \[keysym] - the keysym keysym


So, if you want the power key to be similar as the key combination ALT+F4, you have to do :

Code:
# xbindkeys -k
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.
"NoCommand"
    m:0x10 + c:222
    Mod2 + NoSymbol


And you get the keycode of the power key, then in your ~/.xbindkeysrc file you put :

Code:
"xvkbd -text "\A\[F4]" "
    m:0x10 + c:222


Then you can choose to remap your ati remote control for each application (xmms, mplayer, tvtime, ogle...) with xmodmap.
You'll need to edit a config file for each application using this syntax :

keycode KEYCODE = KEYSYM

where KEYCODE is the number of the key (222 for the power key, used just before) and KEYSYM is the key you want (a, b, c, d, 1, 2, 3...)

Here are my config file for some applications :

Code:
# cat ~/.xmodmap_tvtime

!################################################
!############ ATI REMOTE CONTROL ################
!################## TVTIME ######################
!################################################

!Quit

keycode 10 = 1
keycode 11 = 2
keycode 12 = 3
keycode 13 = 4
keycode 14 = 5
keycode 15 = 6
keycode 16 = 7
keycode 17 = 8
keycode 18 = 9
keycode 19 = 0
!Chanel +
keycode 105 = Up
!Chanel -
keycode 99 = Down



Code:
# cat ~/.xmodmap_xmms   
 
!################################################
!############ ATI REMOTE CONTROL ################
!################### XMMS #######################
!################################################

!Play
keycode 168 = x
!Pause
keycode 110 = c
!Stop
keycode 232 = v
!Next track
keycode 233 = b
!Previous track

keycode 152 = z
!Shuffle
keycode 26  =  s
!Repeat
keycode 41 =  r



Code:
# cat ~/.xmodmap_gmplayer

!################################################
!############ ATI REMOTE CONTROL ################
!################# GMPLAYER #####################
!################################################

!Play
keycode 168 = Return
!Pause
keycode 110 = p
!Stop
keycode 232 = s
!Next track
keycode 233 = greater
!Previous track
keycode 152 = less
!Quit
keycode 222 = q




Thus, instead of launching an application named GN2 with the command "GN2", you launch it with :

Code:
# xmodmap ~/.xmodmap_GN2 | GN2


So, you just have to use this in your ~/.xbindkeysrc file.


However, as I said before, the remote controle is an extension of the keyboard. For example, with the tvtime xmodmap, the key 1 to 9 of your keyboard are modilied too. So we'll need to remap the keyboard when exiting an application. I choose to do it that way : when I press the power key, it also makes the ALT+F4 key combination and it remaps the remote control. (in ~/.xbindkeysrc)

Code:
"xvkbd -text "\A\[F4]" && xmodmap ~/.xmodmap_restore "
    m:0x10 + c:222


Where ~/.xmodmap_restore is :

Code:
# cat ~/.xmodmap_restore

clear Mod1
clear Mod2
keycode   9 = Escape Escape
keycode  10 = ampersand 1
keycode  11 = eacute 2 dead_tilde
keycode  12 = quotedbl 3 numbersign
keycode  13 = apostrophe 4 braceleft
keycode  14 = parenleft 5 bracketleft
keycode  15 = minus 6 bar
keycode  16 = egrave 7 dead_grave
keycode  17 = underscore 8 backslash
keycode  18 = ccedilla 9 asciicircum
keycode  19 = agrave 0 at
keycode  20 = parenright degree bracketright
keycode  21 = equal plus braceright
keycode  22 = BackSpace
keycode  23 = Tab Tab
keycode  24 = a
keycode  25 = z
keycode  26 = e E EuroSign
keycode  27 = r
keycode  28 = t
keycode  29 = y
keycode  30 = u
keycode  31 = i
keycode  32 = o
keycode  33 = p
keycode  34 = dead_circumflex  dead_diaeresis
keycode  35 = dollar sterling currency
keycode  36 = Return
keycode  37 = Control_L
keycode  38 = q
keycode  39 = s
keycode  40 = d
keycode  41 = f
keycode  42 = g
keycode  43 = h
keycode  44 = j
keycode  45 = k
keycode  46 = l
keycode  47 = m M
keycode  48 = ugrave percent
keycode  49 = twosuperior
keycode  50 = Shift_L
keycode  51 = asterisk mu
keycode  52 = w
keycode  53 = x
keycode  54 = c
keycode  55 = v
keycode  56 = b
keycode  57 = n
keycode  58 = comma question dead_cedilla
keycode  59 = semicolon period
keycode  60 = colon slash Multi_key
keycode  61 = exclam section
keycode  62 = Shift_R
keycode  63 = KP_Multiply
keycode  64 = Alt_L Meta_L
keycode  65 = space space
keycode  66 = Caps_Lock
keycode  67 = F1 F11
keycode  68 = F2 F12
keycode  69 = F3 F13
keycode  70 = F4 F14
keycode  71 = F5 F15
keycode  72 = F6 F16
keycode  73 = F7 F17
keycode  74 = F8 F18
keycode  75 = F9 F19
keycode  76 = F10 F20
keycode  77 = Num_Lock
keycode  78 = Scroll_Lock
keycode  79 = KP_7
keycode  80 = KP_8
keycode  81 = KP_9
keycode  82 = KP_Subtract
keycode  83 = KP_4
keycode  84 = KP_5
keycode  85 = KP_6
keycode  86 = KP_Add
keycode  87 = KP_1
keycode  88 = KP_2
keycode  89 = KP_3
keycode  90 = KP_0
keycode  92 = Sys_Req
keycode  94 = less greater bar
keycode  95 = F11 F11
keycode  96 = F12 F12
keycode 107 = Delete
keycode 108 = KP_Enter
keycode 109 = Control_R
keycode 112 = KP_Divide
keycode 113 = Mode_switch
keycode 114 = Break
keycode 110 = Find
keycode  98 = Up
keycode  99 = Prior
keycode 100 = Left
keycode 102 = Right
keycode 104 = Down
keycode 105 = Next
keycode 106 = Insert
! right windows-logo key
! in "windows" keyboards the postion of the key is annoying, is where AltGr
! usually resides, so go definie it as AltGr
keycode 116 = Mode_switch
! right windows-menu key
keycode 117 = Multi_key
add Mod1 = Alt_L Meta_L
add Mod2 = Num_Lock
add Mod4 = Super_L Super_R Super_L Hyper_L
add Mod5 = Mode_switch  ISO_Level3_Shift



TRICKS

Some tricks to finish with the configuration :

For the mute key : If like me you want to use the mute key for mute and unmute, you can use this command, given by grad_guy :

Code:
"amixer set Master toggle"
    m:0x10 + c:160


For the volume keys :

Code:
"amixer set Master 1-"
    m:0x10 + c:174

"amixer set Master 1+"     
    m:0x10 + c:176



I noticed that sometimes the remote control was detected as m:0x00 and not as m:0x10. I can't explain it at the moment, and the only solution I found was to duplicate my ~/.xbindkeys file. Here you have it :

Code:
# cat ~/.xbindkeysrc

###########################
# xbindkeys configuration #
###########################

"amixer set Master 1-"
    m:0x10 + c:174

"amixer set Master 1+"
    m:0x10 + c:176

"amixer set Master toggle"
    m:0x10 + c:160

"xvkbd -text "\A\[F4]" && xmodmap ~/.xmodmap_restore "
    m:0x10 + c:222

"xvkbd -text  "\C\A\[Left]" "
    m:0x10 + c:146

"xvkbd -text "\C\A\[Right]" "
    m:0x10 + c:140

"xvkbd -text "\A\[Escape]" "
    m:0x10 + c:177

"xmodmap ~/.xmodmap_tvtime | tvtime"
    m:0x10 + c:159

"ogle"
    m:0x10 + c:151

"xterm"
    m:0x10 + c:178

"xmodmap ~/.xmodmap_gmplayer | gmplayer"
    m:0x10 + c:230

"xmodmap ~/.xmodmap_xmms | xmms"
    m:0x10 + c:136

##############################################################################

"amixer set Master 1-"
    m:0x0 + c:174

"amixer set Master 1+"
    m:0x0 + c:176

"amixer set Master toggle"
    m:0x0 + c:160

"xvkbd -text "\A\[F4]" && xmodmap ~/.xmodmap_restore "
    m:0x0 + c:222

"xvkbd -text  "\C\A\[Left]" "
    m:0x0 + c:146

"xvkbd -text "\C\A\[Right]" "
    m:0x0 + c:140

"xvkbd -text "\A\[Escape]" "
    m:0x0 + c:177

"xmodmap ~/.xmodmap_tvtime | tvtime"
    m:0x0 + c:159

"ogle"
    m:0x0 + c:151

"xterm"
    m:0x0 + c:178

"xmodmap ~/.xmodmap_gmplayer | gmplayer"
    m:0x0 + c:230

"xmodmap ~/.xmodmap_xmms | xmms"
    m:0x0 + c:136


##################################
# End of xbindkeys configuration #
##################################



Now, the configuration of your remote control is finished. Enjoy ! :D


Last edited by Antares on Mon Aug 08, 2005 3:03 am; edited 2 times in total
Back to top
View user's profile Send private message
grad_guy
Tux's lil' helper
Tux's lil' helper


Joined: 16 Nov 2004
Posts: 109
Location: UCSD, La Jolla, CA

PostPosted: Thu Jul 07, 2005 2:56 am    Post subject: Reply with quote

For mute/unmute you can use this.
Code:
amixer set Master toggle

Now you save one script.
Back to top
View user's profile Send private message
Antares
Apprentice
Apprentice


Joined: 04 Apr 2005
Posts: 184
Location: France

PostPosted: Thu Jul 07, 2005 8:02 am    Post subject: Reply with quote

thanks, I didn't know that one. ;) I'll modify this immediatly.
Back to top
View user's profile Send private message
mdew
n00b
n00b


Joined: 14 Apr 2005
Posts: 2

PostPosted: Wed Jul 27, 2005 9:33 am    Post subject: Reply with quote

how do you modify the acceleration and repeat rate of the ati-remote?
Back to top
View user's profile Send private message
Antares
Apprentice
Apprentice


Joined: 04 Apr 2005
Posts: 184
Location: France

PostPosted: Mon Aug 08, 2005 12:19 am    Post subject: Reply with quote

hum, I don't know ! I never asked me this question ! but I'll try to see if it's possible. :D Let me know if you find from your part
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum