Thursday, June 30, 2016

Installing Ubuntu on a MSI GS60 6QE (Ghost Pro) laptop (and fixing issues)

This guide explains how I managed to install Ubuntu 16.04 (Xenial Xerus) on a MSI GS60 6QE (Ghost Pro) laptop, equipped with a Qualcomm Atheros QCA6174 802.11ac [168c:0003] wireless chipset and a NVIDIA GeForce GTX970M graphics card. The encountered issues and fixes may be valid for other MSI laptop models and even other makes with similar chipsets.

  1. Problem: Cannot install the distribution.
  2. Problem: Can see wireless networks but not connect to them.
  3. Problem: Some tasks freeze the laptop, like running lspci, suspending, shutting down or rebooting the laptop. This is because one CPU core stays at 100% indefinitely, somehow turning the laptop unusable.
  4. Problem: Screen brightness keeps changing values every now and then.

 

Problem #1: Solving the installation issue

  • Enter the BIOS Setup by pressing the DELETE key at the beginning of the boot sequence and select:
Boot > Boot mode select: UEFI with CSM
Boot > Fast Boot: Disabled
Boot > Boot Option #1: <select your USD device here>
Security > Secure Boot: Disabled
  • Boot your Ubuntu installer (from an USB drive) and wait for the GRUB (bootloader) screen.
  • Scroll down to the Install Ubuntu entry and press the 'e' key.
  • Before quiet splash, write:
