Friday, April 10, 2009

Menghapus Package yang Tidak Terpakai (Studi Kasus Fedora 10)

Ketika meng-install sebuah package sudah biasa kita harus meng-install juga package-package yang dibutuhkan (dependensi). Namun, ketika kita hendak menghapus (uninstall) package tersebut, package-package dependensinya tidak ikut terhapus. Jadi, terasa mubazir, package-package dependensi tersebut tidak terpakai.

Misalnya, kita install package kdeedu-kstars:

[hafni@localhost ~]$ su -c 'yum install kdeedu-kstars'
Password:
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* rpmfusion-nonfree-updates: astromirror.uchicago.edu
* rpmfusion-free-updates: astromirror.uchicago.edu
* rpmfusion-free: astromirror.uchicago.edu
* rpmfusion-nonfree: astromirror.uchicago.edu
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package kdeedu-kstars.x86_64 0:4.2.1-1.fc10 set to be updated
--> Processing Dependency: kdeedu-libs = 4.2.1-1.fc10 for package: kdeedu-kstars
--> Processing Dependency: libindi.so.0()(64bit) for package: kdeedu-kstars
--> Processing Dependency: libkdeeduui.so.4()(64bit) for package: kdeedu-kstars
--> Processing Dependency: libcfitsio.so.0()(64bit) for package: kdeedu-kstars
--> Running transaction check
---> Package cfitsio.x86_64 0:3.100-1.fc10 set to be updated
---> Package kdeedu-libs.x86_64 0:4.2.1-1.fc10 set to be updated
---> Package libindi.x86_64 0:0.6-4.fc10 set to be updated
--> Processing Dependency: libfli.so.1()(64bit) for package: libindi
--> Processing Dependency: libnova-0.12.so.1()(64bit) for package: libindi
--> Running transaction check
---> Package libfli.x86_64 0:1.7-4.fc10 set to be updated
---> Package libnova.x86_64 0:0.12.1-3.fc10 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package          Arch      Version            Repository                  Size
================================================================================
Installing:
kdeedu-kstars    x86_64    4.2.1-1.fc10       fedora-updates-handmade     10 M
Installing for dependencies:
cfitsio          x86_64    3.100-1.fc10       fedora-handmade            1.3 M
kdeedu-libs      x86_64    4.2.1-1.fc10       fedora-updates-handmade    345 k
libfli           x86_64    1.7-4.fc10         fedora-updates-handmade     38 k
libindi          x86_64    0.6-4.fc10         fedora-updates-handmade    700 k
libnova          x86_64    0.12.1-3.fc10      fedora-handmade            1.1 M

Transaction Summary
================================================================================
Install      6 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        

Total download size: 14 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): libfli-1.7-4.fc10.x86_64.rpm                           |  38 kB     00:00    
(2/6): kdeedu-libs-4.2.1-1.fc10.x86_64.rpm                    | 345 kB     00:00    
(3/6): libindi-0.6-4.fc10.x86_64.rpm                          | 700 kB     00:00    
(4/6): libnova-0.12.1-3.fc10.x86_64.rpm                       | 1.1 MB     00:00    
(5/6): cfitsio-3.100-1.fc10.x86_64.rpm                        | 1.3 MB     00:00    
(6/6): kdeedu-kstars-4.2.1-1.fc10.x86_64.rpm                  |  10 MB     00:01    
-------------------------------------------------------------------------------------
Total                                                4.2 MB/s |  14 MB     00:03    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing     : cfitsio                                                        1/6
 Installing     : libfli                                                         2/6
 Installing     : kdeedu-libs                                                    3/6
 Installing     : libnova                                                        4/6
 Installing     : libindi                                                        5/6
 Installing     : kdeedu-kstars                                                  6/6

Installed:
 kdeedu-kstars.x86_64 0:4.2.1-1.fc10                                          

Dependency Installed:
 cfitsio.x86_64 0:3.100-1.fc10         kdeedu-libs.x86_64 0:4.2.1-1.fc10      
 libfli.x86_64 0:1.7-4.fc10            libindi.x86_64 0:0.6-4.fc10            
 libnova.x86_64 0:0.12.1-3.fc10      

Complete!

