quinta-feira, 8 de setembro de 2016

libqt4-core e libqt4-gui no Ubuntu 16.04 Xenial

No Ubuntu Xenial 16.04 as bibliotecas libqt4-core e libqt4-gui deixaram de existir, e foram substítuídas pelas libqtcore4 e libqtgui4. Porém, alguns programas antigos ainda possuem as libqt4-core e libqt4-gui como dependências. Para reverter isso, existe um script que altera as dependências de um pacote .deb qualquer, e com isso é possível substituir as dependências do pacote para libqtcore4 e libqtgui4.

Primeiro passo:
Crie um arquivo com o seguinte script e salve com o nome videbcontrol

#!/bin/bash

if [[ -z "$1" ]]; then
  echo "Syntax: $0 debfile"
  exit 1
fi

DEBFILE="$1"
TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
OUTPUT=`basename "$DEBFILE" .deb`.modfied.deb

if [[ -e "$OUTPUT" ]]; then
  echo "$OUTPUT exists."
  rm -r "$TMPDIR"
  exit 1
fi

dpkg-deb -x "$DEBFILE" "$TMPDIR"
dpkg-deb --control "$DEBFILE" "$TMPDIR"/DEBIAN

if [[ ! -e "$TMPDIR"/DEBIAN/control ]]; then
  echo DEBIAN/control not found.

  rm -r "$TMPDIR"
  exit 1
fi

CONTROL="$TMPDIR"/DEBIAN/control

MOD=`stat -c "%y" "$CONTROL"`
vi "$CONTROL"

if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
  echo Not modfied.
else
  echo Building new deb...
  dpkg -b "$TMPDIR" "$OUTPUT"
fi

rm -r "$TMPDIR"

Segundo passo:
Dê permissão de execução para o arquivo executando o comando: chmod +x videbcontrol

Terceiro passo:
Execute o script: sh videbcontrol seu_pacote.deb

Quarto passo:
(caso você tenha dificuldade para usar o editor vi , pesquise os comandos básicos para alterar, salvar e sair do vi) 
O script irá abrir o editor de texto vi com a linha de dependências do pacote em questão. Altere o nome das bibliotecas libqt4-core para libqtcore4 e libqt4-gui para libqtgui4. Após alterar basta fechar o vi e um novo arquivo .deb será criado com as dependências alteradas.

terça-feira, 5 de abril de 2016

Burning ATmega328P with 8MHz Internal Crystal

(this is a private POST just for me remember what are the FUSES that I used)

To burn the ATmega328P to run with 8MHz internal clock I'm using the ARDUINO PRO MINI bootloader.

Just changing the FUSE of the oscilator:

  • Low Fuse: E2
  • High Fuse: DA
  • Ext Fuse: 05
I'm using JTAGICE mkII-CN as programmer.

AVRDUDE command line:
  • /media/juliano/arduino-1.6.5-r5/hardware/tools/avr/bin/avrdude -C/media/juliano/arduino-1.6.5-r5/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cjtag2isp -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xE2:m
  • /media/juliano/arduino-1.6.5-r5/hardware/tools/avr/bin/avrdude -C/media/juliano/arduino-1.6.5-r5/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cjtag2isp -Pusb -Uflash:w:/media/juliano/arduino-1.6.5-r5/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex:i -Ulock:w:0x0F:m

segunda-feira, 4 de abril de 2016

Resolving the Error: avrdude: usbdev_open(): did not find any USB device "usb"

I was trying to burn a Atmega328P with a JTAGICE mkII-CN programmer and AVRDUDE.
After give all permissions to the JTAGICE mkII (click here to learn how) I was receiving the follow error:

avrdude: usbdev_open(): did not find any USB device "usb"

The error was because I was using the wrong programmer on AVRDUDE. I replaced the programmer for "jtag2isp" and worked like a charm.

The final AVRDUDE command line still like this:

avrdude -C/media/Linux/arduino-1.6.5-r5/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cjtag2isp -Pusb -Uflash:w:/media/Linux/arduino-1.6.5-r5/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex:i -Ulock:w:0x0F:m