nomodeset
  • Press F10 to run the installer with the new configuration and it should now run fine.
  • Connect an ethernet cable (your Wi-Fi card won't work at this point yet) and check:
Install third-party software for graphics and Wi-Fi hardware...
  • After installation and reboot, enter BIOS Setup again and select:
Boot > Boot mode select: UEFI
Boot > Fast Boot: Enabled
 DON'T re-enable Security > Secure Boot (more on this below)
  • Remove the USB drive save the new settings, exit BIOS, and let Ubuntu boot successfully.

 

Problem #2: Solving the Wi-Fi issue

  • Connect to a wired network, open a Terminal, update your packages, and tweak the wireless adapter as follows:
sudo apt-get update
sudo apt-get upgrade
echo "options ath10k_core skip_otp=Y" | sudo tee /etc/modprobe.d/ath10k_core.conf
  • Reboot just to be sure, and your wireless adapter should be fully functional.

 

Problem #3: Solving the CPU core at 100% issue

  • Select:
System Settings > Software & Updates > Additional Drivers
    Using NVIDIA binary driver
  • Reboot and make sure Secure Boot is disabled in the BIOS once again. Otherwise, you will find yourself in a loop when you try to login.

Problem #4: Solving the screen brightness change issue

I haven't investigated a solution for this issue yet, since it is not a showstopper. I will update this post in the future. Please let me know in the comments if you know of a solution.

Sunday, December 9, 2012

Iris: more HTML5 Canvas pixel manipulation fun

After I wrote the plasma effect quite some time ago, I wanted to give it a shot at improving the performance of such a pixel manipulation demo. And so I wrote a similar demo called Iris that will generate a random sequence of patterns and effects each time you run it.




The result is quite impressive when running in Chrome on my Ubuntu laptop with full HD resolution, where I get 60 FPS consistently. Unfortunately, Firefox achieves only just above 30 FPS, while Opera gets just under 30 FPS. Enjoy the Iris live demo yourself.


Wednesday, August 15, 2012

Auto-synchronized development environment with Dropbox

Every now and then, I'm forced to work on a brand new machine. Be it a new laptop at home, a new build farm in the office, or just some temporary workstation of any kind. Since I'm lazy and fond of having computers do stuff for me automatically whenever possible, I found myself thinking why I had to reconfigure Bash, Vim, QtCreator and all sorts of tools I use for work over and over again. Every time you make a change in one of your workstations, you'll have to copy entire files or text sections around in order to get the same configuration in the office, at home and everywhere you wish. By configuration I mean shell aliases and environment variables, editor settings, and also my ~/bin folder that contains loads of useful scripts.

Surely, this can be achieved with a version control system like git, but I wanted something even easier, more automatic and straightforward. Since the cloud is the word of the day, wouldn't it be cool to have all my settings and scripts synchronized automatically with some cloud service? I happen to prefer Dropbox by far for a variety of reasons. So I gave it a try and found out it's trivial to reach the goal. Let's assume for the sake of simplicity that all you want to have available in all your machines, always up-to-date, is ~/.bash_aliases. These are the only required steps to get it done:

  • Install Dropbox. Let's assume the default target directory ~/Dropbox.
  • Create a folder inside it, say home, that relates to your user home directory:
mkdir ~/Dropbox/home
  • Make sure Dropbox is set up to synchronize ~/Dropbox/home
  • Move your Bash configuration to the synchronizable space (i.e. your private cloud). You probably want to rename it so that it doesn't contain the initial dot and stays hidden:
mv ~/.bash_aliases ~/Dropbox/home/bash_aliases
  • Create a symbolic link to this new file from your home directory, and have Bash think it's fetching the configuration from its usual place:
ln -s ~/Dropbox/home/bash_aliases ~/.bash_aliases
That's it. To make it even cooler, I've created a script that performs all the moving and symbolic linking for all files I wish to have synchronized at all times, everywhere. Then, the only task I need to manually repeat every time I add a new machine to my context is the very first one, the installation of Dropbox, making sure that the folder home will be synchronized. All that is missing is running the said script in the end. The script is obviously in the cloud too, in my synchronized ~/bin -> ~/Dropbox/home/bin folder. This works wonderfully for me, I hope you find it useful too.

Thursday, July 26, 2012

Automatic recursive photo renaming by EXIF Date

I had a problem to solve: rename my entire photo collection using the EXIF Date info contained in the files. I wanted a solution that was both quick to come up with and write, and that performed just fast enough.

I keep all my pictures in a structured folder hierarchy. For instance, I can have a folder just for Person X, Home or Family. Over time, I can add more and more files to that directory. The problem with this is that photo taking devices (cameras, phones, etc) usually adopt some kind of sequential numbering to name the files. This means that whenever you erase the device's memory or reach the max photo count, you're back to the beginning of the sequence.

The result of this strategy is that when you look at, say, Person X's folder, you are not seeing them in chronological order. Sure, there are file managers that allow the user to sort the list by EXIF Date or something else, but I wanted a system that would sort the images correctly no matter where.

The obvious way to do this is to rename the files with the time stamp of the moment they were taken. To ensure that there's no collisions, a precision to the seconds magnitude should be enough. So you end up with something like YYYYMMDDhhmmss.jpg.

I ended up writing a Bash script that used ImageMagick's convert tool, but I found the renaming process to be extremely and unnecessarily slow. While I was starting to consider writing a good old C/C++ or even Qt program, I got acquainted with libexif/exif (readily available for installation on Ubuntu). A quick test proved it would be a much faster option.

The final result is pictime. At the time of writing, it offers the user the choice of verbosity, simulation, and recursivity. It won't rename pictures it finds that do not contain a valid EXIF Date. It searches for all files ending in .jpg or .jpeg (case insensitive). When I was confident enough about its stability, I finally ran it through my entire collection of photos that I store on an external USD hard drive, without the simulation flag. It went through dozens of thousands of pictures and renamed them, in place, in just a few minutes.

It suits all my needs - at least for now - but if you find it useful and realize you need to add more behavior to it, your contribution is more than welcome. Enjoy!

Tuesday, March 15, 2011

Event Recorder for Android Web Applications

In case you missed it, here's another tool I worked on at Sencha with Jan Erik Hanssen. If you develop web applications on Android devices there's a chance it will be very useful for you to test them.

Friday, November 5, 2010

Remote JavaScript debugging on Android

This little tool is one of the things I've recently been doing at Sencha.   Until Web Inspector has remote capabilities, RemoteJS can help you debug your JavaScript code sanely, either with a nice GUI or in a Python-scriptable shell-way .  Check my Sencha blog post for details.

Sunday, October 17, 2010

Pixel Manipulation: Qt vs. HTML5 Canvas

(see the live interactive demo and the demo video)

Since I've been working on the web technologies side of things after I left Trolltech/Nokia, both at Qualcomm and now Sencha, I tend to think a lot more in terms of HTML5 rather than C++ or Qt. This used to be true for non-graphical magic only, but all is changing. I wanted to check the performance of pure pixel manipulation on the web compared to a native-code application. I remembered a wicked cool VGA mode 13h plasma effect written in Turbo Pascal (and some mixed x86 Assembly code) by me and another first-year college fellow some 12 years ago. It used a palette rotation technique, extremely useful in the old 8-bit indexed video cards.

I focused on porting it to Qt and adding full control of every parameter via keyboard to throw in some extra coolness. I first used an Indexed8 QImage because it kind of emulates the old frame buffer, but the extra color conversion costs when blitting made me go for a full-color canvas.


To my surprise, it also worked quite well on a S60 device running Qt's Symbian port. Same went for a Nexus One running the experimental and unofficial Qt for Android. Thesource code of the native side of this experiment is available at the X2's repo widget folder. Below is a (rather laggy and compressed) video capture of the demo.





After I got my Canvas version running, the results were rather disappointing: 5-20 fps depending on the browser. Due to my newbie nature with JS, I was almost sure the issue was in my code (i.e. Canvas couldn't be that bad). That's when I found a great presentation by Nicholas C. Zakas. After applying his tips on JS optimizations, the frame rate fired all the way up to ~60 fps on all browsers, achieving the same performance as its native cousin. The code was definitely uglier and harder to read, but the performance felt natural.

All's not that great, though. For high resolutions, Canvas won't be able to maintain the high target frame rate. Let's face it, manipulating all pixels in every frame is an extremely heavy operation. However, this is not a common use case, even less with high resolutions, even less happening in real-time.

I believe canvas was more designed to support image and music editing, relatively lightweight gamesvisualization widgets, and a bunch of other ultra cool applications. And, for most of it, it's quite there already. Higher-resolution and heavier stuff will get its prime time very soon with WebGL, and I believe it will change the way we use a computer and browse the web completely.

See the Canvas implementation source code, and make sure you don't miss the live demo.