Montag, 30. September 2013

Home Controling with Ubuntu (or raspberry pi) and Arduino

Hey guys,

I just discovered the great application heimcontrol.js from http://ni-c.github.io/heimcontrol.js/
If you want to control your existing rc-switches (for example from intertechno etc.) you may follow this quick guide.

0. Install raspbian on your raspberry pi (may work with other distributions too!)

1. open a terminal and copy paste (you can c&p all the commands at once):
sudo apt-get update
sudo apt-get install git-core git scons build-essential scons libpcre++-dev xulrunner-dev libboost-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev

If you are running ubuntu you may receive errors (packages not found). You can remove all "not found" packages from the list and install the rest. Also you can try to install the following programs through the software center (but you may have to add some repos)

2. Install node.js
wget http://nodejs.org/dist/v0.10.18/node-v0.10.18.tar.gz
tar -zxf node-v0.10.18.tar.gz
cd node-v0.10.18
./configure
make
sudo make install

3. mongodb - on ubuntu use the software center and skip step 3 (don't forget to add an startup script!)
(3.0: If you are using a Raspberry PI with 256MB RAM, then you have to edit the file /etc/dphys-swapfile and change the value of  CONF_SWAPSIZE  from 100  to 200)
3.1: install mongodb 
cd ~
git clone git://github.com/RickP/mongopi.git
cd mongopi
scons
sudo scons --prefix=/opt/mongo install
scons -c

3.2. open '/etc/environment' ( sudo nano /etc/environment ) and add:
PATH=$PATH:/opt/mongo/bin/
export PATH

3.3. Add mongodb user, directory and upstart script:
sudo useradd mongodb

sudo mkdir /var/lib/mongodb
sudo chown mongodb:mongodb /var/lib/mongodb
sudo mkdir /etc/mongodb/
sudo sh -c 'echo "dbpath=/var/lib/mongodb" > /etc/mongodb/mongodb.conf'

cd /etc/init.d
sudo wget -O mongodb https://gist.github.com/ni-c/fd4df404bda6e87fb718/raw/36d45897cd943fbd6d071c096eb4b71b37d0fcbb/mongodb.sh
sudo chmod +x mongodb
sudo update-rc.d mongodb defaults
sudo service mongodb start

4.  install heimcontrol.js
cd ~
git clone git://github.com/ni-c/heimcontrol.js.git
cd heimcontrol.js
npm install

5.1 install duino:
npm install duino

5.2 DON'T FORGET TO INSTALL THE REQUIRED LIB ON YOUR ARDUINO!!! Compile and upload (with Arduino from the softwarecenter) the code from ~/heimcontrol.js/node_modules/duino/src/du.ino to your arduino and connect it to your new heimcontrol server.


6. MODIFY FILES (or else you will get the error: "events.js:2817: Uncaught Error: Cannot open /dev/")
nano ~/heimcontrol.js/node_modules/duino/lib/board.js

search around line 75 for 'ls /dev | grep ACM' or similar and change it to:
'ls /dev | grep -e usb -e USB -e ACM'

save and exit.

7. start heimcontrol.js:
cd ~/heimcontrol.js
node heimcontrol.js

8. open a browser and go to localhost:8080
set up as you please :-)



FYI: If you are using intertechno codes, you have to change the last 4 bits of the hardcoded transmission code!!! Further informations can be found on http://www.fhemwiki.de/wiki/Intertechno_Code_Berechnung
nano ~/heimcontrol.js/plugins/arduino/index.js

Edit the codes:
// Send RC code
        if (item.value) {
          return that.pins[item.pin].triState(item.code + "0FFF");
        } else {
          return that.pins[item.pin].triState(item.code + "0FF0");
        }
 

Save and exit. Restart heimcontrol.js


Freitag, 19. Juli 2013

Ubuntu fingerprint & Vaio VPC-Z1

Here we go again.
After years of having a non-functioning fingerprinter in my notebook, I decided a few minutes ago to change that.
So if you run ubuntu first check out your fingerprinter device to make shure the following steps work.

  1. Open a terminal (Strg+Alt+t) and type in:

    lsusb

    All your devices should be listed in the terminal now. Search for your fingerprinter entry. In my case it is: Bus 001 Device 003: ID 147e:1001 Upek TCS5B Fingerprint sensor
  2. Go to https://launchpad.net/~fingerprint and check out, if they support your device. Fortunately the Vaio VPC-Z1 fingerprinter 147e:1001 is supported :-)
  3. If you find your device, add their repo with the command:

    sudo apt-add-repository ppa:fingerprint/fingerprint-gui

    Update your repos:

    sudo apt-get update
  4. Install fingerprint and fingerprint-gui

    sudo apt-get install libbsapi policykit-1-fingerprint-gui fingerprint-gui

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    NOTE: If you read your terminaloutput carefully you will notice the line:
    Die folgenden Pakete werden ENTFERNT:
      policykit-1-gnome


    Therefore, if you want to remove fingerprint you HAVE TO install MANUALLY policykit-1-gnome !!! Otherwise your system will break!!!
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  5. Now open fingerprint-gui and save your fingerprints.