Dari meng-install kdeedu-kstars tersebut, kita harus meng-install 5 package lain, yaitu cfitsio, libfli, kdeedu-libs, libnova, dan libindi. Nah, ketika hendak menghapus package kdeedu-kstars, 5 package ini tidak ikut terhapus. Berikut ini buktinya:

[hafni@localhost ~]$ su -c 'yum remove kdeedu-kstars'
Password:
Loaded plugins: fastestmirror, refresh-packagekit
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package kdeedu-kstars.x86_64 0:4.2.1-1.fc10 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
Package                Arch            Version               Repository          Size
=======================================================================================
Removing:
kdeedu-kstars          x86_64          4.2.1-1.fc10          installed           21 M

Transaction Summary
=======================================================================================
Install      0 Package(s)        
Update       0 Package(s)        
Remove       1 Package(s)        

Is this ok [y/N]: N
Exiting on user Command
Complete!

Cara tergampang untuk turut serta menghapus package dependensinya, kita install salah satu plugin yum yang berguna untuk menghapusnya, yaitu yum-remove-with-leaves. Silakan install dulu:

[hafni@localhost ~]$ su -c 'yum install yum-remove-with-leaves'

Nah, setelah kita meng-install plugin tersebut, kita coba hapus package kdeedu-kstars:

[hafni@localhost ~]$ su -c 'yum remove kdeedu-kstars'
Password:
Loaded plugins: fastestmirror, refresh-packagekit, remove-with-leaves
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package kdeedu-kstars.x86_64 0:4.2.1-1.fc10 set to be erased
--> Finished Dependency Resolution
removing kdeedu-libs-4.2.1-1.fc10.x86_64. It is not required by anything else.
removing libindi-0.6-4.fc10.x86_64. It is not required by anything else.
removing cfitsio-3.100-1.fc10.x86_64. It is not required by anything else.
removing libfli-1.7-4.fc10.x86_64. It is not required by anything else.
removing libnova-0.12.1-3.fc10.x86_64. It is not required by anything else.
--> Running transaction check
---> Package cfitsio.x86_64 0:3.100-1.fc10 set to be erased
---> Package kdeedu-libs.x86_64 0:4.2.1-1.fc10 set to be erased
---> Package libfli.x86_64 0:1.7-4.fc10 set to be erased
---> Package libindi.x86_64 0:0.6-4.fc10 set to be erased
---> Package libnova.x86_64 0:0.12.1-3.fc10 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
Package               Arch           Version                  Repository         Size
=======================================================================================
Removing:
cfitsio               x86_64         3.100-1.fc10             installed         3.7 M
kdeedu-kstars         x86_64         4.2.1-1.fc10             installed          21 M
kdeedu-libs           x86_64         4.2.1-1.fc10             installed         1.7 M
libfli                x86_64         1.7-4.fc10               installed          82 k
libindi               x86_64         0.6-4.fc10               installed         1.6 M
libnova               x86_64         0.12.1-3.fc10            installed         3.5 M

Transaction Summary
=======================================================================================
Install      0 Package(s)        
Update       0 Package(s)        
Remove       6 Package(s)        

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
 Erasing        : libindi                                                         1/6
 Erasing        : libnova                                                         2/6
 Erasing        : cfitsio                                                         3/6
 Erasing        : kdeedu-kstars                                                   4/6
 Erasing        : kdeedu-libs                                                     5/6
 Erasing        : libfli                                                          6/6

Removed:
 cfitsio.x86_64 0:3.100-1.fc10             kdeedu-kstars.x86_64 0:4.2.1-1.fc10       
 kdeedu-libs.x86_64 0:4.2.1-1.fc10         libfli.x86_64 0:1.7-4.fc10                
 libindi.x86_64 0:0.6-4.fc10               libnova.x86_64 0:0.12.1-3.fc10            

Complete!

Dengan plugin yum-remove-with-leaves, package-package dependensi jadi ikut terhapus. Sekarang tidak ada lagi package yang tidak terpakai.

Wednesday, April 1, 2009

Nonton TV di Fedora Menggunakan TV Tuner Gadmei UTV330+

Pendahuluan

Sebenarnya sudah lama ingin menikmati TV di Fedora. Beli device ini tidak lama setelah aku membeli laptop. Kalau tidak salah bulan Oktober 2007. Sudah 1 tahun lebih.

