Dell L502x Optimus support on Ubuntu 14.04

The Dell XPS L502x is a hybrid graphics portable from few years back (2011?). It came with Windows 7 by default and as we all know Optimus technology (switching between the low-end Intel HD3000 graphics engine and mid-end NVIDIA GeForce engine) is working more or less flawless on the Windows OS. On Linux however things have not been so great, users had to fiddle around with the Bumblebee package which eventually would or wouldn’t work, plus if you wanted to use the power profile one had to run the application by adding the ‘optirun’ command (ex: optirun glxspheres).

More recently NVIDIA has done some improvement on their behalf into supporting Optimus by deploying the nvidia-prime package. And as of Ubuntu 14.04 this is also available in the LTS release, however in my experience it was not working… Running the ‘nvidia-settings’ command gave me a “PRIME: is it supported? no”-message. So how did I fix it?

Well first open “Software & updates”, go to the last tab that is about hardware drivers and install the Nouveau display driver. Newt open a terminal and run following commands:

sudo apt-get purge bumblebee*
sudo apt-get purge nvidia-*

Now reboot. When you’re logged in again, open the same drivers tab of the “Software & updates” window you’ve opened previously, and now again install the NVIDIA binary driver (nvidia-331-updates). Afterwards check if all necessary packages have been uinstalled, so run following commands:

sudo apt-get install nvidia-settings
sudo apt-get install nvidia-prime

If all went well during the driver install running both these commands should not install any extra packages. Now reboot again. When logged again, run again ‘nvidia-settings’ in a terminal, now you should see the following message: “PRIME: is it supported? yes”.

Schermafdruk van 2014-04-30 12:21:30


Self Synchronizing Wifi Clock

In a previous serie of articles I showed you my progress in writing a Arduino Due driver for the Adafruit 16×32 LED matrix. Last few days I’ve focussed more on adding support for a simple font and displaying text characters, but actually during this implementation I discovered the solution behind 2 programming mistakes that were still left in the driver code. With this solved, I starting thinking about how to implement a font. After thinking of my own way of implementing this I also looked at how it was done in the original driver for Arduino Uno and actually some of the ideas matched. So I could really easy copy, adjust and implement the code for displaying characters, displaying ‘HELLO’ is now a matter of writing 6 lines of code!

After this I implemented code for reading a I2C compatible ADT7410 temperature sensor and use it for displaying the room temperature. Next I included and implemented code I’d already written before which allowed me to use the Adafruit C3300 (Wifi / SD) shield. The code connects the Arduino to the local WLAN and do NTP request to synchronize a software made clock with the internet. Furthermore it can also read and write data from/to an SD card. The SD card is used to hold the WLAN settings, it does this at boot time and it is only milliseconds later when it will use this data to configure and make the WiFi connection to you LAN. Voila, altogether there we have it: an Arduino based self synchronizing clock!

One year with Ubuntu Linux

If we define a year by it being 365 days long, “one year with Ubuntu Linux” might actually be a lot closer to “one and half years with Ubuntu Linux”, or even “two years with Ubuntu Linux”. The fact is that I can hardly remember when exactly I did my last disk format and re-partitioning. Neither is there something as an exact date at which I switched from Windows to Linux, it was more like a very smooth transition in which I slowly became more used to using Ubuntu and actually started using it for daily use. In the end I don’t regret starting to use Ubuntu, in fact I still use it as my daily operating system. But is it than so much better than Windows? Well, maybe not, I presume it depends on who asks the question. But let me first tell you how I came thus far.

In Windows 7 era I was using the Microsoft OS for daily work.  On the dual partitioned disk there was also a very small partition of my disk which had Ubuntu (12.04?) installed on it but I used it only to try to know Linux a little bit better. Enter Windows 8, after trying Win8 in a virtual machine I wanted to get used to it and changed it in for Windows 7. However, me, as many others, I didn’t like the new way of working in Win8. I remember the first time wanting to shut down the system but not finding the power off button, big mistake Microsoft. And so Ubuntu came to get installed on a bigger partition, and I noticed more or less from this point that Ubuntu had a lot more desktop feel than Win8 had in the beginning. So, I starting using Ubuntu a lot more from this point. The downside of moving to Linux is that a lot of popular software does not have Linux compatible binaries and so the search for replacement software started. In the beginning I had to sometimes plan my work I wanted to do: do some of the stuff on Linux, and for the software that works only on Windows reboot and boot into Win8. But as you move on you get to know the Linux alternatives for Windows software, although not always as good as the real deal in many situations you can perfectly move along. Moving further in time I’m now at a point where it can take weeks or even months before I find myself back in the Windows environment. I no longer depend on it. So you may ask, was it worth all the trouble?