Known problems:
Only if you have a encrypted homedirectory the INITAL login won't work with fingerprint. With initial login I mean the first login after cold boot. You can only login by typing in your password. For all other logins (screensaver, standby, sudo etc.) you can use fingerprint.
The only way (I know) to login with fingerprint in an encrypted system is to make use of the "password" tab in fingerprint-gui and store your password (encrypted) on a removable device. But be aware of the fact that you never should keep the removable device near your notebook, 'cause the encryption of the stored password is very weak! Also remove the removable device as soon as possible after login in, otherwise an attacker could encrypt the stored password remotely (as I mentioned before...its not very save!).



Good Luck! :-)

Mittwoch, 3. Juli 2013

android studio IDE unter ubuntu

Ciao,

want to check out the new IDE for android from google called "android studio" on ubuntu but it won't start because of the OpenJDK?

No problem!

Check this out:

1. Download the latest Oracle Java Platform (JDK) tar.gz (in my case 7u25) from http://www.oracle.com/technetwork/java/javase/downloads/index.html for your system (in my case Linux x64).

2. Unpack the archive
3. Open a terminal (Strg+Alt+t) and type in:
sudo mv jdk1.7.0_25/ /usr/lib/jvm/
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_25/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_25/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_25/bin/javaws 1
sudo update-alternatives --config java
Choose the Oracle JDK
sudo update-alternatives --config javaws
 Choose the Oracle JDK

4. Check with
java -version
in a terminal, if all went well.


PS: If you have problems with ADB, try to install the following:
sudo apt-get install lib32ncurses5 ia32-libs

Dienstag, 14. Mai 2013

Switch speaker left/right (Lautsprecher links/rechts vertauschen) on Ubuntu

So you have changed the order of your speakers and recognize, left and right speakers are switched? No problem!

open a terminal (Strg+Alt+t) and type in:

sudo gedit /etc/pulse/default.pa

Now, add the following lines to the bottom of the file:

load-module module-remap-sink sink_name=reverse-stereo master=0 channels=2 master_channel_map=front-right,front-left channel_map=front-left,front-right
set-default-sink reverse-stereo

save and restart pulse:

pulseaudio --kill
pulseaudio --start

thats it! :-)


---

Du hast deine Lautsprecher neu angeordnet und links mit rechts vertauscht? Kein Problem! Öffne das Terminal (Strg+Alt+t) und gib folgendes ein:

sudo gedit /etc/pulse/default.pa

Füge in der letzten Zeile nachfolgenden Eintrag hinzu:


load-module module-remap-sink sink_name=reverse-stereo master=0 channels=2 master_channel_map=front-right,front-left channel_map=front-left,front-right
set-default-sink reverse-stereo

Speichere und starte pulse neu:

pulseaudio --kill
pulseaudio --start

Das wars! :-)

Freitag, 3. Mai 2013

Print black/white (monochrome) with Canon under Ubuntu

Hey guys,

if you want to print monochrome with your Canon printer (in my case the mp495), you can do the following:

  1. Open Printer
  2. Select your printer, right click and choose properties
  3. Go to job options
  4. On the bottom there is a field where you type in "CNGrayscale" and hit add.
  5. Now type behind your new entry CNGrayscale "TRUE" and click on apply.
That's it. If you want to print in color again, just change this entry to FALSE.

Donnerstag, 2. Mai 2013

Install Ubuntu 13.04 raring on 2 drives with LVM

Hey guys,

if you want to install the new release of Ubuntu (13.04) on 2 drives you can do this with the following step by step manual. My notebook is a Sony Vaio vpcz1 and therefore your first steps may differ from mine!



