Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Thursday, February 12, 2015

HP 4000b Bluetooth Mouse and Ubuntu

This quick post cover howto get the HP 4000b Bluetooth mouse working flawlessly with Ubuntu 14.10 + (and maybe even older versions). These bluetooth mice are useful for ultra-portable devices that have no or few USB ports, like my Dell XPS 13, keeping the port free for other uses.

The HP 4000b mouse is an affordable bluetooth mouse that does work out of the box with Ubuntu but drops out after use for a few minutes or so. This post covers the solution to this problem that worked for me, and this post helpful for TLP users.

In summary, add the following to your rc.local file (the one I used was /etc/rc.local):
# Prevents the Bluetooth USB card from getting reset which disconnects the mouse
BTUSB_DEV="8087:07dc"
BTUSB_BINDING="$(lsusb -d "$BTUSB_DEV" |
    cut -f 1 -d : |
    sed -e 's,Bus ,,' -e 's, Device ,/,' |
    xargs -I {} udevadm info -q path -n /dev/bus/usb/{} |
    xargs basename)"


echo "Disabling autosuspend for Bluetooth USB Soundcard: $BTUSB_BINDING..."
echo -1 > "/sys/bus/usb/devices/$BTUSB_BINDING/power/autosuspend_delay_ms"
And in the TLP config (/etc/default/tlp), add the USB_BLACKLIST="8087:07da". The ID for my device was 8087:07dc as in the rc.local file. These IDs need to match and can be found using lsusb.

HTH
Cheers Shakes - L3mming

Saturday, August 9, 2014

Australian Dell XPS 13 Touch (9333) 2014 with Ubuntu/Linux Experiences

After many hours trying of trying to get my old laptop battery life above 3 hrs, I finally bit the bullet and bought a new laptop.

I eventually went for the Dell XPS 13 Touch (i7, 256 GB SSD, 8 GB RAM) and I'd thought I should put down a few words about my experiences for anyone looking for a good portable developer laptop.

My findings in summary: a damn fine developer laptop! Great backlit keyboard, Ubuntu works (details below), fantastic battery life, quiet and portable to the max.

Basically, weights as much as a 10" tablet, about the same size despite having a 13" Full HD touch screen. First day I took it to work and on battery compiled ITK within 10 minutes (as well as some custom libraries), installed a ton of stuff from the repositories, browsed the web, did some development and remote login work and still only consumed only two thirds the battery at the end of the day. My colleagues also loved the styling and were impressed overall.

Why not a Mac Book Pro?

I have to say the Mac was tempting. It was a little cheaper (lower spec though), probably more robust (by a little) and more battery life (only just) and Unix style OS with native MS Office. In the end, and after having used a Mac for a few weeks now for deploying some software, it became a matter of personal belief of what software should be about: FLOSS.

For example: It seems to customise and to get 'non-standard' elements working requires buying stuff. Want to write to NTFS filesystems? Buy software. Want to customise dock? Buy app. Even the open-source and free SciTE is available for purchase on the app store. Sigh. This together with no middle mouse click, no uninstall for installers and deployment issues for 10.6 and 10.9 push me over the edge and I don't regret one bit (so far... hehehe).

Installing Ubuntu

Installing Ubuntu was almost seamless. As per usual, follow all the backup routines etc. before installing. A few minor hurdles were encountered:
  • Kernel 3.14 is required to get the best battery life for i7's, thus I used distrowatch.com search page to work out the distros that had the latest linux kernel. This was OpenSUSE factory and Ubuntu Snapshot
  • I used the Ubuntu snapshot (06/08/2014) and the iso to usb installer that comes with Linux Mint (which was installed on my desktop) to put it on a USB stick since the XPS 13 has no DVD-drive.
  • Make sure to shrink the Windows partition in Windows as during the partitioning stage, it kept trying to install Ubuntu to the USB stick since it was a large (16 GB) stick and only disk with space, making it difficult to resize in the installer itself. With all the EFI stuff, it better to let the installer set it up for you. OpenSUSE installer did the same thing too.
  • After the installer finished and I rebooted, everything worked! Even the touch screen. I was shocked lol. Not usually my experience in the last 10 years with Linux of any flavour. Linux has come a long way in the last few years! Even Ubuntu looked fabulous and it was good to hear the drum sound again after being away from it for so long. ;D
  • When I say everything, I kind of exaggerated a little. the Wifi didn't because of propriety firmware that just needs linux-firmware-nonfree package installed.
  • The touch device still has a bug and is not recognised properly, though it works fine. I got middle mouse click working with three finger tap (disabled on Ubuntu by default.... wtf).
