20120513

Turning off one monitor in a dual monitor setup (Linux, Nvidia)

If you, like me, have two monitors and sometimes want to turn one of them off (to watch a movie, as an example) but thinks that going to the nvidia-settings every time is a waste of time here is a solution!!

First you have to configure your dual monitor setup properly with the nvidia drivers. (You can do this with the nvidia-settings)

Now...
  • Open the nvidia-settings and configure your monitors, putting one of them as disabled. (Here I have to go to the "X Server Display Configuration" and after selecting one monitor in "configuration" choose "Disabled")
  • Press the "Save to X Configuration File" (Don't worry, we will not do anything)
  • Press the "Show preview..." button
  • In the new windows, at the section "screen" (in my file it is the last section) copy what appears after the 'Option "metamodes"'
  • Cancel and close nvidia-settings
Now to the file edition part...
  • Assure first that you have the package "x11-xserver-utils" installed (we will use the xrandr command)
  • Open as super-user the file "/etc/X11/xorg.conf"
  • At the "screen" section add one more option in the "metamodes":
    • At the end of the string (before the quotes) add a semicolon
    • Paste what you have copied from the nvidia-settings preview
To clarify...In my xorg.conf:
The metamodes, in my machine, before the modifications was:
Option "metamodes" "CRT: nvidia-auto-select +1920+56, DFP: nvidia-auto-select     +0+0"
Then, after the modification:
Option "metamodes" "CRT: nvidia-auto-select +1920+56, DFP: nvidia-auto-select +0+0;CRT: null, DFP: nvidia-auto-select +0+0"
After that you can create a bash script to turn on and off the monitor you chose.
To turn the monitor off:
#!/bin/bash
xrandr -s 1
To turn the monitor on:
#!/bin/bash
xrandr -s 0
The scripts (and the single commands, of course) will only work after you restart your X, usually by restarting your machine.

You can play with your monitor configuration, xrandr and xorg.conf (with due care) to turn off the other monitor or to fit it in your n-headed computer need :)

That's all folks!

I used the great help of this site:
http://morgancollett.wordpress.com/2008/11/25/nvidia-twinview-and-xrandr/

20120317

Making a Kindle 4 device show your own screensavers (and no advertisement) - on Linux !!

In this tutorial I will tell you how to make your kindle show custom screensavers using linux. I decided to write this post because all the tutorials I found were for windows users and none of them had all the steps in one place.
(I know that disabling the advertisements have philosophical implications because amazon supposedly used them to lower the price of your kindle, but...)
 Enjoy!!

1. Plug in your kindle, mount it and create an empty file called ENABLE_DIAGS on the main directory:
$ touch ENABLE_DIAGS
2. Reboot kindle and go through debug menu system to start USB networking:
To restart your kindle: 
  1. Press "HOME" button
  2. Press "MENU" button
  3. Select the "Settings" option
  4. Press "MENU" button
  5. Select the "Restart" option
After your kindle restarted it will show a menu where you can adventure yourself  (And I don't know if you can brick it or not) using the cursor pad.
To enable USB networking:
  1. Scroll to "Misc individual diagnostics"  & select
  2. Scroll to "Utilities" & Select
  3. Scroll to "Z> Enable USBnet" & Select
  4. Screen should show various "addresses" and "PASS" and highlighted on "X> Exit..."
  5. Select "X> Exit - FW RIGHT to exit"
  6. Back out by selecting "X> Exit - FW RIGHT to exit" until main screen
3. Now you can ssh to your kindle:
$ ifconfig usb0 192.168.15.1; ssh root@192.168.15.244
Maybe you will need to run the ifconfig with root privilegies.
The user ID is "root" and the very hard password, almost impossible to crack, is "mario" 
4. (If your kindle is not "with special offers") Create your own screensaver directory and make kindle point to it:
$ mntroot rw
$ mkdir /mnt/us/screensaver
$ mount /dev/mmcblk0p1 /mnt/base-mmc
$ mv /mnt/base-mmc/opt/amazon/screen_saver/600x800 /mnt/base-mmc/opt/amazon/screen_saver/600x800.old
$ ln -sfn /mnt/us/screensaver /mnt/base-mmc/opt/amazon/screen_saver/600x800
4. (For kindle "with special offers") If you want to remove all the advertisement and use your own screensaver just backup the advertisement folders and repeat the previous steps:
$ mntroot rw
$ mount /dev/mmcblk0p1 /mnt/base-mmc

$ mv /mnt/us/.assets /mnt/us/.assetsBCKP
$ mv /var/local/adunits /var/local/adunitsBCKP
$ mv /mnt/base-mmc/amazon/screen_saver/adunits/600x800/banner.gif /mnt/base-mmc/amazon/screen_saver/adunits/600x800/banner.gif.BCKP
$ mv /mnt/base-mmc/amazon/screen_saver/adunits/600x800/screensvr.gif /mnt/base-mmc/amazon/screen_saver/adunits/600x800/screensvr.gif.BCKP

$ mkdir /mnt/us/screensaver
$ mv /mnt/base-mmc/opt/amazon/screen_saver/600x800 /mnt/base-mmc/opt/amazon/screen_saver/600x800.old
$ ln -sfn /mnt/us/screensaver /mnt/base-mmc/opt/amazon/screen_saver/600x800


5. Restart your kindle
  1. Select "D> Exit, Reboot or Disable Diags"
  2. Select "D> Disable Diagnostics"
  3. Select "Q> To continue - FW LEFT" by pushing the FW LEFT button
  4. Kindle should reboot itself - be patient
6. Now, when you mount your kindle it will have a directory called "screensaver" where you can put any .jpg or .png files (preferably with a 600x800 resolution with 16-gray color)

6.1 If you want to have more than one screensaver and make it change randomly create an empty file at the screensaver directory called "random"
$ touch random

7. Have fun putting your own screensaver or finding one in the following sites:
http://kindlewallpapers.tumblr.com/
http://kindlepics.deviantart.com/gallery/
http://www.kubizo.com/

That's all folks!

For all this to be possible I have used all these sites:
http://yifan.lu/p/kindle-touch-jailbreak/
http://wiki.mobileread.com/wiki/Kindle_Touch_Hacking
http://www.mobileread.mobi/forums/showthread.php?t=161284
http://juanchorossi.com/remove-kindle3-screensavers/
http://www.mobileread.com/forums/showpost.php?p=1876617&postcount=95
http://pastebin.com/17czdUS7