Skip to content
Hippie Hacker edited this page Dec 28, 2015 · 9 revisions

Welcome to the iikeyboard wiki!

Download and flash the device with the latest image (we tested 2.1)

unzip ../edison-iotdk-image-280915.zip
./flashall.sh
# plug in the edison

Serial login:

sudo screen /dev/ttyUSB0 115200
configure_edison --setup
# connect to wifi so we can update and download software
cat <<EOF > /etc/opkg/base-feeds.conf 
src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32
EOF
opkg update
opkg install python-pip
opkg install bluez5-obex bluez5-dev bluez5-testtools bluez-hcidump
cp /etc/bluetooth/main.conf /etc/bluetooth/main.conf.bak
cat <<EOF > /etc/bluetooth/main.conf
[General]
Name='iigadget'
DeviceID = usb:1209:CAFE:0002
EOF
wpa_cli -i wlan0 remove_network all
wpa_cli save
systemctl enable connman 
systemctl start connman
connmanctl  enable wifi
connmanctl scan wifi

Now find your network via the scan:

root@edison:~# connmanctl services
*AO CTRLH                wifi_784b87a1cee2_4354524c48_managed_psk
    PDXDIY               wifi_784b87a1cee2_504458444959_managed_psk
    PDXDIY-5G            wifi_784b87a1cee2_5044584449592d3547_managed_psk

Use the wifi_XXX_YYY_managed_psk string for your network and drop it into /var/lib/connman/foo.config

cat <<EOF > /var/lib/connman/ctrlh.config
[service_wifi_784b87a1cee2_4354524c48_managed_psk]
Type = wifi                                                 
Security = wpa2
Name = CTRLH     
Passphrase = 3216549870
EOF
connmanctl enable bluetooth
curl https://bootstrap.pypa.io/ez_setup.py | python
pip install ipython #for debugging
pip install evdev
pip install PyBlueZ
pip install dbus-python
# http://cgit.freedesktop.org/dbus/dbus-python/tree/README#n36
# I'm having serious problems keeping this running:
dbus-python might not be the best D-Bus binding for you to use. dbus-python
does not follow the principle of "In the face of ambiguity, refuse the
temptation to guess", and can't be changed to not do so without seriously
breaking compatibility.

We need to run bluetoothd with --noplugin=input so we can grab the interrupt.

# Copy bluetooth service into etc so we can modify it
cp /lib/systemd/system/bluetooth.service /etc/systemd/system
sed -i -e 's:bluetoothd:bluetoothd --noplugin=input:' /etc/systemd/system/bluetooth.service
systemctl disable bluetooth
systemctl enable bluetooth
systemctl daemon-reload
systemctl restart bluetooth
systemctl status Bluetooth
● bluetooth.service - Bluetooth service
   Loaded: loaded (/etc/systemd/system/bluetooth.service; enabled)
   Active: active (running) since Thu 2015-04-23 17:15:27 PDT; 11s ago
     Docs: man:bluetoothd
 Main PID: 10793 (bluetoothd)
   Status: "Running"
   CGroup: /system.slice/bluetooth.service
           └─10793 /usr/lib/bluez5/bluetooth/bluetoothd --noplugin=input
opkg install git
git clone https://github.com/hh/btk.git
cd btk
ls
git branch -a
git checkout kb_pin_entry
python agent.py
bg
cat <<EOF > /etc/systemd/system/btk.service
[Unit]
Description=keyboard service
Requires=bluetooth
[Service]
ExecStart=/home/root/btk.sh
[Install]
WantedBy=multi-user.target
EOF

cat <<EOF > /home/root/btk.sh 
#!/bin/sh
cd /home/root/btk
python agent.py
EOF

chmod +x /home/root/btk.sh