Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

2010-09-14

Typography keyboard layout in Linux

From a Russian blog Slovomania I learned that in the new versions of X11 there is a typography layout option, similar to Ilya Birman layout. This is its Linux counterpart:

Typography layout in Linux

To enable it in GNOME: SystemPreferencesKeyboard. Then Layouts tab, Options.... Enable Key to choose 3rd level (right Alt will do) and Enable extra typographic characters under Miscellaneous compatibility options.

Also in Russian: Типографская раскладка в Линуксе.

2009-09-04

Tag installed packages to delete later

One of the lesser known but very useful features of aptitude is user tags.

For example, someone wants to install a set of packages temporarily just to build some program from source. Later, when the -dev packages are not needed anymore, it is not easy to remember which packages were installed.

Fortunately, one may tag the packages during install (I use builddeps tag in the example below):

$ sudo aptitude install --add-user-tag builddeps \
      libsomething-dev libsomething-else-dev ...

Now when these packages are to be deleted, we just do:

$ sudo aptitude purge '?user-tag(builddeps)'

The search pattern ?user-tag(yourtag) can be used with any other aptitude search patterns. Also, you may tag packages during many other commands, not only install.

Tested in Debian Lenny (aptitude-0.4.11).

Прочесть по-русски.

2009-08-26

Monitor file changes in a shell script

Problem: monitor file changes from a shell script and execute some commands when necessary. For example, rebuild LaTeX document or compile program every time when one of its source files is changed.

Solution: inotify-tools help to monitor file changes. There are two utilities. The first one, inotifywait, blocks and waits for changes, then returns. If the event it was waiting for happened, its return code is 0 (success). See an example of using inotifywait below. The second utility is inotifywatch, it monitors files' changes, collects information and prints a nice table on exit. Please visit inotify-tools' site to see examples of its use.

Example: inotifywait monitors all *.tex and *.bib files in the current directory, and when any of them changes, it runs pdfLaTeX and BibTeX to rebuild document:

while true ; do \
  inotifywait *.tex *.bib \
  && ( pdflatex -interaction=nonstopmode mypaper && \
       bibtex mypaper && \
       pdflatex -interaction=nonstopmode mypaper ) \
done

P.S. Please note that when we run LaTeX with -interaction=nonstopmode, it does not ask questions on errors but we can still see those errors.

P.P.S. inotify-tools run only on Linux. You may need to use pnotify or kqueue on *BSD.

Прочесть по-русски

2009-06-09

Debian Lenny on Samsung X22

The laptop

My new laptop is Samsung X22. I like its serious, almost ascetic look. The screen is matte, not glossy. The weight is just within my requirements: 2.18 kg (unfortunately, an AC adapter is bulky). What's more, the laptop came without Vista. I don't mind having WinXP Pro around just in case I need to do test some software on Windows (or to play games). The keyboard is big and very similar to the one of my previous laptop (only Ctrl and Fn are swapped). Nice things to have: 1.3 MP webcam and SD/MS/xD card reader (I have some xD cards, but many embedded card readers don't support them). On the flip side: the laptop is rather big (14"), it is not water-shock-whatever-proof, the screen is only 1280×800 and its viewing angle is relatively narrow, and the battery life is short. Bonus: Bluetooth, ExpressCard slot, HDMI, optical drive.

This is the first time I bought a laptop with discrete graphics (Ati Radeon HD2400 aka RV610). The open source driver does support 3D only in experimental branches, but since I don't need 3D right now and AMD/Ati was kind enough to release the specs, some code and programming guide, I hope this card will have good open source drivers in the future. Anyway, with Intel I could not use 3D neither :)

Hardware: lspci, lsusb and dmidecode.

Installation

I used netinst image of Debian Lenny (5.0.1) and installed from a USB pen drive. This was the first time I tried Debian graphic installer. Well, I liked it. Probably, partition editor was not very GUI-sh, but it's OK. I installed i386 kernel.

The installer asked me for iwlwifi proprietary firmware (I didn't have one nor didn't put it on the installation pendrive). So, I installed from ethernet. Installation was smooth.

Post-installation

Wireless

I installed firmware-iwlwifi package, and the wireless now works perfectly. For convenience, I replaced network-manager with wicd. I like it more.

Keyboard

Some Fn-combos don't work. Most notably: Fn+(F2|F4|F5|F8|F9|F10|Up|Down). These keys don't produce any xev keycode. Among features which are not available are manual brightness (Fn+Up/Fn+Down) and wireless switch (Fn+F9).

I found a kernel bug (almost resolved) with another Samsung model: #12021, and another similar Debian bug #475851 with Samsung Q45. After reading through it, I managed to enable brightness buttons with

$ sudo setkeycodes e008 225 e009 224

Finally, after a small patch to hal-info, all the keys work (at least, generate xev codes).

Good news: sleep button, mute and volume buttons work out of the box.

Video

radeon driver in Debian Lenny is working OK (2D), but XVideo is not enabled by default, so probably I have to try a newer kernel or rebiuld the driver. Up-to-date version claims to support XVideo.

Proprietary Ati driver (fglrx) works too; (hint: enable non-free repository and install fglrx-driver, run aticonfig).

I tried also newer radeon driver from the unstable (since 6.12 radeon supports video and 2D acceleration on R6xx). In fact, HD video played even better than with a proprietary driver. Though I couldn't get proprietary fglrx working with X.org from unstable.

Webcam

Webcam just works. I tried it in Cheese and in Skype. Both work. Picture quality is good. It seems to be the same Vimicro webcam (USB ID 0ac8:c302) used in Samsung Q45 notebook.

Sound

When I installed Lenny, sound was playing without problems, but I could not get microphone working. As usual with Lenny and Intel-HDA hardware, I had to build newer ALSA (as I did for eeePC 901, link points to a post in Russian). To make mic working on X22 I also had to add in /etc/modprobe.d/alsa-base this line:

options snd-hda-intel model=ultra
This HDA Intel Sound HOWTO was very helpful. I found, that Samsung X22 uses Realtek ALC262 codec. Then, I tried some ALC262 models, and model=utlra worked.

Suspend

Fn+Esc did not restore screen/backlight on wake up. Blind typing upon wake up was useless.

I found, that either

s2ram -f -a 2
or
pm-suspend --quirk-s3-mode
suspend and restore the session normally. In X they restore the screen perfectly, but in console they don't turn on backlight. However, Ctrl+Alt+F7 switches to X and the backlight is restored. Minor glitch: when going to suspend, the screen is filled with blinking ’ñ’. Not a big deal, but I don't think it's normal.

I edited /usr/share/hal/fdi/information/10freedesktop/20-video-quirk-pm-samsung.fdi, and the snippet corresponding to X22 now looks like this:

      <!-- this does not work on my SX22S! -->
      <match key="system.hardware.product" string_outof="R40/R41;CoronaR">
        <merge key="power_management.quirk.vbestate_restore" type="bool">true</merge>
      </match>
      <!-- I use this one: -->
      <match key="system.hardware.product" string="SX22S">
        <merge key="power_management.quirk.s3_mode" type="bool">true</merge>
      </match>

Now Fn+Esc works as intended.

Optical drive

It seems to support most of the CD and DVD media, but I didn't use it much yet. It is reading CDs without problem.

Card reader

Works with my xD and SD cards as intended. I don't have MemoryStick cards to test.

Things not tested

I didn't try HDMI, ExpressCard slot, Bluetooth at all.

Links