Berulang kali laptop ini di-install Fedora. Setelah di-install biasanya hanya dipake sebentar, terus tidak pernah lagi boot Fedora. Tapi, mulai bulan Februari lalu aku serius mau sering pakai Fedora. Aku pun mendandani Fedora ini dengan berbagai macam software, termasuk berusaha untuk meng-install driver tv tuner ini.

Setelah googling, aku mendapatkan banyak tulisan mengenai cara meng-install-nya. Sebagian besar dari mereka menggunakan Ubuntu. Tapi karena sama-sama Linux ya intinya sama lah. Biasanya mereka mengarahkan kita untuk meng-install mercurial. Padahal, ini sama sekali tidak penting bagi kita sebagai end user.

Sebenarnya artikel di sini cukup terpercaya. Aku sempat mencoba cukup lama. Tapi karena kebodohanku saja, jadi tidak berhasil. Aku tidak tahu kalau yang dimaksud dengan

refit@gustaroska:$ gedit ./linux/drivers/media/video/em28xx/em28xx.h
itu source code-nya. Waktu itu bingung, ini file yang mana???!!. Bodoh banget kan. Padahal, tinggal ikuti petunjuknya dari awal, mungkin beres deh. Aku baru paham setelah baca tulisan Aisar ini.

Download driver

Download source code di http://linuxtv.org/hg/v4l-dvb/archive/tip.tar.gz. Walaupun di situ tertulis link-nya tip.tar.gz, file yang akan diunduh nanti jadi v4l-dvb-xxxxxxxxxxxx.tar.gz, contohnya v4l-dvb-4552dc2948e0.tar.gz. Mungkin ini file terbaru, aku tidak tahu persis.

Edit driver

Karena TV tuner Gadmei UTV330+ belum terdaftar di driver ini, kita perlu mengedit source code tersebut, yaitu mendaftarkannya dengan definisi sama persis dengan UTV330 (tanpa +) yang sudah terdaftar. Caranya:
  • Ekstrak dulu file yang diunduh tadi, misal hasilnya adalah direktori v4l-dvb-4552dc2948e0.
  • Masuk ke direktori hasil ekstraksi tersebut
  • Masuk lagi ke direktori linux/drivers/media/video/em28xx/
  • Edit file em28xx.h Cari Boards supported by driver. Pake Ctrl+F saja biar gampang kalo pake gedit ato semacamnya. Tambahkan di urutan terbawah definisi untuk UTV330+. Misal sebelumnya di urutan terbawah ada:
    #define EM2860_BOARD_KAIOMY_TVNPC_U2    63
    #define EM2860_BOARD_EASYCAP            64
    #define EM2820_BOARD_IODATA_GVMVP_SZ    65
    
    Setelah ditambahkan definisi baru, jadi:
    #define EM2860_BOARD_KAIOMY_TVNPC_U2    63
    #define EM2860_BOARD_EASYCAP            64
    #define EM2820_BOARD_IODATA_GVMVP_SZ    65
    #define EM2861_BOARD_GADMEI_UTV330      66
    
    Biarkan saja tidak ada tanda + di EM2861_BOARD_GADMEI_UTV330.
  • Edit file em28xx-cards.c Cari [EM2860_BOARD_GADMEI_UTV330]. Itu ada di bagian definisi struct em28xx_board em28xx_boards[]. Kemudian buat definisi baru [EM2861_BOARD_GADMEI_UTV330] dengan data sama dengan data pada [EM2860_BOARD_GADMEI_UTV330] kecuali name-nya ditambahi tanda +, sehingga akan jadi seperti ini:
    [EM2860_BOARD_GADMEI_UTV330] = {
        .name         = "Gadmei UTV330",
        .valid        = EM28XX_BOARD_NOT_VALIDATED,
        .tuner_type   = TUNER_TNF_5335MF,
        .tda9887_conf = TDA9887_PRESENT,
        .decoder      = EM28XX_SAA711X,
        .input        = { {
            .type     = EM28XX_VMUX_TELEVISION,
            .vmux     = SAA7115_COMPOSITE2,
            .amux     = EM28XX_AMUX_VIDEO,
        }, {
            .type     = EM28XX_VMUX_COMPOSITE1,
            .vmux     = SAA7115_COMPOSITE0,
            .amux     = EM28XX_AMUX_LINE_IN,
        }, {
            .type     = EM28XX_VMUX_SVIDEO,
            .vmux     = SAA7115_SVIDEO3,
            .amux     = EM28XX_AMUX_LINE_IN,
        } },
    },
    [EM2861_BOARD_GADMEI_UTV330] = {
        .name         = "Gadmei UTV330+",
        .valid        = EM28XX_BOARD_NOT_VALIDATED,
        .tuner_type   = TUNER_TNF_5335MF,
        .tda9887_conf = TDA9887_PRESENT,
        .decoder      = EM28XX_SAA711X,
        .input        = { {
            .type     = EM28XX_VMUX_TELEVISION,
            .vmux     = SAA7115_COMPOSITE2,
            .amux     = EM28XX_AMUX_VIDEO,
        }, {
            .type     = EM28XX_VMUX_COMPOSITE1,
            .vmux     = SAA7115_COMPOSITE0,
            .amux     = EM28XX_AMUX_LINE_IN,
        }, {
            .type     = EM28XX_VMUX_SVIDEO,
            .vmux     = SAA7115_SVIDEO3,
            .amux     = EM28XX_AMUX_LINE_IN,
        } },
    },
    
    Kemudian cari "struct usb_device_id em28xx_id_table[]". Tambahkan di dalamnya:
    { USB_DEVICE(0xeb1a, 0x50a6),
        .driver_info = EM2861_BOARD_GADMEI_UTV330 },
    