Well, as I said before, Ubuntu really has a nice desktop feeling. Quick launch icons on the left, perfect for not using to much vertical space on wide screens. A kind of start button that after you use it you can just type the name of the application and launch it. The software center allows you to easily install new software. Also my password is being asked which means not everyone is able to install new software on my machine even if I’m already logged in. Dragging a window to the side of the screen will also make it full screen, or half screen depending on which side you dragged it. Oh yes, and it’s free. Although many of these handy features listed here can also be found in the Microsoft OS, this means Ubuntu is not really poorer on the “useful desktop tricks” side of things. Furthermore it is really stable when it comes down to resuming from sleep and also installing updates hardly ever requires a reboot. Updates or always installed while you’re using the machine, it is doing this in the background and so you hardly notice it happening. Remember how it works on Win8, updates often take a lot of time when shutting down or rebooting the machine because MS just can’t update some processes while they’re running.

But there are also some drawbacks. First of all: hardware support. Although 2014 looks to be a very good year for desktop Linux, hardware drivers are not always working as good as their Microsoft alternatives are. For example, on my portable there is no way I can get the seconds display output working. Secondly, software: although there are free alternatives for Photoshop and Autocad, they do not always work as good as the real deal does. Even though I use GIMP every now and then, I’m still a lot more productive in Photoshop than I would be in GIMP. Third: games. Linux and gaming have not the best relationship. It’s only since the efforts made by Valve that now more and more A titles are being ported to Linux. As I said, 2014 might be the year of change for Linux. Quatro: using the terminal. The terminal itself is not so bad, still I can not believe it sometimes that for running some binaries I still need to open a terminal and run the ./whatever command. Or, you need to install something but it involves copying some commands found on the internet into the terminal and execute them before you can actually proceed. Why is it not always just click-and-play as it is with Windows?  Although this can sometimes get really annoying, it’s often not a Ubuntu thing. What can Canonical do about AMD not wanting to support some of their hardware for Linux users? Why would Adobe want to bring Linux compatible binaries of Photoshop if 99% of their users will probable still be on Windows/MAC? Often the lack of support is a commercial thing, so for 2015 I guess we don’t need to expect any miracles to happen as far as Linux support goes. On the other hand, since I first tried Ubuntu I can see slow progress everywhere and knowing that Ubuntu is already a very decent replacement for Windows I think I’ll stay a the Ubuntu side for another year. Maybe two.

Progress: Adafruit 16×32 LED matrix on Arduino Due (5)

Past couple of days I’ve been working on abstracting and hiding the actual display driver code from the main Arduino project., this involves writing C++ code in an object oriented way. Although I’m used to work with objects in Java and C#, my experience with C++ classes, arrays  and pointers is rather limited. And so it took me quite some time to get it all working in an n-tier architecture, but in the end trial and error got me through it and at this moment it is working more or less okay. The phone camera is still taking messy pictures, but you get the picture I’d guess:

2014-04-12 11.43.17


The benefits from using this n-tier architecture is that now all driver code and display logic are concentrated in the same file, plus one can easily replace the driver without affecting code at other layers. While the color correctness is still not 100% working okay, my next goal is to add more logic that allows me to easily draw chars or circles or whatever. Furthermore it would also be great if I could send images over the serial bus and finally put some use to the driver I’ve been working on past few weeks. In the mean time also have a look at this guys project: He uses the same panel but instead uses an FPGA as hardware platform to drive the display. He clearly shows the power of FPGA’s in driving displays, to do the same in sequential microprocessor code things would get really complicated if not impossible to do.