Ubuntu - Serial problem [SOLVED]

Hello, I recently migrated to Ubuntu 11.04 and I installed Arduino via Synaptic, it seems to work fine but it wont upload.

I have a self-made breaduino with an Atmega168, under windowsOS it works perfectly, selecting the arduino board: "diecimila w/168", so I upload a serial test program to test my ubuntu drivers. Wen I open the Serial Monitor on ubuntu I can comunicate with it just fine at 9600 bd.

The problem is uploading in ubuntu OS, I selected the same board and the correct port, but it says "avrdude: stk500_getsync(): not in sync: resp=0x20" (I have tested all the "reset" options, while, before, after pressing upload)

verbose output:

Binary sketch size: 990 bytes (of a 14336 byte maximum)
/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega168 -carduino -P/dev/ttyS4 -b19200 -D -Uflash:w:/tmp/build6136871358548744634.tmp/Blink.cpp.hex:i 

avrdude: Version 5.10, compiled on Jun 29 2010 at 03:44:14
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/share/arduino/hardware/tools/avrdude.conf"
         User configuration file is "/home/rawthil/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyS4
         Using Programmer              : arduino
         Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Recv:   [20] 
avrdude: stk500_getsync(): not in sync: resp=0x20

avrdude done.  Thank you.

And I also tried via command line with

/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega168 -carduino -P/dev/ttyS4 -b9600 -D -Uflash:w:/tmp/build6136871358548744634.tmp/Blink.cpp.hex:i

(note "-b9600" istead of "-b19200")
but it makes no diference.

Im using a PCI-Serial board based on a WCH352L

Thanks!

Well after a week looking I found out what was the problem.

It looks like my pci-serial card drivers for Linux (ch35x_80x86) wont do the whole work, so I found out that my setserial output has something wrong:

rawthil@Smaug:~$ setserial -g /dev/ttyS[04]
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS4, UART: undefined, Port: 0x9010, IRQ: 21

So I googled it and found out this realy helpfull page out there:

with this simple command (where "ttyS4" is your serial port) I fixed it

sudo setserial /dev/ttyS4 uart 16550A

And now its working wonderfully!

Hope this help someone!