Tuesday 15 October 2013

New PCB and enclosure

Some time ago, I've decided to switch to a different type of enclosure. Here is the result:

Old InputStick vs new one:

Changes than can be noticed by end user:
  • Cap "locks" in opened/closed positions.
  • Takes less space in "opened" position.
  • Weight reduced to 8g (from 15g).
  • Dimensions: 57.5mm x 19.5mm x 9.5mm (vs 56.5mm x 19.5mm x 10.5mm).
There are also some changes that were made to make InputStick easier to manufacture:
  • More space inside enclosure allowed to improve PCB layout. Now it is easier to attach debugger/programmer.
  • Pushing back Bluetooth module by 1mm allowed to use SMT USB connector. Also, now there are proper slots for mounting it.
  • Some minor layout changes.
So far everything looks good. I'm not 100% sure about the colour yet. It may remain black and white or it will be entirely black or white. Of course final version will also include logo.
BTW: I've also received an estimate for contract manufacturing, however there are still some details to discuss.

Wednesday 9 October 2013

System keyboard input for RemoteController

While waiting for new PCBs to arrive, I did some improvements to RemoteController app. Now it is possible to choose between using my custom keyboard (which needs some customization options):
My custom keyboard.
and Android system keyboard:
Horizontal orientation, "SwiftKey Keyboard".

At first I didn't want to use Android keyboards, since I assumed that no keyboard offers all additional "PC" keys. Looks like I should have done some more research on this. Thanks to Max for letting me know about "Hacker's Keyboard", which has all necessary keys:

Vertical orientation, "Hacker's Keyboard".

Hacker's Keyboard also introduces additional keys known from PC keyboards.

A few words about keyboard-related API in Android:
  • Android 2.3 does not support "Ctrl" key.
  • There is no way to check what keyboard layout is currently in use.
  • Multi-character input like swype or dictionary predictions is not supported in this case.
  • Detecting if soft keyboard is visible is kind of a hack (checking difference in size of root view).
As a result of that, I had to add separate toggle buttons for modifier keys. It also looks like it will be necessary to add option to manually select keyboard layout used by USB host. It is not possible to get this kind of information form the host and it turns out that even if I wanted to assume that it is identical to the one used by soft keyboard, there is also no way to check what layout it actually is. There is a small problem related to arrow keys: depending on which UI element has the focus, they may work as indented or switch between tabs. Besides that, everything works just fine :)

Thursday 3 October 2013

TrueCrypt Widget

Some time ago I've shown you Password Manager application. This post is also related to passwords. I've created a very simple widget that uses InputStick to type my TrueCrypt password for encrypted system partition. The most important fact is that now all it takes to type the password is just a single click.

Here's a quick comparison of steps required to type the password:

Password Manager:
  1. Run application.
  2. Type master password.
  3. Connect to InputStick (although auto connect feature will be added).
  4. Click on "TrueCrypt" item.
  5. Select  "Password" entry.
  6. Press "Type" button.

  1. Click on the widget.

In both cases it is assumed that there is only one InputStick paired with the phone, otherwise you have to manually select InputStick device (unless DeviceManager is set to always connect to "Default" device). Also, I assume that Bluetooth radio is already on, if not you will be asked if you want to enable it.

But what about security? Is it safe this way? Well, in this case I think that it is:
  • TrueCrypt is used to protect data in case my laptop gets lost or stolen.
  • If I loose both my laptop and phone, it is still protected by relatively complex pattern lock.
  • Even if phone is unlocked the only (simple) way to get the password is to type it with InputStick, there is no "show plaintext" option.
  • Data stored on system partition is not something that can be remotely accessed, unlike, for example: email account.
So the only scenario in which my data can be compromised is when I loose all three devices: laptop, phone, InputStick and somehow phone remains unlocked. In my opinion: highly unlikely. However, for anything that can be remotely accessed I will still use Password Manager.

Here you can see the widget conveniently placed on my homescreen:

TrueCrypt Widget placed on homescreen.

After clicking on it, it hides icon and shows progress bar. When everything is done, it returns to initial state.

TrueCrypt Widget at work :)

And here's a short video showing how this actually works:

Also, if anyone is interested, take a look at the source code. Most part of the widget is based on this tutorial.

Main widget class: MyWidget.java:

Background service, which is actually doing all the work: WidgetService.java

Wednesday 2 October 2013

Some videos ...and AES encryption

Let's start with some videos:

Pairing InputStick with Android phone and InputStick Device Manager (Utility) application. As you can see takes about one minute.

USB Remote app in action.

USB Gamepad. Works with Linux (Ubuntu) out of the box. No need to configure anything. Game: TuxRacer.

USB Presentation Remote:

and finally, USB BarcodeScanner.

AES Encryption.

Recently I've been working on implementing AES-128 encryption in order to additionally secure communication with InputStick. Since one of use cases is using InputStick with Password Manager this is rather important, although InputStick is already using secured Bluetooth connection. 
At this moment AES encryption works on both ends: InputStick background service and device's firmware. There are still some performance issues, however some optimisation should solve this. Anyway, I was able to achieve about 30KBps data encryption/decryption rate @ 48 MHz MCU clock speed.
Since adding encryption will require firmware upgrade, I won't be including it in API for some time, until it is 100% tested.