.gitignore keeps your repository sane – some helpful resources

Ignoring files is a great article on GitHub Help. The global gitignore file is mentioned there. In this file you can ignore files in all the git repositories on your machine. There is a very helpful template that will ignore compiled output files from various languages (*.o, *.so, *.dll, *.class) as well as logs, database files, packages and also files generated by the operating system (Yes, I’m looking at you Windows Thumbs.db and Mac .DS_Store!).

The above page also links to the gitignore repository on github. This repo contains a whole bunch of gitignore files for programming languages, build systems, servers, markup languages, content management systems, … There is also a global folder for more your global ignore file (IDEs, text editors, non-git version control, operating systems…).

Reference or use git/github-managed code in your git project

Please note that there seems to be better way to do this since git version 1.8.2 (mentioned in these two stackoverflow answers: here and here). The version from the Ubuntu 12.04 repos is 1.7.9.5 though so I’ll take a different route. The project for this example is the handy node.js multi-platform support layer libuv.

Please note that this example expects you to already have an existing project under git control. If you don’t – simply look up on how to create one using git init or git clone one 🙂


# do a "clean cut" before adding the submodule
git commit

# add libuv to the project
git submodule add https://github.com/joyent/libuv.git libuv
git status

# update the submodule
git submodule init
git submodule update

# enforce the version we want to use (tag v0.10.22)
cd libuv/
git reset --hard v0.10.22
cd ..
git commit -a

git submodule status

You can now reference/include the files of the submodule while still being able to update the submodule to newer versions. Gotta love version control!

Useful Bluetooth Low Energy Android Apps (for free)

I just stumbled across a few useful android apps for BLE development. My curiosity was sparked by github user tomkubitza who wrote that there’s a useful BLE android app by Nordic Semiconductor. They actually have a set of apps/demos which look well-done. It’s nice to see they take those apps seriously – after all WPAN chips are their bread and butter 🙂

For now this is just a list for reference. I might come back and add infos after giving some of the apps a go.

Nordic Semiconductor

BLE scanners/detectors

Texas Instruments SensorTag related

UPDATE: One function to extract them all!

UPDATE: There is a Python script that has some extra features (like extraction into a dedicated directory and changing of permissions).

I seriously fail to remember all those tar options for each of the supported archives 🙂 So I’m happy to have found a bash function that will simply chose the right command based on the file extension:

Simply put the function at the bottom of your .bashrc file. Either close and re-open the terminal you’re using or type source ~/.bashrc to refresh the changes of your bash environment.

Now you can just type extract your_archive_here.xyz and the function will extract the archive and cd into it. Super time-and-brain-energy-saver! 😛 I found this function on the Ubuntu forums in a post by user graysky.

USB-BT4LE Bluetooth 4.0 USB Adapter by Plugable on Ubuntu 12.04

This is my experience with the USB-BT4LE Bluetooth 4.0 USB Adapter by Plugable. I bought it since it claims to have Linux support out-of-the-box. Well – the chipset IS supported but I needed to fiddle some to make it work 🙂 Of course I can only speak for the device I got and my computer (Ubunu 12.04 LTS, kernel 3.8). So here we go.

After inserting the dongle into the USB port I only got the following message in dmesg:

So I began some digging. A search for the product code and the device id gave me the Bluetooth chip that is used: BCM20702. The last line of the dmesg output suggests that a firmware is needed. Some more searching on the web confirmed this and this Ubuntu bug report suggests a tool called hex2hcd by Jesse Sung to convert the firmware image that comes with the windows driver into a hcd file. So I booted Windows, installed the driver and checked which firmware is being used:

driver_details

These are the build instructions I found in a comment on the same bug report:

When the Bluetooth adapter gets plugged into the PC the kernel will look for a proper firmware in the /lib/firmware folder. For this to work the filename of the firmware must have the following format: fw-<manufacturer_id>_<device_id>.hcd

After removing the Bluetooth adapter and plugging it in again I got the following messages:

So far so good. However, I encountered another problem:

It turns out that there’s a program called rfkill that will acticate/deactivate your bluetooth and/or WLAN devices. In my case this was probably triggered by the hardware switch for wireless communication on my Thinkpad. I found solution on the Ubuntu forums:

UPDATE: Bluetooth Low Energy dongles with Linux compatibility

UPDATE: I got my hands on another BTLE capable dongle and added it below with the other CSR8510 dongles.

This is a short investigation of Bluetooth Low Energy USB dongles that have been reported to work in Linux or officially claim Linux support.

Plugable USB-BT4LE
– Web: http://plugable.com/products/usb-bt4le
– Advertised as linux compatible
– Mode: dual mode
– BT chip: Broadcom BCM20702
– Tested by Michael Saunby on Ubuntu 12.10
– Note: I own one of those and had to jump through some hoops to get it to work – but that’s another blog post to come.

Other dongles based on the Broadcom BCM20702:
GMYLE Micro USB Bluetooth 4.0 Dongle

Delock Adapter USB 2.0 Bluetooth V4.0 Dual Mode
– Web: http://www.delock.com/produkte/F_270_USB-Adapter_61889/merkmale.html
– Advertised as linux compatible (according to data sheet)
– Mode: dual mode
– BT chip: unknown

SPEEDLINK VIAS Nano USB Bluetooth Adapter
– Web: http://www.speedlink.com/?p=2&cat=271&pid=20182
– Mode: dual mode
– BT chip: CSR8510
– Tested by Raspberry Pi forum user killkrt on a Raspberry Pi running Raspbian

Other dongles based on the CSR8510:
– Sitecom CNT-524 Bluetooth 4.0 USB dongle (reported working by Thomas Rücker)
Inateck’s BTA-CSR2W, BTA-CSR4B1, BTA-CSR4B2, BTA-CSR4B3, BTA-CSR4B5
CSL – USB nano Bluetooth-Adapter V4.0: I bought one of those and it does work out-of-the-box:

Bluegiga BLED112
– Web: http://www.bluegiga.com/en-US/products/bluetooth-4.0-modules/bled112-bluetooth-smart-dongle/
– Mode: single mode
– BT chip: Texas Instruments CC2540
– Tested by: Tamás Fábián
– Note: The BLE112 the dongle is based on also has a virtual com port feature and comes with a C API. This is great for developers who want/need to dig into the BLE protocol (i.e. develop their own BLE-enabled embedded devies). Bluegiga also has their own programming language called BGScript that more abstract than C and easier to get into if you don’t know C. However, in order to flash your BGScript applcication onto a BLE112 you will need the Texas Instruments CC Debugger (a USB box and corresponding software). I have successfully used the BLELabs BLE112-Protostick in Ubuntu 12.04 LTS.