Compile dan install driver

  • Buka Terminal.
  • Masuk ke direktori awal driver hasil ekstraksi, kalau kasus di sini yaitu v4l-dvb-4552dc2948e0. Misalnya:
    [hafni@localhost ~]$ cd tvtuner/v4l-dvb-4552dc2948e0/
  • Jalankan make. Ini butuh waktu cukup lama, sekitar 10 menit.
    [hafni@localhost v4l-dvb-4552dc2948e0]$ make
  • Jalankan make clean. Mungkin ini di-skip tidak masalah. Tapi pas aku coba, harus melalui ini dulu baru berhasil.
    [hafni@localhost v4l-dvb-4552dc2948e0]$ make clean
  • Jalankan make install.
    [hafni@localhost v4l-dvb-4552dc2948e0]$ make install
  • Restart komputer.
  • Sambungkan TV tuner ke komputer (usb beserta line in).
  • Periksa apakah driver sudah ter-install dengan baik dan benar.
    [hafni@localhost ~]$ dmesg | grep em28xx
    Kalau muncul pesan seperti di bawah ini berarti instalasi driver telah berhasil.
    em28xx: New device USB 2861 Device @ 480 Mbps (eb1a:50a6, interface 0, class 0)
    em28xx #0: Identified as Gadmei UTV330+ (card=66)
    em28xx #0: chip ID is em2860
    em28xx #0: i2c eeprom 00: 1a eb 67 95 1a eb a6 50 50 00 13 03 6a 22 00 00
    em28xx #0: i2c eeprom 10: 00 00 04 57 4e 03 00 00 00 00 00 00 00 00 00 00
    em28xx #0: i2c eeprom 20: 06 00 01 01 f0 10 01 00 4a 00 00 00 5b 00 00 00
    em28xx #0: i2c eeprom 30: 00 00 20 40 20 80 02 20 01 01 02 01 00 00 00 00
    em28xx #0: i2c eeprom 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    em28xx #0: i2c eeprom 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    em28xx #0: i2c eeprom 60: 00 00 00 00 00 00 00 00 00 00 22 03 55 00 53 00
    em28xx #0: i2c eeprom 70: 42 00 20 00 32 00 38 00 36 00 31 00 20 00 44 00
    em28xx #0: i2c eeprom 80: 65 00 76 00 69 00 63 00 65 00 00 00 00 00 00 00
    em28xx #0: i2c eeprom 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    em28xx #0: i2c eeprom a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    em28xx #0: i2c eeprom b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    em28xx #0: i2c eeprom c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    em28xx #0: i2c eeprom d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    em28xx #0: i2c eeprom e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    em28xx #0: i2c eeprom f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    em28xx #0: EEPROM ID= 0x9567eb1a, EEPROM hash = 0x695cfff2
    em28xx #0: EEPROM info:
    em28xx #0: AC97 audio (5 sample rates)
    em28xx #0: 500mA max power
    em28xx #0: Table at 0x04, strings=0x226a, 0x0000, 0x0000
    em28xx #0:
    em28xx #0: The support for this board weren't valid yet.
    em28xx #0: Please send a report of having this working
    em28xx #0: not to V4L mailing list (and/or to other addresses)
    saa7115' 2-0025: saa7113 found (1f7113d0e100000) @ 0x4a (em28xx #0)
    tuner' 2-0060: chip found @ 0xc0 (em28xx #0)
    em28xx #0: Config register raw data: 0x50
    em28xx #0: AC97 vendor ID = 0xffffffff
    em28xx #0: AC97 features = 0x6a90
    em28xx #0: Empia 202 AC97 audio processor detected
    em28xx #0: v4l2 driver version 0.1.1
    em28xx #0: V4L2 device registered as /dev/video1 and /dev/vbi0
    em28xx audio device (eb1a:50a6): interface 1, class 1
    em28xx audio device (eb1a:50a6): interface 2, class 1
    usbcore: registered new interface driver em28xx
    em28xx driver loaded
    
    Atau:
    [hafni@localhost v4l-dvb-4552dc2948e0]$ su -c 'tail -f /var/log/messages'
    Kalau muncul pesan seperti di bawah ini berarti instalasi driver telah berhasil.
    Mar 10 00:57:56 localhost kernel: em28xx #0: AC97 features = 0x6a90
    Mar 10 00:57:56 localhost kernel: em28xx #0: Empia 202 AC97 audio processor detected
    Mar 10 00:57:56 localhost kernel: em28xx #0: v4l2 driver version 0.1.1
    Mar 10 00:57:56 localhost kernel: em28xx #0: V4L2 device registered as /dev/video1 and /dev/vbi0
    Mar 10 00:57:56 localhost kernel: em28xx audio device (eb1a:50a6): interface 1, class 1
    Mar 10 00:57:56 localhost kernel: em28xx audio device (eb1a:50a6): interface 2, class 1
    Mar 10 00:57:56 localhost kernel: usbcore: registered new interface driver em28xx
    Mar 10 00:57:56 localhost kernel: em28xx driver loaded
    Mar 10 00:57:56 localhost kernel: usbcore: registered new interface driver snd-usb-audio
    Mar 10 00:57:58 localhost pulseaudio[2815]: alsa-util.c: Cannot find fallback mixer control "Mic".
    Mar 10 01:01:06 localhost kernel: CE: hpet increasing min_delta_ns to 15000 nsec
    