Hope this helps someone.

Cheers Shakes - L3mming

Saturday, June 19, 2010

Packaging Qt Applications for Ubuntu/Debian

I have recently attempted to get my Discrete Geometry 3D Viewer capable of building Debian packages, so that one may install DGV without needing to compile it or worry about dependencies for other Ubuntu Distros (like the question I got from a potential user).

I believed there would be a substantial discussion on how to do this for Qt applications, but I could only find the Maemo Guide useful. It gets even more difficult if you want to do multiple binaries from a single source. Hence, I have documented my findings of this topic in this blog.

Useful Links that I used:
Complete Ubuntu Packaging Guide
Qt App Maemo Guide
GPG Guide
Pbuilder Howto
Using Local Packages

Firstly, my situation is the following. I have three side-by-side dynamic libraries, dgv-base, dgv-contrib and dgv-vtk. The libraries are divided based on dependencies of Qt, None, and dgv-base & Qt & VTK respectively by design. Then there's the actual DGV application which depend on these libraries.

First the multiple libraries. Begin by renaming the source directory, with the name of the package and the version (with a dash as the separator, this is important). For example
libdgv-0.15

Assuming that your source is in the state you wish to distribute it, create the tarballs so that you have two tarballs
libdgv-0.15.tar.gz
libdgv_0.15.orig.tar.gz
Note the underscore between the library name and the version. This is very important.

Change to the directory of the source and execute
dh_make -e your.maintainer@address -c GPL
where the "-c GPL" assumes you are using GPLv3 license and "your.maintainer@address" is your email address. This will ask you a series of questions, where you should select library if you're doing a library or a single binary if you're doing a binary. I will assume a library for the aforementioned reasons.

This step will create a directory called "debian" with all the Debian package configuration files. Remove the example files, they are not needed for what we are doing as far as I know.
rm *.ex *.EX
Please read these pages of the packaging guide for the remaining files. You need to edit the control and rules files as I have for DGV (also see Maemo guide for a simple single binary example). Things to watch out for is also given in this link (at the end). Fill the changelog and copyright files as described by the package guide, making sure to use the name of the overall package where applicable and to match the author email to your GPG name. If you do not have one, you need to create one using the GPG guide to sign your packages.

For multiple binaries, there is one last step. You need to create the ".install" and ".dir" file for each package. The former has the list of files to be installed, but in a wild card format (e.g. "usr/lib/lib*.so"). The latter is where the files are to be installed (e.g. "usr/lib").Note that there is no "/" in front as per normal Linux directories from root. This is because they will be relative paths and when the real package is built, it will build it from the root. See the debian files I created for DGV here.

Now to build your package, we will use Personal Builder (pbuilder), a way to build your package using only the minimal (initial) Ubuntu base/setup plus your dependencies. This is the best part that makes constructing packages most useful. If your dependencies are correct, then the user just installs the package and Synaptic or apt-get just installs everything you need to get it going. Once a pbuilder environment is setup (which can be made to suit for building on different architectures and Ubuntu distros), the package is built with your configuration and placed into
/var/cache/pbuilder/result
Only downside is that all the base packages will be downloaded from the Ubuntu repository, which could take a while. If you can't use the Internet for whatever reason, you can still build it the packages using
debuild
when within the source directory. You might also want to do this initially to ensure that its all working correctly.

First create the pbuilder environment by
sudo pbuilder create --distribution $(lsb_release -cs) \
        --othermirror "deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs) main restricted universe multiverse"
Then build the descriptor file
debuild -S
If you did a "debuild" already, then this step is unnecessary. Once the descriptor file is present, then build using pbuilder
sudo pbuilder build *.dsc
To build as a different distro or architecture, see this. Hopefully, all works fine and you get a few packages. There might be a few warning from Lintian. Ensure that the descriptions lines are not too long or google the lintian warning. If your warning says "empty-binary-package" then your files are installed in the wrong places. For Qt projections, I install the files of the library into "debian/tmp", then move it out into the relevant package directories by using "dh_movefiles -p$@ -Xcontrib -Xvtk usr/lib" command in the rules (see the wiki). The "-Xitem" tell the movefiles app to ignore the files with the string "item" from the file names.

Finally, on a Live CD or clean install, check you packages by installing them. Pbuilder didn't pickup the fact that I had incorrectly named libvtk5.2 as libvtk5 for one of my packages, so I recommend it.

I then build the dgv application and its all done. Hope this helps. I will post up more on how to use local packages later when I have it working.

Cheers Shakes - L3mming