Announcement

Collapse
No announcement yet.

[Howto] Proximity on LinuxICE2

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Howto] Proximity on LinuxICE2

    This is a quick howto on getting proximity running on LinuxICE2. You will need a LinuxICE2 machine and a desktop to do syncing with. You will also need to access a terminal with a keyboard ( in LinuxICE2 find this in Apps->TerminalEmulator->Terminal).

    1 - get the dependencies:

    Code:
    sudo apt-get install libbluetooth-dev libgps-dev libqt4-dev build-essential
    2- get and compile the source:

    Code:
    svn co https://linuxice.svn.sourceforge.net/svnroot/linuxice/packages/proximity
    cd proximity
    qmake
    make
    sudo make install
    3- make it start up when LinuxICE2 boots:

    Code:
    sudo nano /etc/matchbox/session
    add:

    Code:
    proximity -s -D &
    like this:

    Click image for larger version

Name:	screenshot16.png
Views:	1
Size:	51.9 KB
ID:	2305304

    4- edit your events!

    Code:
    mkdir ~/.proximity
    cp /etc/proximity/events.xml ~/.proximity
    mousepad ~/.proximity/events.xml
    Edit to your likings. For my personal use, I copied my ssh key to my linux desktop and used rsync+ssh to do loginless syncs with my music directory. This is what I did:

    on the carpc:
    Code:
    ssh-keygen
    less ~/.ssh/id_rsa.pub
    now copy and paste it to a new line in ~/.ssh/authorized_keys on your desktop.

    After you get your keys all set up, make a folder on your desktop that you want to sync to. Alternatively, you can always just point to your main media folder. My library is larger than I would care to have on my carpc, so i made a separate folder for syncing with the carpc in /home/kev/carpc/Music.

    Now for the command. Add this to your wifi OnAdded event:

    Code:
    <command type="system" bin="/usr/bin/rsync">
     <arg>-arvuz</arg>
     <arg>-e ssh</arg>
     <arg>192.168.1.20:/home/kev/carpc/Music>/arg>
     <arg>/home/kev/</arg>
    </command>
    Now, when you start the carpc up to leave, it'll initiate a sync. Also when you return back home, it'll also initiate a sync. However, when you stop the car, the carpc normally would turn off. This will interrupt the sync'ing process so to get around it, I added some checks.

    First we edit the /etc/acpi/powerbtn.sh file that controls what happens when the power off signal is sent to the system. The following code is added *before* the command to hibernate/shutdown/etc.

    Code:
    if [ -f /tmp/interrupt ]
    then
    exit 0
    fi
    next, add a command before the rsync command that creates the interrupt file which essentially tells the acpi system that we are in the middle of somthing important and not to "interrupt" us:

    Code:
    <command type="system" bin="/bin/touch" >
     <arg>/tmp/interrupt</arg>
    </command>
    After the rsync command, we want to cleanup and then initiate a shutdown/hibernate/suspend:

    Code:
    <command type="system" bin="/bin/rm" >
     <arg>/tmp/interrupt</arg>
    </command>
    <command type="system" bin="/usr/bin/sudo" >
     <arg>halt</arg>
    </command>
    This is not perfect yet. It will likely shutdown when you don't want it to. Alternatively, you can have it fire a notification (using the notify-send command) or something and you can wait until you see that and then manually shut it down. If anyone has a solution to the above I'm all ears. I think this really calls for some advanced conditional stuff in proximity where you can "program" using multiple events.

    Hope that helps. have fun with proximity!
    Former author of LinuxICE, nghost, nobdy.
    Current author of Automotive Message Broker (AMB).
    Works on Tizen IVI. Does not represent anyone or anything but himself.
Working...
X