Install tvtime

Langsung install dari repositori resmi.

[hafni@localhost ~]$ su -c 'yum install tvtime'

Konfigurasi tvtime

  • Scan channel
    [hafni@localhost ~]$ tvtime-scanner --norm=PAL
  • Jika laptop punya webcam Buka file /etc/tvtime/tvtime.xml. Harus dengan user root.
    [hafni@localhost ~]$ su -c 'gedit /etc/tvtime/tvtime.xml'
    Cari <option name="V4LDevice" dan ganti value-nya dengan /dev/video1.
  • Ganti standar tv menjadi PAL. Cari <option name="Norm" dan ganti value-nya dengan PAL.

Jalankan tvtime

Kalau dari panel, ada di Applications > Sound & Video > TVtime Television Viewer.

Suara tidak keluar?

Ini karena front mic dibisukan (alias mute). Agar bisa berbicara, buka Volume Control. Bisa klik kanan tanda speaker (biasanya di pojok kanan atas [macam partai aja]), terus klik Open Volume Control. Atau di System > Preferences > Hardware > Volume Control. Setelah terbuka jendela Volume Control, di bagian Device pilih device utama yang ada di komputer, harusnya sih yang paling atas, misalnya kalau di laptopku HDA NVidia (Alsa mixer). Terus unmute Front Mic dan atur-aturlah volumenya. Ini gambarnya:

Selamat menikmati.