Τετάρτη 26 Δεκεμβρίου 2012

Adding a KeySonic bluetooth keyboard to Raspberry-Pi

This post explains how to connect a Bluetooth keyboard to raspberry pi.


Bluez installation

First of all install the Linux’s Bluez Bluetooth stack. In raspberry this is as easy as type :
apt-get install bluez bluez-utils bluez-compat bluez-hcidump



Bluetooth daemon

Modify the /etc/default/bluetooth file changing:

BLUETOOTH_ENABLED=1
HID2HCI_ENABLED=1
HID2HCI_UNDO=0

Restart bluetooth:
#> invoke-rc.d bluetooth restart 



Scan for the available devices

Scan for the available devices. Make sure your keyboard is in discoverable mode (push the button) before running the scan command. This provides with the device ID, similar to the MAC address of a network card. 



Pairing using the bluetooth Agent

Start bluetooth-agent (as root), giving an arbitrary PIN, such as 1234

Connect to the device

connect to the device using the command hidd --connect XX:XX:XX:XX:XX:XX


Request authentication from the device

Request the device to authenicate using the command hcitool auth XX:XX:XX:XX:XX:XX. Enter the PIN from your keyboard pressing at the end.


Relative Links:

http://wiki.debian.org/BluetoothUser




Κυριακή 23 Δεκεμβρίου 2012

Τετάρτη 19 Δεκεμβρίου 2012

alix 6f2 with novatel 3G module

 _  __

 \ \/ /___ __  __ ___  ___  ___    Useful Commands:
  \  // _ \\ \/ /,-_ |/ _ |/ -_)     remountrw - mount disk as read-write
   \/ \___/ \  / \___,\_  |\___|     remountro - mount disk as read-only
           _/_/        _'_|          remove.docs - remove all docs and manpages
     { V o y a g e } - L i n u x
      < http://linux.voyage.hk >   Version: 0.9 (Build Date 20120927)

root@voyage:/etc# vi wvdial.conf

[Dialer Defaults]
Init1 = ATZ
#Init2 = AT V1 E1 S0=0 &C1 &D2 +FCLASS=0
#Init2 = AT&F E1 V1 X1 &D2 &C1 S0=0
Modem Type = USB Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB0
#Modem = /dev/ttyUSB2
ISDN = 0
[Dialer vodafone]
Phone = *99#
Stupid Mode = 1
Init2=ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3=AT+COPS=3,2
Init4=AT+CGDCONT=1,"IP","internet"
Username = ;
Password = ;
; Phone =
; Password =
; Username =

root@voyage:/etc# vi /etc/ppp/peers/wvdial


noauth
passive
kdebug 4
noccp
#persist
name wvdial
noipdefault
usepeerdns
defaultroute
replacedefaultroute


proxy.sh


#!/bin/sh
echo "Setting up IPTABLES proxy..."
#
# enabling IP forwarding...
#
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/ipv4/ip_dynaddr
#
# Flushing packet filtering rules
#
iptables -t filter -F INPUT
iptables -t filter -F OUTPUT
iptables -t filter -F FORWARD
iptables -t nat -F
#
# Setting up default policies
#
iptables -t filter -P INPUT ACCEPT
iptables -t filter -P OUTPUT ACCEPT
iptables -t filter -P FORWARD DROP
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT
iptables -t nat -P POSTROUTING ACCEPT

#
# Setting up NAT
#
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -t filter -A FORWARD -i ppp0 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t filter -A FORWARD -i eth0 -o ppp0 -j ACCEPT

echo "proxy setup done."





Κυριακή 16 Δεκεμβρίου 2012

Book Selection

Τα μυστήρια των αριθμώνΤο τετράδιο της ΜάγιαΟ μέτοικος και η συμμετρία



Τρίτη 4 Δεκεμβρίου 2012

Using Python and MQTT on a Rasberry Pi

Mosquitto Mosquitto (mosquitto.org) is an open source message broker that implements the MQ Telemetry Transport protocol. MQTT (mqtt.org) privides a lightweight method of carrying out messaging using a publish/subscribe model. More about the MQTT protocol you can read at http://mosquitto.org/man/mqtt-7.html


After installing mosquitto 1.0.5 on my rasberry pi  I wrote the following two python scripts to experiment myself.

The code is shown below and it is self explanatory:

mosqsrv.py

#!/usr/bin/python

import mosquitto

#define what happens after connection
def on_connect (mosq, obj, rc):
        if rc==0:
                print "connected"

#On receipt of a message create a message
def on_message(mosq, obj, msg):
        print msg.topic+', '+msg.payload

#create a roker
mqttc = mosquitto.Mosquitto("python_sub")

#define the callbacks
mqttc.on_connect = on_connect
mqttc.on_message = on_message

#connect
mqttc.connect("localhost", 1883, 60)

#subscribe to topic test
mqttc.subscribe("test", 0)

#keep connected to broker
while mqttc.loop()==0:
        pass


mosqcl.py

#!/usr/bin/python

import mosquitto

#define what happens after connection
def on_connect (mosq, obj, rc):
        print("connected")

#create a broker
mqttc = mosquitto.Mosquitto("python_test")

#connect
mqttc.connect("192.168.1.105",1883, 60)

#publish to broker
mqttc.publish("test", "hello world!", 1)

mqttc.disconnect()

To test it I run mosquitto broker from the command line after editing the mosquitto.conf file to define the run user.




Τρίτη 27 Νοεμβρίου 2012

HP Photosmart C7200 "ink system failure fix"

Follow the following procedure before you buy a new one!
1. Press and hold key '*'
2. Press the '#' and release both keys
3. Press and release in sequence the '1','2' and '3' buttons
4. Press and release the right arrow until the display says "system configuration menu"
5. Press and release the "ok" button
6. Display should say "Hardware failure status". Press and release the "ok" button.
7. Press and release the cancel button as many times needed until the main menu appears
8. Turn off the unit and unplug the power cable for 30secs
9. Turn the unit on

Hopefully you should be backup and running!