Month: August 2011

Testing 1-Wire on Linux

Linux kernel has native support to 1-Wire bus. To use this feature you need to have a 1-Wire master chip on your board (for example DS2490, DS2482, etc) or you could to select use a GPIO 1-Wire implementation which emulates a real 1-Wire master.

This is the steps to enable DS2482 on kernel:

Device Drivers  --->
    {*} Dallas's 1-wire support  --->
         Maxim DS2482 I2C to 1-Wire bridge

If your device was recognized correctly, then you could see the directory “w1 bus master” at /sys/devices.

Then enter on this directory:

# cd /sys/devices/w1*

You can see the name of your master device:

# cat w1_master_name                                                            
w1_bus_master1                                                                  

Case you have some slave device plugged on your 1-wire master the w1_master_slave_count will be different of 0.

Then before connecting an i-Button:

# cat w1_master_slave_count                                                     
0                                                                               

After connecting an i-Button, the kernel prints this message:

w1_master_driver w1 bus master: Family 1 for 01.0000135b46fa.17 is not regist.

Now the number of slave plugged will be different of 0:

# cat w1_master_slave_count                                                     
1

Now I can see the name of my slave on the bus:

# cat w1_master_slaves                                                          
01-0000135b46fa  

Applying patches with modifications from other branch

Normally we create a new branch on git to test a new code and when it is working fine we want to move it again to master. There are many ways to do it.

Today my friend Daniel found a nice way to do it:

git diff master mytestbranch | git apply --index -

It will move all modified files from “mytestbranch” to “master” branch.

If you want to move just a specific directory or file, you can follow the command by “– “, example:

git diff master mytestbranch -- src/ | git apply --index -

In this case I just want the modifications which affect the src/ directory.

Escondendo a tela de menu do GRUB2

Por padrão a tela de Menu do GRUB2 fica oculta quando você só tem o Linux na máquina. Mas vamos supor que você não quer que deixar as outras pessoas verem o Windows da sua máquina (para força-las a usar o Linux).

Você pode esconder o Menu do GRUB2, simplesmente comentando (#) 2 (duas) linhas do arquivo /etc/grub.d/30_os-proper:

# if [ "x${found_other_os}" = "x" ] ; then 
...
# fi
}

Finalmente execute:

$ sudo update-grub

Fonte: “11. HIDING THE MENU ON MULTI-OS SYSTEMS” do site: http://ubuntuforums.org/showthread.php?t=1287602

Reinstalando o GRUB2

Após fazer várias modificações no script /etc/grub.d/30_os-proper e perder totalmente a configuração original, resolvi instalar o grub novamente.

Primeiro tive que descobrir em qual pacote o arquivo 30_os-proper estava, para isso executei o comando:

$ apt-file search 30_os-proper
grub-common

Em seguinda tentei reinstalar o pacote do jeito tradicional:

$ sudo apt-get install --reinstall grub-common

Nao funcionou, apos abrir o arquivo 30_os-proper ele continuava com as minhas modificacoes.

Entao o jeito foi quebrar momentaneamente o sistema (isto e’ perigoso, tome muito cuidado) atraves do comando:

$ sudo dpkg --purge --force-depends grub-common

E entao instalei novamente o arquivo:

$ sudo apt-get install grub-common

Pronto, agora tudo voltou ao normal.

Log of Sony Bravia KDL-32EX405

