technology
Linux on Sager P8950 / Clevo P950HP6
by TrueJournals on Jun.04, 2017, under hardware, technology
Writing this post in the hopes that someone else wants to run Linux on this laptop, and doesn’t have to go through the same struggle I’ve gone through.
This post is accurate as of 2017-06-04 — I can’t guarantee that I’ll update it in the future. If more than 6 months has passed, the information here is likely outdated. Where possible, I’ll try to list sources that should contain up-to-date information.
I’ll try to organize this chronologically with what you’ll need to do to get everything up and running. Note that this sometimes involves going back and changing things.
All of this is written for Fedora 26, since that’s what I’m using at the moment. It should basically apply to other distributions, but you may have to tweak some things. That’s left as an exercise to the reader 🙂
First boot stability: dealing with Optimus
This laptop contains nvidia Optimus technology, which allows optionally using an nvidia graphics card for certain applications and powering it down when not necessary to save power (it’s actually unclear to me if this is “really” Optimus, or actually “MSHYBRID graphics”, but they seem interchangeable for our purposes). Unfortunately, Optimus seems to introduce a lot of weird interactions with ACPI, which can cause instability with how Linux advertises compatibility by default.
So, let’s fix that (otherwise, you’ll get random system crashes). You’ll need to add acpi_osi=’!Windows 2015′ to your kernel command line for this. So, edit /etc/default/grub and add that somewhere inside GRUB_CMDLINE_LINUX. It’ll probably look something like this:
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet acpi_osi='!Windows 2015'"
This gets us to a stable system which can turn off the nvidia card (you’re switching using prime). Unfortunately, we need a newer kernel if you want nouveau to actually work (support for GeForce GTX 1000 series lands in 4.12, Fedora at the moment contains 4.11.3). I’ve built 4.12 for myself (it’s easy — see Fedora’s instructions, or use Fedora Vanilla Kernels)
Getting Audio working
I’m working on sending this information upstream to get things working even better here — I’ll try to add a link to the bug report / more information when it’s available.
You may now notice that your audio doesn’t work. The below appears to work with Kernels >= 4.11. You’ll need at least 4.11 for Realtek ALC1220 support.
The default ALSA model doesn’t seem to work with this laptop, so you’ll need to change that. I’ve used two models that work: no-primary-hp and dual-codecs. I’d recommend no-primary-hp, since it seems to work slightly better.
To change your model, create /etc/modprobe.d/alsa.conf with the following:
options snd-hda-intel model=no-primary-hp power_save=1
(Note that I’ve also enabled power saving here, which should also help with battery life)
Reboot and you’ll notice… sound doesn’t quite work yet. There’s one more quirk here. By default, the laptop boots with the “headphone” audio control muted. Unfortunately, this is the control that really sets the volume of the speakers! So, each boot you’ll need to unmute the headphone volume and turn it up (I’ve been so far too lazy to investigate how to do this automatically). You can run this command to set everything up properly:
amixer -c 0 sset Headphone 100% unmute
Nvidia Performance: Switch to Proprietary Drivers
NOTE: External monitors will not work in this configuration! If you need external monitors, you’ll want to skip this step, but you’ll lose some performance on the nvidia GPU. It’s unfortunate that this trade-off exists at the moment 🙁
Next, switch to the proprietary nvidia driver to get better battery life, since I didn’t have good luck with the open source drivers. To do this, you’ll want to install Bumblebee. Since I’m using Fedora, I just followed the instructions on the Fedora wiki:
sudo dnf -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora$(rpm -E %fedora)/noarch/bumblebee-release-1.2-1.noarch.rpm sudo dnf -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora$(rpm -E %fedora)/noarch/bumblebee-nonfree-release-1.2-1.noarch.rpm sudo dnf install bumblebee-nvidia bbswitch-dkms VirtualGL.x86_64 VirtualGL.i686 primus.x86_64 primus.i686 kernel-devel
Reboot and bumblebee should be working. You can use “primusrun” to run things on the nvidia card.
Fancy Keyboard/Fan Control
Last step is being able to configure the backlight, and fan control (if you want). For that, you’ll need the clevo-xsm-wmi kernel module. For simplicity, I have a fork which adds recognition of this laptop. Pull that down, and compile the kernel module:
git clone https://github.com/TrueJournals/clevo-xsm-wmi.git cd clevo-xsm-wmi ./install
This will create a dkms module for the driver so it’ll be automatically re-installed with any kernel updates. With this, the keyboard backlight keys should work as expected (so you can turn the backlight off if you want, or change brightness). There’s also a little GUI utility if you want to set custom backlight settings, but I’m not going to get into that for this blog post (I just want the shortcuts to work so I can turn the backlight off or lower 🙂 )
Outstanding Issues
That should basically do it — you should have a laptop with decent battery life, working sound and good graphics (use primusrun to use the nvidia card, or DRI_PRIME=1/GNOME “dedicated” option) under Linux!
Of course, there are still some outstanding issues I’ve been fighting…
- primusrun seems to cause a crash occasionally. Recently, I somehow put myself in a sate where I can’t oepn steam without the whole OS crashing
- primusrun has some trouble with certain Steam games (having trouble with Portal 2 specifically, but haven’t don’t much testing)
- You’ll need to modify each game in steam for primusrun by modifying it’s parameters to “primusrun %command%”
- You can experiment with running steam itself under primusrun, but I’ve had trouble with this
- For open source drivers, launch steam on dedicated graphics card (or change parameters to DRI_PRIME=1 %command% ? — haven’t played around with that)
- External monitors don’t work with bumblebee
- It’s my understanding that external monitors can work with bumblebee, but that basically requires keeping the nvidia GPU on all the time. Personally, I’m sticking with the open source drivers, at least for now. I know Fedora is working on improving the whole situation here, so hopefully things will get better in the future.
Links for up-to-date information
- ArchWiki, NVIDIA Optimus
- Fedora wiki, bumblebee
- Information about nouveau/PRIME
- clevo-xsm-wmi upstream (Linked above is my fork with support for this model and fan control. Working on getting model support upstream, but fan control was added by someone else)
“I’m always worried I’m going to blow something up”
by TrueJournals on Aug.07, 2012, under technology, thoughts
For the past two summers, I’ve worked at a level 1 tech support job at my college. For those unfamiliar with this jargon, this means that I’m the person who sits at the help desk, and attempts to help out anyone who comes into the desk, or calls the phone, or e-mails us. Technically speaking, it’s a pretty simple job, as we do some basic troubleshooting, then bump any issues up to level 2 if we determine we need to fix something in person.
Today, I was on the phone with someone, and they inadvertently reminded me of the difference between “technical” people and “non-technical” people.
The phone call was simple: Gmail brought up a page reporting that the person’s browser was out of date because they were using Internet Explorer. I suggested that he install Chrome, as it is a faster and more secure web browser, and now our “officially supported” browser, and proceeded to walk him through the installation.
And when I say walk him through the installation, I mean walk him through every step of the installation. Every button he should click, when he should click them, etc. During this process, he explained to me why he was asking for my help at every step of the process:
I’m always worried I’m going to blow something up.
So, this is the difference between “tech” people and “non-tech” people: the non-tech people think that if they click a wrong button, their computer will either explode, or stop working permanently. The tech people have opened their computer to find that no explosives are contained within.
One of the things I enjoy doing is breaking my operating system. I use Ubuntu Linux as my main operating system, and regularly do stupid things that might be considered destructive. But that’s OK — I know that I can always get my data, and I enjoy going through the processes of figuring out what went wrong, and how to fix it.
In a word, I’m fearless when fixing computers: I know that if I click the wrong button, there’s always a way to go back or undo whatever I just did. Sometimes, this is as simple as clicking a “back” or “undo” button. Sometimes it’s a bit more involved, but that’s OK! Because it means I’m going to learn what doesn’t work, and possibly learn something more about my operating system while I attempt to fix what’s broken.
If there’s one piece of advice I can give to non-tech people, it’s this: don’t be afraid to click buttons. Seriously. Most buttons you press are not going to permanently destroy your software. If you’re worried about losing data, make a backup of whatever file you’re working, then click buttons to your hearts content!
Building a Better WHD Notifier
by TrueJournals on Jun.29, 2012, under programming, technology
At my work, we use Web Help Desk to track support tickets. It’s a very nice, very slick piece of software, and from my understanding, version 10.2 implements an API going forward. Unfortunately, we use version 10.1.10.1, which doesn’t have the same API.
The problem I ran into was this: often, there are other tasks to be completed, so I’m not just staring at the WHD ticket queue the entire time I’m at work. However, if a client logs a ticket, I have no way of being notified without going to the web help desk page and checking manually. This results in one of two things happening: either I check the ticket queue every few minutes, breaking my workflow on other projects, or a ticket doesn’t get responded to for a while.
I wanted a way to be notified of new or updated tickets that pop up without having to continually go back to the WHD tab of my browser to actually check for new or updated tickets. Unfortunately, without an API, I thought this was going to be difficult. Until I found this: a WHD Notifier for Chrome.
However, this still didn’t quite achieve what I was looking for. While this did provide me with a notification of the number of new or updated tickets within the browser, it didn’t notify me when this number changed. So, I still had to watch my web browser, and even then, continually check this small, inconspicuous number in the top-right corner of my screen. Since Chrome extensions are simply Javascript, HTML and CSS, I decided to try my hand at modifying it to better suit my needs.
Here’s the list of things I needed:
- Pop-up notifications of a change in the number of new/updated tickets (like in Gmail).
- The ability to not save username and password. The computers share a single profile between multiple users, so I don’t want individual passwords saved past the browser session.
- (Optional, if I could figure it out) Grabbing login info from the WHD web login, so you don’t have to go into the extension options every browser session.
After some coding, a lot of trial and error, and a lot of research, I was able to meet all three goals. If you’d find it useful, you can download WHD Notifier version 1.5. Simply configure it with your WHD URL, choose what to display/be notified of, and you’re good to go. If you login to web help desk, the notifier will grab that login information and start updating.
If you’re interested in seeing the source code for this extension, you can find a zip of the source here. I’ll see if I can throw it up on GitHub later today or this weekend. There’s some interesting things being done here — submitting the login form in WHD sends a call to forms.submit() instead of going through the normal submit procedure — this means that I couldn’t simply add an onsubmit handler to capture the login information.
Instead, I inject another piece of JavaScript into the page which overrides the submit() method for all forms. This calls chrome.extension.sendMessage to message the background page with the username and password, then proceeds to call the submit() method I had overridden. You can find the form handling things in autoLogin.js and autoLogin2.js. I had to inject autoLogin2.js on the page because chrome content scripts aren’t allowed to override prototype methods.
If we ever update our WHD installation, I’ll try to update this extension again to use the new API — I should be able to add some more features with that, too. For now, this should work for all versions of WHD 10.0.8 or later.
Update:Code is now on GitHub
Automatically Associating Label and Input, and Setting Width
by TrueJournals on Jun.26, 2012, under technology
When creating forms in HTML, one of the best practices is to always use <label> to associate the labels with their form fields. However, this creates the complication of needing to give each label the “for” attribute, and perhaps wanting some extra magic to set the width of each label so that all the form fields are lined up. Recently, I decided to play around with form fields like this a little to see if I could automate this process using jQuery.
Here’s what I came up with:
var w = 0; $("label").each(function() { if($(this).width()>w) w=$(this).width(); // Assume the input immediately follows the label var input = $(this).next(); input.prop('id', input.prop('name')); $(this).prop('for', input.prop('name')); }); $("label").width(w+10); $("label").css('float', 'left');
And here’s what it does: first, it loops through each label on the page looking for the maximum width. When it finds that, it sets all labels to have a width of (maximum width)+10px. The extra 10px are just so the label and field aren’t directly on top of one another.
In the same loop, this code associates the label with the field next to it. For my sake, I made the assumption that I will always have <label>…</label><input />. If this is not the case, the code will associate the label with the wrong field. It simply sets the next element’s id to be the same as its name, and sets the label’s “for” property to be the element’s name, also.
Use this with caution. If you’re not careful, you could end up with duplicate IDs (a no-no). There are other reasons this code isn’t necessarily a good idea, but it’s good enough for me. For a page with a lazy HTML coder, this will work perfectly.
Bonus: Add input.prop(‘placeholder’, $(this).text()); inside the loop to also set the “placeholder” text to whatever the label is. You could also detect if the browser supports “placeholder”, and hide the label if it does:
var w = 0; $("label").each(function() { if($(this).width()>w) w=$(this).width(); // Assume the input immediately follows the label var input = $(this).next(); input.prop('id', input.prop('name')); input.prop('placeholder', $(this).text()); if('placeholder' in document.createElement('input')) $(this).hide(); $(this).prop('for', input.prop('name')); }); $("label").width(w+10); $("label").css('float', 'left');
Conditional Formatting in Google Docs
by TrueJournals on Jun.05, 2012, under technology
Recently, I was working on a project which involved generating aspreadsheetof a bunch of changes I was making to some information. As part of this, I wanted to color code the rows of the spreadsheet: green would mean OK, yellow would mean a change, and red would mean a problem. I could do all this formatting manually… but I decided to find a way to make Excel do it for me. Enter conditional formatting!
Conditional formatting in Excel is very, veryrobust. For this project, I needed to change a row’s background color and font color based on three possibilities:
- If Column E has any text, the row should be red.
- If Column A and Column D contain different values (case-insensitive), the row should be yellow.
- Otherwise, the row should be green.
Unfortunately for me, Excel’s conditional formatting works on a per-cell basis. However, Excel does provide the ability to choose conditional formats based on a formula! After some fiddling with Excel functions, I was able to generate formulas to check different cells in the row, then apply the conditional formatting based on that. I ended up with these three formulas, executed in this order, and corresponding with the above three conditions:
- =AND(CELL(“contents”, INDIRECT(CONCATENATE(“E”, ROW())))>0,ROW()>1)
- =AND(CELL(“contents”, INDIRECT(CONCATENATE(“A”, ROW())))<>CELL(“contents”, INDIRECT(CONCATENATE(“D”, ROW()))), ROW()>1)
- =AND(CELL(“contents”, INDIRECT(CONCATENATE(“E”, ROW())))=0, CELL(“contents”, INDIRECT(CONCATENATE(“A”, ROW())))>0)
Wow! First, notice all of these start with an AND function. AND evaluates the conditions given, performs a logical AND on all of them, and returns a boolean true or false based on that. Explanation of the conditions:
- Two conditions:
- CELL(“contents”, INDIRECT(CONCATENATE(“E”, ROW())))>0 checks for text in Column E. If there is nothing in the cell, the value is 0.
- ROW()>1 checks if this cell is NOT in the first row. The first row is my header row, and I don’t need that one color coded.
- Two conditions:
- CELL(“contents”, INDIRECT(CONCATENATE(“A”, ROW())))<>CELL(“contents”, INDIRECT(CONCATENATE(“D”, ROW()))) checks if the contents of the cell in Column A and the contents of the cell in Column D are different. The <> operator is “not equals”, and Excel seems to automatically do a case-insensitive comparison.
- ROW()>1 checks if this cell is NOT in the first row.
- Two conditions:
- CELL(“contents”, INDIRECT(CONCATENATE(“E”, ROW())))=0 ensures that Column E is empty. (Again, the value is 0 if there is nothing in the cell)
- CELL(“contents”, INDIRECT(CONCATENATE(“A”, ROW())))>0 ensures that there is some value in Column A. If there’s no value in Column A, there’s no point in any highlighting.
Alright… So, with all those conditions set up, text is automatically highlighted based on what values are entered. This made editing the spreadsheet really easy: simply type in values, and the highlighting is automatic. If I go back and change something later, the highlighting changes without me needing to do anything. (continue reading…)
Are Penny Auctions a Scam?
by TrueJournals on Jul.17, 2011, under technology, thoughts
If you haven’t heard, someone was lucky enough to buy a Chevy Camero for only $5.28. Now, if you actually read the article, you’ll notice a very important detail: this car was bought off a “penny auction” site. These sites, like quibids.com, are becoming more and more popular. Recently, I’ve had a couple of my friends ask me my opinion on these sites: are they a scam? It certainly sounds too good to be true. But, I will give this sites credit: real people do win real items from these sites. In this sense, these sites are not a scam.
So, how exactly do these sites operate? How can anyone run a profitable business by selling $1,000 products for about $20? The answer isn’t generous owners. While we might like to think that there are people that generous in this world, it’s simply not a sustainable business model. Click through to the rest of the post, and I’ll do my best to explain how these sites work, and why you shouldn’t (or maybe should) waste your time.
(continue reading…)
Obligatory Google+ Post
by TrueJournals on Jul.03, 2011, under technology, thoughts
Well, here it is — my actual post about Google+.
For those of you who still haven’t heard, the bird is the word Google+ is Google’s new social networking experiment. Their response to Facebook, if you will. Google has more-or-less tried this before, with Buzz, but Buzz never really took off. At this point, it’s difficult for me to tell what Google’s strategy is for how Google+ and Buzz will coexist. Right now, they seem to be completely separate, yet strangely intertwined. I have a feeling that as Google+ develops, it will eventually completely replace Buzz.
I hope this is helpful. Unfortunately, I’ve left out screenshots for now. I’ll try to get some in later this week to better illustrate what I’m talking about. Added screenshots July 4 @ 11:50 PM.
Now that you know what Google+ is, click through to read an overview of my view of the evolution of Google+, a review of the UI, and my general thoughts on things.
(continue reading…)
How I Wrote My First Software Crack
by TrueJournals on Jun.22, 2011, under technology
Before I really get into this article, I need to place a couple notes here:
- This is a semi-technical post. It assumes some knowledge of programming and how software works, but I’ll try to keep it as simple as possible.
- I’ve done my best to not give away what application I’m writing about. This is on purpose. While this is an interesting look into hacking software, getting around DRM is, to the best of my knowledge, illegal. This article is actually about reverse-engineering, not cracking software.
- If the author of this application finds this blog post and thinks I’ve given away too much, they should please e-mail me and I’ll take it down. If you think this article is about your application and it is not, however, I will not remove the article.
- If you like software, buy it! Seriously… software developers need to eat, too!
Now, let’s get into the bread and butter of this article!
Why Net Neutrality is Important
by TrueJournals on Aug.20, 2010, under life, technology, thoughts
I can’t believe I haven’t written a blog post about Net Neutrality. For those of you who know me personally, you should know that I’m a very strong supporter of Net Neutrality, and believe it’s very important that we make sure the Internet is kept neutral. However, for whatever reason, there are a LOT of misconceptions about Net Neutrality, and what exactly it entails. Since Net Neutrality in reaction to Comcast has once again come up in the news recently, I figured I should write a blog post about the subject.
First, let’s go into some background on the Comcast case. A year or so ago, Comcast decided that its network was beingcongestedby too much P2P traffic; namely, traffic from the BitTorrent P2P protocol. So, they decided that they would clear their network of this congestion by carefully denying BitTorrent connections. They did this by looking into the traffic that BitTorrent was sending over the network, and sending back false information so that connections to peers would fail. The actual details of how this was done is outside the point of this post.
After some outrage from Comcast customers who used BitTorrent, the FCC decided it would step in and tell Comcast to stop or suffer consequences. As soon as this happened, there was some question about whether or not the FCC actually had the power to do this. But, the case went to court and a judge decided that the FCC did have the power to do this, and that Comcast had to stop denying BitTorrent connections in this way. This was a major win for users of the Internet: the court decision basically meant that your ISP can’t deny you from accessing information on the Internet. (continue reading…)
Should I Defrag?
by TrueJournals on Mar.16, 2010, under technology
If you use a computer (and, since your reading my blog, I assume you do), you might have heard the term “defrag” at some point or another. Maybe instructions for installing a program said you should defrag your harddrive before you install it (I believe “The Sims” had this in their instructions), or perhaps you’ve just heard one of your friends use the word. Today, Ireceivedan e-mail from my dad asking me a seemingly-simple question: “Should I periodically de-frag my laptop? What does this do? How do you do it?” My response, however, was a bit more complicated.
In this blog post, I’m going to attempt to explain, very simply, what defragging a harddrive actually does, and why you should, or shouldn’t, do it. Some of my more technically inept readers may think I’m oversimplifying things by not dealing with the different filesystems, not explaining exactly how data is written, etc., but that’s not the point of this post. My goal is to explain, in the simplest terms possible, how your harddrive works, and what defragging the harddrive does, in terms of how data is stored on the drive. To start, I’ll explain the typical way data is stored on the drive, then I’ll talk about what types of situations create harddrive fragmentation, next I’ll explain why fragmentation is bad for your harddrive, and, finally, I’ll give an argument about whether or not you should run a defrag tool. (continue reading…)