contrib: add a HOWTO for new users
[libam7xxx.git] / contrib / howto-picopix.asciidoc
1 HOW-TO use a PicoPix on GNU/Linux
2 =================================
3
4 Philips/SagemCom pico projectors, like for instance the PicoPix 2055, usually
5 have a WVGA (854 x 480 pixels) native resolution, however they can be used to
6 project other resolutions if the software rescales the image.
7
8 First, update your system and download the free libam7xxx library and the
9 related programs.
10
11 On Debian and Ubuntu systems this can be done with the following commands:
12
13   sudo apt-get update
14   sudo apt-get install libam7xxx0.1-bin
15
16 Plug your PicoPix into one or two USB slots of your personal computer
17 (sometimes the second USB port is needed to ensure that the PicoPix has enough
18 power).
19
20 Wait for Philips logo to appear.
21
22 After the logo has disappeared, execute the following command in a terminal:
23
24   am7xxx-play -f x11grab -i :0.0
25
26 The video projection is on.
27
28 You can have two simple scripts to execute the program from the GUI.
29
30 PicoPix-START.sh:
31
32   #!/bin/sh
33   am7xxx-play -f x11grab -i :0.0 -p 1 -z 0
34
35
36 PicoPix-STOP.sh:
37
38   #!/bin/sh
39   killall am7xxx-play
40   am7xxx-play -f x11grab -i :0.0 -p 0 -z 1 &
41   sleep 1
42   killall am7xxx-play
43
44
45 Save the shell scripts from above in files, and give the execute permissions
46 to the owner (or user group) via the command line  or via the graphical
47 interface
48 (http://sourcedigit.com/20111-how-to-run-a-shell-file-in-ubuntu-run-sh-file-in-ubuntu/).
49 You will then be able to execute the file by double-clicking on it.
50
51 If you want to specify a particular resolution you can pass it as a command
52 line option:
53
54   am7xxx-play -f x11grab -i :0.0 -o video_size=1280x768
55
56 When doing so you may notice that your PicoPix does not fully displays the
57 content of your desktop screen, which can be truncated at the bottom and at
58 the right. This is because of the WXGA (1280 x 768 pixels) resolution may be
59 different from your personal computer screen resolution. It is therefore
60 necessary to modify —temporarily— your personal computer screen resolution to
61 wanted resolution. Take the following script :
62
63   #!/bin/sh
64
65   WIDTH=1280
66   HEIGHT=768
67
68   OUTPUT="LVDS-1" # See 'xrandr --listmonitors'
69
70   xrandr --newmode $(gtf ${WIDTH} ${HEIGHT} 60 | sed -ne 's/"//g;s/ Modeline //p')
71   xrandr --addmode ${OUTPUT} ${WIDTH}x${HEIGHT}_60.00
72   xrandr --output ${OUTPUT} --mode ${WIDTH}x${HEIGHT}_60.00
73   sleep 1
74   am7xxx-play -f x11grab -i :0.0 -p 1 -z 0 -o video_size=${WIDTH}x${HEIGHT}
75
76 Note:
77
78 In the example above, the personal computer screen is identified as "LVDS-1".
79 Maybe your computer screen has a different identifier. In this case, you will
80 have to replace "LVDS-1" with the correct identifier : open your terminal,
81 type "xrandr" and the terminal will list and describe your different screen
82 devices (more about xrandr utility here:
83 http://pkg-xorg.alioth.debian.org/howto/use-xrandr.html).
84
85 Also, in order to give back your computer screen its original resolution, you
86 should create a PicoPix-STOP.sh script like so:
87
88   #!/bin/sh
89
90   ORIGINAL_WIDTH=1600
91   ORIGINAL_HEIGHT=900
92
93   OUTPUT="LVDS-1" # See 'xrandr --listmonitors'
94
95   killall am7xxx-play
96   am7xxx-play -f x11grab -i :0.0 -p 0 -z 1 &
97   sleep 1
98   killall am7xxx-play
99   xrandr --output ${OUTPUT} --mode ${ORIGINAL_WIDTH}x${ORIGINAL_HEIGHT}
100
101 Note:
102
103 In the example above, the original screen resolution is 1600x900 pixels. You
104 have to change this value and put your screen resolution value which you can
105 know via xrandr. Same for LVDS-1.
106
107 Once your video projection is over, you can execute the PicoPix-STOP.sh script
108 so that your computer screen returns to its original state.
109
110 You can then unplug the projector.
111
112 That's all folks!
113
114 This text is licensed under WTFPL. See http://www.wtfpl.net/ for more informations.