[LINUX] Sony PlayStation 3 Blu-ray Disc Remote (PS3 BD) + LIRC + XBMC = SUCCESS

  Thread Rating:
  • 6 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
TREX6662k5 Offline
Donor
Posts: 214
Joined: Oct 2006
Reputation: 0
Location: London, United Kingdom
Post: #16
Is there anyway to put the device in to sniff or park mode?

Alternatively, if you use the bdremote LIRC daemon. You can set a timeout that disconnects the remote.

WYSIWYG
(This post was last modified: 2009-05-19 20:35 by TREX6662k5.)
find quote
databubble Offline
Junior Member
Posts: 5
Joined: Jul 2009
Reputation: 0
Post: #17
Wow. Great progress. I've been trying for months with different programs and scripts meant to work with this remote with no joy. This is the first thing that's worked.

I'm using kubuntu karmic/9.10 alpha, and MythTV trunk. The jaunty build of blueman seems to work fine on karmic, and my remote reconnects automatically, even after a reboot.

That doesn't mean everything is solved yet, however! If I disconnect and re-connect the remote, it will connect using a new event hander.

Code:
I: Bus=0005 Vendor=054c Product=0306 Version=0000
N: Name="PS3 Remote Controller"
P: Phys=
S: Sysfs=/devices/virtual/input/input7
U: Uniq=
H: Handlers=kbd event5
B: EV=3
B: KEY=8000000000000000 7000001083c100 8c00ea00000000 6bc0000000000001 8000 1102c0000801 80168000000000 10000ffe

I: Bus=0005 Vendor=054c Product=0306 Version=0000
N: Name="PS3 Remote Controller"
P: Phys=
S: Sysfs=/devices/virtual/input/input8
U: Uniq=
H: Handlers=kbd event7
B: EV=3
B: KEY=8000000000000000 7000001083c100 8c00ea00000000 6bc0000000000001 8000 1102c0000801 80168000000000 10000ffe

Each time I disconnect, a new handler will be created. Not catastrophic in and of itself, because lirc can be started to look for the device name... and this seems to find the new hander okay, although I haven't tested it extensively yet.

Code:
lircd --device=name='PS3 Remote Controller' --driver=devinput

Note: the spaces in the device name break the /etc/init.d/lirc script.... I had to hack out of some of the intelligence of the script and feed the arguments in directly:

From /etc/init.d/lirc
Code:
start-stop-daemon --start --quiet --exec /usr/sbin/lircd -- --device="$REMOTE_DEVICE" --driver=devinput < /dev/null

Note: when it the remote does reconnect, you have to re-start the lirc daemon. So it only helps with the pain of trying to figure out what event hander to connect it to.


Now, why disconnect the remote when everything is working so well? I noticed in blueman that the remote never seems to disconnect on it's own.... so I presume I'll lose battery in a day or so. What's needed is some wait for the remote to time out after a while, as it does with the PS3. Ideally, when it comes back blueman would also connect it to the same input/event handler as well.... or you just get more and more event handlers being creates (not sure what the limit would be.)

My lircd.conf:
Code:
# Please make this file available to others
# by sending it to <lirc@bartelmus.de>    
#                                          
# this config file was automatically generated
# using lirc-0.8.4a(devinput) on Sun May  3 19:43:29 2009
#                                                        
# contributed by                                        
#                                                        
# brand:                       PS3                      
# model no. of remote control:                          
# devices being controlled by this remote:              
#                                                        