0. (vpcz1) Prepare the disks:
  • Open up the BIOS on boot (by pressing F2). Go to the options where you can show the raid system on booting (it is under the Intel raid option) and enable that (while you're at it, make sure you boot from external device!)
  • Press F10 to save and exit the BIOS
  • Now you should see after the vaio splashscreen the information about your disks. Press Strg+I to enter the raid setup menu
  • In the raid setup you choose option 3 and reset all your discs by selecting them with space and lastly pressing enter (for German keyboard layouts: if you want to confirm the questions with y you have to press z!)
  • Exit and reboot

1. Setting up the LVM
  • Boot into the Ubuntu live Desktop
  • Open a terminal on the live Desktop and check your drives by typing in
    sudo fdisk -l
    and note your drives (in my case it is sdb and sdc)
  • ---begin---
  • Now we have to create partitions of the type "Linux LVM"
    sudo fdisk /dev/sdb
  •  Delete all Partitions "d", make a new one "n", choose primary partition "p", number of partition "1" and cylinders first/last default (press ENTER each time), then press "t" for change a partition's system id and type in the HEX-code "8e" and write the table to disk and exit via "w".
  • ---repeat (exactly!) from ---begin--- for all your drives---
  • It is time to create the physical volumes (change it to your names)
    sudo pvcreate /dev/sdb1
    sudo pvcreate /dev/sdc1
  •  Create the Volumegroup (change VOLUMEGROUPNAME as you like)
    sudo vgcreate VOLUMEGROUPNAME /dev/sdb1 /dev/sdc1
  • (optional) If you missed one you can add it later with the command
    sudo vgextend VOLUMEGROUPNAME /dev/sdX1
  • Type in the next command to get a logical volume (with the name you like)
    sudo lvcreate -l 100%FREE -n LOGICALVOLUMENAME VOLUMEGROUPNAME
  • (optional) If you want to create volumes with a specific size, use the following command:
    sudo lvcreate -L 3G -n LOGICALVOLUMENAME
    VOLUMEGROUPNAME
  • Lastly check your drive with
    sudo lvdisplay
  • If you ever have to resize a Partition:
    sudo lvreduce -L -5G /dev/mapper/VOLUMEGROUPNAME-LOGICALVOLUMENAME
    (I reduced the size of my created LVM and added with lvcreate a Swap partition)

2. Install Ubuntu
  • Proceed as usual and choose "other options"
  • Select your newly created partition and change it to ext4 and mountingpoint "/"
  • The Bootloader (GRUB) goes to /dev/sdb
  • Continue
3. Fix GRUB (chroot-methode)
  • Ok, as usually my GRUB didn't work correct, so boot once again into the live desktop
  • Type in a terminal the following commands:
    sudo mount /dev/mapper/VOLUMEGROUPNAME-LOGICALVOLUMENAME /mnt
    sudo mount -o bind /dev /mnt/dev

    sudo mount -o bind /sys /mnt/sys

    sudo mount -t proc /proc /mnt/proc

    sudo cp /proc/mounts /mnt/etc/mtab

    sudo chroot /mnt /bin/bash
  • You are now on your Ubuntu system. To repair GRUB proceed with (without sudo):
    grub-install /dev/sdb

    grub-install /dev/sdc

    update-grub
  • Exit with Strg+D and your system should boot normally :-)

Good Luck!

Montag, 15. April 2013

Ubuntu Grafikkarten Probleme

Servus,

sollte euer NVIDIA Treiber unter Ubuntu mal wieder spinnen - nur die Ruhe!
Mit simplen 2 Schritten wird der Standardtreiber wiederhergestellt.
Dafür müsst ihr erstmal den NVIDIA Treiber entfernen:

sudo apt-get purge nvidia*

(Achtet auf den Stern am Schluss!)
Danach noch die alte xorg.conf Datei "löschen" (backups sind immer besser ;-) ):

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

Neustarten (sudo reboot) und der Rechner läuft unter quelloffenem Treiber :-)


---


NVIDIA has broken your Ubuntu System once again? Relax!
With those 2 simple steps you can restore the default driver.
First of all, remove all of the NVIDIA drivers:

sudo apt-get purge nvidia*

(Don't remove the asterisk at the end!)
Now "remove" the old xorg.conf file (or do a backup...is always the better way):

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

Reboot (sudo reboot) and your system runs the default open-source driver :-)


Greetz

Sonntag, 3. März 2013

Ubuntu keyboard backlight (Tastaturbeleuchtung) Sony Vaio

Moin,
 
um die Tastaturbeleuchtung beim Sony Vaio Notebook anzupassen muss eine "1" in die Datei:
/sys/devices/platform/sony-laptop/kbd_backlight 
eingetragen werden.
Die Zeitdauer setzt ihr in der Datei:
/sys/devices/platform/sony-laptop/kbd_backlight_timeout
wobei 0(Standard)=10secs, 1=30secs, 2=60secs and 3=dauerhaft
 
---
 
To switch on the backlight of the Sony Vaio Notebook, just set a "1" in the file:
/sys/devices/platform/sony-laptop/kbd_backlight
and set the timeout as you wish:
/sys/devices/platform/sony-laptop/kbd_backlight_timeout
where 0(default)=10secs, 1=30secs, 2=60secs and 3=unlimited

Greetz