[    0.000000] Linux version 2.6.23.17-alp_nl- (root@slave34) (gcc version 4.1.0
[    0.000000]  bdi=01000009
[    0.000000] [3-1-1] CPU revision is: 0001906c
[    0.000000] EMMA3TL2 (Version Gen.=0xf(Gen.=03000012), Maj.=0x2, Min.=0x3)
[    0.000000]  umem: 06a00000 @ 81600000
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 012c0000 @ 00000000 (usable)
[    0.000000]  memory: 00040000 @ 015c0000 (usable)
[    0.000000]  memory: 08000000 @ 08000000 (usable)
[    0.000000] Initial ramdisk at: 0x811ad000 (315392 bytes)
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal          0 ->    65536
[    0.000000] Movable zone start PFN for each node
[    0.000000] early_node_map[3] active PFN ranges
[    0.000000]     0:        0 ->     4800
[    0.000000]     0:     5568 ->     5632
[    0.000000]     0:    32768 ->    65536
[    0.000000] Kernel command line:  console=ttyS00,115200n8 ip=off  rdinit=/in4
[    0.000000] Primary instruction cache 16kB, physically tagged, 4-way, linesi.
[    0.000000] Primary data cache 16kB, 4-way, linesize 16 bytes.
[    0.000000] Synthesized TLB refill handler (36 instructions).
[    0.000000] Synthesized TLB load handler fastpath (48 instructions).
[    0.000000] Synthesized TLB store handler fastpath (48 instructions).
[    0.000000] Synthesized TLB modify handler fastpath (47 instructions).
[    0.000000] PID hash table entries: 1024 (order: 10, 4096 bytes)
[    0.000000] CPUCLK=327.680 MHz, MCLK=196.608 MHz
[    0.000000] Using 163.840 MHz high precision timer.
[    0.594309] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.596916] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.630016] Memory: 129792k/150528k available (2074k kernel code, 20660k res)
[    0.630226] SLUB: Genslabs=20, HWalign=32, Order=0-1, MinObjects=4, CPUs=1, 1
[    0.630256] Calibrating delay loop (skipped)... 326.86 BogoMIPS preset
[    0.630426] Mount-cache hash table entries: 512
[    0.634176] NET: Registered protocol family 16
[    0.637977] SCSI subsystem initialized
[    0.638298] usbcore: registered new interface driver usbfs
[    0.638484] usbcore: registered new interface driver hub
[    0.638960] usbcore: registered new device driver usb
[    0.664093] NET: Registered protocol family 2
[    0.664331] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.664729] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
[    0.665635] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
[    0.666125] TCP: Hash tables configured (established 8192 bind 8192)
[    0.666150] TCP reno registered
[    0.667060] Unpacking initramfs...<6>Time: MIPS clocksource has been install.
[    0.681037]  done
[    0.684857] Freeing initrd memory: 308k freed
[    0.684886] Registering /proc/snsc_emma3_uma/
[    0.686638] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.687127] io scheduler noop registered
[    0.687188] io scheduler cfq registered (default)
[    0.687902] ttynull: NULL console driver $Revision: 1.1.2.1 $
[    0.687947] Serial: 8250/16550 driver $Revision: 1.90 $ 3 ports, IRQ sharingd
[    0.688845] serial8250.0: ttyS0 at Phys 0xb0101000 (irq = 56) is a 16550A
[    0.689086] console [ttyS0] enabled
[    0.996293] serial8250.0: ttyS1 at Phys 0xb0102000 (irq = 57) is a 16550A
[    1.003430] serial8250.0: ttyS2 at Phys 0xb0103000 (irq = 58) is a 16550A
[    1.015804] loop: module loaded
[    1.020152] nec_candy: 10/100 Ethernet driver v0.4 (June 20, 2006)
[    1.030895] nec_candy: Probe candy chip at 0x10012000, irq 44, Phy ID 0x00002
[    1.040898] Linux video capture interface: v2.00
[    1.045835] nf_conntrack version 0.5.0 (3072 buckets, 12288 max)
[    1.052658] ip_tables: (C) 2000-2006 Netfilter Core Team
[    1.058209] NET: Registered protocol family 1
[    1.062615] NET: Registered protocol family 17
[    1.067164] 802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
[    1.073976] All bugs added by David S. Miller <davem@redhat.com>
[    1.080079] ieee80211: 802.11 data/management/control stack, git-1.1.13
[    1.086773] ieee80211: Copyright (C) 2004-2005 Intel Corporation <jketreno@l>
[    1.095910] [3-1-1] EXEC <init>
[    1.108393] sonyrd: no version for "struct_module" found: kernel tainted.
[    1.120863] sonyrd: module license 'unspecified' taints kernel.
[    1.137770] NAND Flash Memory driver Revision: 0.01/0.01/0.01
[    1.143582] onenand: Toshiba TC58RYG0S8E, 1024 tracks, 64 sectors per track,B
[    1.152571]  nanda1
[    1.156209] MemoryStick driver Revision: 0.01/0.01/0.01
[    1.172522] ABK: abk installed
[    1.177310] mounted as UVFAT16
[    1.271759] fb cpu(1) done in (654.009713)msecs wait(0)
[    1.764951] reset PQC(fastboot)
[    1.768205] fb cpu(4) done in (641.015260)msecs wait(0)
[    1.773477] wd_timer installed
[    1.780221]  plane  resource : 91130251
[    1.784089]  memory resource : 91130251
[    1.788595] alloc cmdlist data: size: 00008000 address: 8f440000
[    1.795072] [SYSTEM]
[    1.795096]  FW         : V12.12    14-Jun-10
[    1.840165] [3-1-1] EXEC <./dtInit>
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
/var/ccf/iptv_02.img: 0 files, 0/2042 clusters

Uma alternativa Open Source ao Dropbox

Sou usuario do Dropbox ha um bom tempo, mas nunca gostei da ideia de deixar meus arquivos sob controle de uma empresa externa. Nao apenas pelo fato que ela podera’ revelar meus arquivos a terceiros ou a qualquer momento deixar de oferecer gratuitamente este servico, mas principalmente por gostar de ter controle sobre as minhas coisas.

Pesquisando na Internet encontrei um alternativa open-source chamado SparkleShare.

Felizmente ele ja’ esta’ integrado no Ubuntu:

$ sudo apt-get install sparkleshare

Para configurar o servidor no seu computador:

$ sudo apt-get install git-core openssh-server
$ git init --bare MYREPONAME.git

No computador(es) que sera'(ao) cliente(s):

Instale o cliente de SSH, caso ainda nao tenha instalado:

$ sudo apt-get install openssh-client

Crie uma senha SSH vazia:

$ ssh-keygen

Quando pedir a senha apenas pressione ENTER.

Envie a sua senha para o servidor:

$ ssh-copy-id USUARIO@SERVIDOR

O proximo passo e’ iniciar o sparkshare e configurar o endereco do seu servidor:

sparkleshare start