begin remote

  name  SonyBDRemote
  bits           32
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  gap          102974    
  toggle_bit_mask 0x8001019C

      begin codes
          num1                     0x80010002
          num2                     0x80010003
          num3                     0x80010004
          num4                     0x80010005
          num5                     0x80010006
          num6                     0x80010007
          num7                     0x80010008
          num8                     0x80010009
          num9                     0x8001000A
          num0                     0x8001000B
          eject                    0x800100A1
          audio                    0x80010188
          angle                    0x80010173
          subtitle                 0x80010172
          clear                    0x80010163
          time                     0x80010167
          red                      0x8001018E
          green                    0x8001018F
          blue                     0x80010191
          yellow                   0x80010190
          display                  0x80010166
          top_menu                 0x8001008B
          menu                     0x800101B6
          return                   0x80010001
          options                  0x80010165
          back                     0x8001009E
          view                     0x80010177
          x                        0x80010100
          enter                    0x8001001C
          up                       0x80010067
          down                     0x8001006C
          left                     0x80010069
          right                    0x8001006A
          l1                       0x80010136
          l2                       0x80010138
          l3                       0x8001013D
          r1                       0x80010137
          r2                       0x80010139
          r3                       0x8001013E
          select                   0x80010161
          start                    0x8001013B
          ps                       0x800100AC
          rew                      0x800100A8
          play                     0x800100CF
          ffw                      0x8001009F
          prev                     0x8001019C
          stop                     0x80010080
          next                     0x80010197
          slow_rew                 0x800101B4
          pause                    0x80010077
          slow_ffw                 0x800101B5
      end codes

end remote

I think the re-connect issues might require some specific enhancements to blueman.... but I'd be thrilled if anyone has another solution.
(This post was last modified: 2009-07-16 22:54 by databubble.)
find quote
databubble Offline
Junior Member
Posts: 5
Joined: Jul 2009
Reputation: 0
Post: #18
And for what it's worth, my .lircrc for MythTV.:

Code:
# LIRC mappings for mythtv            

begin          
    prog   = mythtv
    remote = SonyBDRemote
    button = num1        
    config = 1          
end                      

begin          
    prog   = mythtv
    remote = SonyBDRemote
    button = num2        
    config = 2          
end                      

begin          
    prog   = mythtv
    remote = SonyBDRemote
    button = num3        
    config = 3          
end                      

begin          
    prog   = mythtv
    remote = SonyBDRemote
    button = num4        
    config = 4          
end                      

begin          
    prog   = mythtv
    remote = SonyBDRemote
    button = num5        
    config = 5          
end                      

begin          
    prog   = mythtv
    remote = SonyBDRemote
    button = num6        
    config = 6          
end                      

begin          
    prog   = mythtv
    remote = SonyBDRemote
    button = num7        
    config = 7          
end                      

begin          
    prog   = mythtv
    remote = SonyBDRemote
    button = num8        
    config = 8          
end                      

begin          
    prog   = mythtv
    remote = SonyBDRemote
    button = num9        
    config = 9          
end                      

begin          
    prog   = mythtv
    remote = SonyBDRemote
    button = num0        
    config = 0          
end                      

begin                  
    prog   = mythtv    
    remote = SonyBDRemote
    button = eject      
    config = Ctrl+e      
end                      

begin                      
    prog   = mythtv        
    remote = SonyBDRemote  
    button = audio          
    config = +              
end                        

begin                        
    prog   = mythtv          
    remote = SonyBDRemote    
    button = angle            
    config = W                
end                          

begin                              
    prog   = mythtv                
    remote = SonyBDRemote          
    button = subtitle              
    config = Ctrl+s                
end                                

begin                          
    prog   = mythtv            
    remote = SonyBDRemote      
    button = clear            
    config = Backspace        
end                            

begin                          
    prog   = mythtv            
    remote = SonyBDRemote      
    button = time              
    config = f8                
end                            

begin                                      
    prog   = mythtv                        
    remote = SonyBDRemote                  
    button = red                            
    config = Ctrl+1                        
end                                        

begin                                
    prog   = mythtv                  
    remote = SonyBDRemote            
    button = green                    
    config = Ctrl+2                  
end                                  

begin                              
    prog   = mythtv                
    remote = SonyBDRemote          
    button = blue                  
    config = Ctrl+3                
end                                

begin                                                
    prog   = mythtv                                  
    remote = SonyBDRemote                            
    button = yellow                                  
    config = Ctrl+4                                  
end                                                  

begin                    
    prog   = mythtv      
    remote = SonyBDRemote
    button = display      
    config = u            
end                      

begin                          
    prog   = mythtv            
    remote = SonyBDRemote      
    button = top_menu          
    config = Ctrl+m            
end                            

begin            
    prog   = mythtv
    remote = SonyBDRemote
    button = menu        
    config = m          
end                      

begin                      
    prog   = mythtv        
    remote = SonyBDRemote  
    button = return        
    config = k              
end                        

