Posts Tagged ‘howto’

Using an TV as secondary screen via HDMI – 1

January 25th, 2010

If you have a fancy HD television and a box with a HDMI port, it’s (kinda) easy to setup your TV as a secondary monitor at full resolution, with audio support. Needless to say, it’s great for watch all those HD movies in a big TV instead of staring at your monitor or a small netbook screen :-)

First, the video. Run xrandr and see which devices you have available. My Acer AS1410-8414 running Arch Linux gives this output:

Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 8192 x 8192
VGA1 disconnected (normal left inverted right x axis y axis)
LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 256mm x 144mm
1366x768 60.0*+
1024x768 85.0 75.0 70.1 60.0
832x624 74.6
800x600 85.1 72.2 75.0 60.3 56.2
640x480 85.0 72.8 75.0 59.9
720x400 85.0
640x400 85.1
640x350 85.1
HDMI1 connected 1920x1080+1366+0 (normal left inverted right x axis y axis) 698mm x 392mm
1920x1080 50.0*+ 60.0
1280x720 60.0 50.0
720x576 50.0
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
TV1 disconnected (normal left inverted right x axis y axis)

The GPU is a Intel GMA 4500MHD, by the way. LVDS1 is the default LCD screen and HDMI1 the port I’m using. So, to maintain your current screen and create a new one in the TV, run:

xrandr --output HDMI1 --auto --output LVDS1 --auto --left-of HDMI1

This will output a screen on the TV with automatic resoution (1920×1080, in my case), and also keep the current one in the laptop screen at the left side of the TV. Different GPUs have different ways of doing the same thing – in a laptop with a Quadro NVS 140M I was able to use nvidia-settings to configure a second monitor, even having the option of a unified desktop using TwinView (the same effect attained here) or two separate X screens. I suspect ATI-based GPUs have a fancy GUI program as well.

In a next post I’ll explain how to easily redirect the audio to the HDMI port using PulseAudio, if your system insists on outputting sound through your computer speakers. In this case, you could just use a cable with a 3.5mm plug in each end, but why waste plastic and metal when your powerful HDMI cable can transport sound too?

P.S.: I tried to watch a sample from the Apple QuickTime HD Gallery , but my netbook’s Core2 Solo 1.4GHz just doesn’t have what it takes to watch 1080p in all its glory. Meh :P

An example of transitional packages in Debian

July 17th, 2009

When you have to change the name of your package (e.g. for complying with policies) or you make a new package that is meant to replace the old one (e.g. gcc4.2 -> gcc4.3), you’ll have to deal with the fact that the other packages that use your old package as a dependency will not be immediately updated, or maybe never will. So, to overcome this issue, there is a useful trick: transitional packages.

Transitional packages are essentially proxies – packages that pull the correct dependencies when installed and can be removed without problems as soon as the installation finishes. Some of these packages also have scripts to make/ease the transition when it is necessary. With this package you’ll be able to ship your new/updated package without worrying breaking all the others that depend on it (provided that the funcionality stays the same) and then inform the maintainers that their packages need to be upgraded to the new version of the dependency.

As an example, suppose you used to maintain a package named foo that is used by other package, baz. You have made a completely new package, bar, and intend to completely replace foo. So, for making the transitional package, you add these lines to the debian/control file of bar:

Source: bar
Section: unknown
Priority: extra
Maintainer: Bruno Araujo <bru...@baraujo.net>
Build-Depends: cdbs, debhelper (>= 5), [bar build dependencies]
Standards-Version: 3.7.2

Package: bar
Architecture: any
Provides: foo
Replaces: foo (<< 0.1-2)
Conflicts: foo (<< 0.1-2)

Depends: ${shlibs:Depends}, ${misc:Depends}, [bar dependencies]
Description: <insert up to 60 chars description>
<insert long description, indented with spaces>

Package: foo
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, bar
Description: Transitional package for bar
This is a transitional package for foo, and can be safely removed
after the installation is complete.

The bold lines are the modification needed for providing the transitional package. Two modification were made:

  • In the Package: bar section, three new keywords were added: Provides, Replaces and Conflics. They will be explained shortly.
  • The transitional package must have the same name of the package you intend to replace. Usually a short explanation about the nature of the package is written.

The three keywords added to the bar package section are used to proper inform dpkg of the transitional package and to decide which actions will be taken should the need arise.

  • The Provides keyword informs dpkg that the package bar provides a “virtual package” named foo (more details about virtual packages can be found on the Debian Policy)
  • The package bar should not be installed at the same time as the old package foo, so the Conflicts keyword indicates this.
  • If a conflict arises, the Replaces keyword indicates which package must be chosen for solving the conflict.

Now, when you try to install the package baz, the transitional package foo will be installed with its dependency bar, which is the correct dependency that should be used. For more details about these keywords, see sections 7.4-7.6 of the Debian Policy. Note that, in this case, the only transition was pulling the correct dependency; in other cases, when some extra works needs to be done before or after installing the package,  one of the ways to do this work is including the necessary scripts and putting calls to them inside <package>.preinst (pre-installation) and <package>.postinst (post-installation) inside debian directory.