begin            
    prog   = mythtv
    remote = SonyBDRemote
    button = options    
    config = i          
end                      

begin                
    prog   = mythtv  
    remote = SonyBDRemote
    button = back        
    config = Esc        
end                      

begin                  
    prog   = mythtv    
    remote = SonyBDRemote
    button = view        
    config = s          
end                      

begin                    
    prog   = mythtv      
    remote = SonyBDRemote
    button = x          
    config = d          
end                      

begin            
    prog   = mythtv
    remote = SonyBDRemote
    button = up          
    repeat = 1          
    delay  = 4          
    config = Up          
end                      

begin                
    prog   = mythtv  
    remote = SonyBDRemote
    button = down        
    repeat = 1          
    delay  = 4          
    config = Down        
end                      

begin                
    prog   = mythtv  
    remote = SonyBDRemote
    button = left        
    config = Left        
end                      

begin                  
    prog   = mythtv    
    remote = SonyBDRemote
    button = right      
    config = Right      
end                      

begin                    
    prog   = mythtv      
    remote = SonyBDRemote
    button = enter      
    config = Return      
end                      

begin                                                  
    prog   = mythtv                                    
    remote = SonyBDRemote                              
    button = ps                                        
    config = Ctrl+m                                    
end                                                    

begin                    
    prog   = mythtv      
    remote = SonyBDRemote
    button = select      
    config = #          
end                      

begin                          
    prog   = mythtv            
    remote = SonyBDRemote      
    button = start            
    config = r                
end                            

begin                    
    prog   = mythtv      
    remote = SonyBDRemote
    button = l1          
    config = Home        
end                      

begin                  
    prog   = mythtv    
    remote = SonyBDRemote
    button = l2          
    config = End        
end                      

begin              
    prog   = mythtv
    remote = SonyBDRemote
    button = l3          
    config = f1          
end                      

begin                      
    prog   = mythtv        
    remote = SonyBDRemote  
    button = r1            
    config = ]            
end                        

begin                        
    prog   = mythtv          
    remote = SonyBDRemote    
    button = r2              
    config = [              
end                          

begin                  
    prog   = mythtv    
    remote = SonyBDRemote
    button = r3          
    config = |          
end                      


begin                      
    prog   = mythtv        
    remote = SonyBDRemote  
    button = play          
    config = Ctrl+p        
end                        

begin                
    prog   = mythtv  
    remote = SonyBDRemote
    button = stop        
    config = Esc        
end                      

begin                  
    prog   = mythtv    
    remote = SonyBDRemote
    button = pause      
    config = P          
end                      

begin                        
    prog   = mythtv          
    remote = SonyBDRemote    
    button = rew            
    config = <              
end                          

begin                        
    prog   = mythtv          
    remote = SonyBDRemote    
    button = ffw
    config = >
end

begin
    prog   = mythtv
    remote = SonyBDRemote
    button = prev
    config = PgUp
end

begin
    prog   = mythtv
    remote = SonyBDRemote
    button = next
    config = PgDown
end

begin
    prog   = mythtv
    remote = SonyBDRemote
    button = slow_rew
    config = j
end

begin
    prog   = mythtv
    remote = SonyBDRemote
    button = slow_ffw
    config = u
end
find quote
databubble Offline
Junior Member
Posts: 5
Joined: Jul 2009
Reputation: 0
Post: #19
TREX6662k5 Wrote:Is there anyway to put the device in to sniff or park mode?

Alternatively, if you use the bdremote LIRC daemon. You can set a timeout that disconnects the remote.

I've had no success with bdremoted or myth_btremote or cakemote.py or ps3bdremote.py on karmic. I just couldn't get the remote "plumbed in" correctly such that any key presses would be recognized. Also, at least bdremoted seemed to require HIDD_ENABLED=0, and I wasn't will to do without my bluetooth mouse and keyboard. However, this approach works simultaneously with mouse, keyboard, headset and remote.

However, now that blueman has completed the setup of the remote so, I might give bdremoted a try again.
find quote
pbjr Offline
Junior Member
Posts: 48
Joined: Dec 2008
Reputation: 0
Post: #20
databubble Wrote:However, now that blueman has completed the setup of the remote so, I might give bdremoted a try again.

Great, let us know how you make out. I'm using bdremote on 8.04 and would love to upgrade.
find quote
atleberg Offline
Junior Member
Posts: 4
Joined: Sep 2008
Reputation: 0
Thumbs Up   
Post: #21
If you like me have problems with the lirc daemon not getting exclusive access (under buntu 8.10 in my case) edit lirc.fdi under /usr/share/hal/fdi/preprobe/20thirdparty.

To be on the safe side I kept what was there and just added a new device at the beginning.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
  <device>
     <match key="info.product" contains_ncase="PS3 Remote Controller">
        <merge key="info.ignore" type="bool">true</merge>
     </match>
  </device>
  <device>
     <match key="info.product" contains_ncase="IR-Receiver">
        <merge key="info.ignore" type="bool">true</merge>
     </match>
  </device>
</deviceinfo>

After editing the file you need to reboot to have it take effect.
find quote
mln_ Offline
Junior Member
Posts: 6
Joined: Aug 2008
Reputation: 0
Post: #22
I've followed the instructions in the first post but the command "Connect Input Service" fails. Therefore "PS3 Remote Controller" isn't listed when i run "cat /proc/bus/input/devices". Any ideas?
find quote
Exposure Offline
Junior Member
Posts: 11
Joined: Aug 2009
Reputation: 0
Post: #23
I can't get it to work Sad

The remote seems to be connected and everything appears fine, the /dev/input/eventX device is created. But there is no irw output and irrecord fails (gap not found). I changed HAL config to ignore the BD remote to no avail. Do we even need LIRC? Maybe it's easier to register the remote with Xorg as a evdev keyboard (or am I misunderstanding something?).

Tonight I'll borrow a different USB bluetooth stick, as I've seen posts about some sticks not working. Any help is appreciated!
find quote
nepoc Offline
Junior Member
Posts: 1
Joined: Aug 2009
Reputation: 0
Post: #24
Hey Guys, Nerd

Thanks to all of this I've been able to get nearly a perfect setup for my Mythtv box. I ended up installing Ubuntu 9.10 as it made the bluetooth setup a lot easier.

Below is a very simple script I made so that when you first boot the machine you run this in a root terminal (I'm sure you could do it any other number of ways too.). Before I get ahead of myself let me just say at what state you should be at before using it.

After your remote is paired and is functioning just how you like it. When you remove the battery it will remote it from /proc/bus/input/devices, then you put the battery in it returns with the same event number.

Now all this script does is check for it being present in that devices list and perform an action and wait for it to go away and perform another action.

Edit: What I should have said is that you could easily adapt this for xbmc as well. Replacing the mythfrontend with the command to run xbmc.
Also I've updated the script to be smarter. It automatically updates the hardware.conf for lirc with the lastest event handler given to the remote. (Assuming it's the last thing to reconnect)

Out of my own preference this is what happens:
Starting with a remote with the battery out:
1. Detect remote is connected
2. Update hardware.conf with new event handler
3. restart lirc to start using the remote
4. start mythfrontend --service
5. forcefully turn on the display (LCD Monitor)
6. Start detecting if remote has been disconnected
7. Dectect the remote is disconnected
8. Stop lirc
9. kill mythfrontend.real
10. forcefully turn off the display
11. start detecting if the remote is connected


Code:
#!/bin/bash

# get first discovery

tail /proc/bus/input/devices | grep -i ps3 > /dev/null
discovery=$?

# if the discovery = 1 the remote is not attached
# if the discovery = 0 the remote is attached

remote_discovery()
{
        if [ "$discovery" -eq 1 ]
        then
                while [ "$discovery" -eq 1 ]
                        do tail /proc/bus/input/devices | grep -i ps3 > /dev/null
                        discovery=$?
                        xset dpms force off
                        sleep 1
                done
                enabled=1
                take_action
        else if [ "$discovery" -eq 0 ]
        then
                while [ "$discovery" -eq 0 ]
                        do tail /proc/bus/input/devices | grep -i ps3 > /dev/null
                        discovery=$?
                        sleep 1
                done
                enabled=0
                take_action
        fi
        fi
}

remote_found()
{
echo "Remote Found - Restarting lirc and running mythfrontend"
eventnum=`tail /proc/bus/input/devices | grep Handlers | awk '{print $3}'`
sed -i "s/^REMOTE_DEVICE.*$/REMOTE_DEVICE=\"\/dev\/input\/$eventnum\"/" /etc/lirc/hardware.conf
/etc/init.d/lirc restart
xset dpms force on
sleep 1
(gksudo -u akiko '/usr/bin/mythfrontend --service') &
remote_discovery
}

remote_lost()
{
echo "Remote Lost - Stopping lirc"
/etc/init.d/lirc stop
killall -9 mythfrontend.real
xset dpms force off
remote_discovery
}
take_action()
{
        case $enabled in
                1       ) remote_found;;
                0       ) remote_lost;;
        esac
}

remote_discovery

exit 0


To use it just copy the above into a file called something like ps3_remote_finder.sh
Run: chmod +x ps3_remote_finder.sh
Then in a root terminal: /<path to the file/ps3_remote_finder.sh

You will need to leave the window open, I like to so that I can check if it has been working as expected.

Hopefully someone finds this useful.

Cheers,

Cory
(This post was last modified: 2009-08-14 15:56 by nepoc.)
find quote
Exposure Offline
Junior Member
Posts: 11
Joined: Aug 2009
Reputation: 0
Post: #25
Ok I've gotten it to work using the old bdremoted method. Works pretty good, much easier than getting the latest kernel/dbus/bluez stuff to play nice together.

Sometimes the remote doesn't respond anymore after some time. I think this is related to some sort of idle timeout on the remote, haven't really figured it out yet. I can get it to work by restarting lirc and bdremoted, but then I need to restart XBMC to have it reconnect with Lirc. It would be helpful if there was some other way to have XBMC reinitialise with Lirc.
find quote
pbjr Offline
Junior Member
Posts: 48
Joined: Dec 2008
Reputation: 0
Post: #26
Exposure Wrote:Ok I've gotten it to work using the old bdremoted method. Works pretty good, much easier than getting the latest kernel/dbus/bluez stuff to play nice together.

Sometimes the remote doesn't respond anymore after some time. I think this is related to some sort of idle timeout on the remote, haven't really figured it out yet. I can get it to work by restarting lirc and bdremoted, but then I need to restart XBMC to have it reconnect with Lirc. It would be helpful if there was some other way to have XBMC reinitialise with Lirc.

How long is some time? What distro?

Thanks
find quote
pikohn Offline
Junior Member
Posts: 15
Joined: Jan 2009
Reputation: 0
Post: #27
I have followed the directions of this thread and have my remote registered and trusted through the blueman applet. However, when i run cat /proc/bus/input/devices, i cant find an entry for my remote. Any help would be great

mike
find quote
Asure Offline
Junior Member
Posts: 30
Joined: Aug 2009
Reputation: 0
Post: #28
Exposure Wrote:Ok I've gotten it to work using the old bdremoted method. Works pretty good, much easier than getting the latest kernel/dbus/bluez stuff to play nice together.

Can you tell us, please:

a) Your distro
b) What steps you took to get it to react to bdremoted ?

I have a remote here but it only works with ps3_remote.py (modded to work correctly w/ eventserver and no icons.) .. Other programs/tools combination fail. (Ubuntu 9.04 default install from cd,fully updated, and bluez+bluez-compat from apt)
find quote
erhnam Offline
Team-XBMC Live Developer
Posts: 671
Joined: May 2009
Reputation: 2
Location: The Netherlands
Post: #29
I wrote a howto. It's only in Dutch but most of the commands are there. Here's the link:

http://www.strengholt-online.nl/playstat...-xbmc/221/
find quote
Asure Offline
Junior Member
Posts: 30
Joined: Aug 2009
Reputation: 0
Post: #30
I started out from your blog post (i'm dutch) before i came to the XBMC forums Smile

Can you tell me your distro ? It's not mentioned in the posting.
Also, why use cakemote in the end of the blog post ?

The 'old bdremote' part is to run only bdremote with a paired remote, and lirc to connect to it. For me, paired or not, bdremote will never pick up the remote, and send nothing to lirc.. (ubuntu 9.04) so that's why it's important to know your distro Smile
find quote
Post Reply