Archive for the ‘GNU/Linux’ Category

16C950 UART 9-bit and custom baud rates support for Linux

February 21, 2010

Last friday I found myself patching the Linux kernel sources to be able to add custom baud rates support for 16C950 UART cards. I needed to communicate, via a serial port, with one of the devices built by the hardware guys at work. Unfortunately, a non-standard baud rate and 9-bits were needed.

The Sealevel Ultra COMM+422 PCI card we are using is already provided with a patch that adds 9-bit support. However, I was not able to found how to change the baud rate to a non-standard one.

Following the 9-bit patch approach, I added extra requests to ioctl in order to modify the 16C950 registers needed to achieve custom baud rates. Here is the list of added extra ioctl requests (also the 9-bit ones) with the necessary parameters and updated/accessed 16C950 registers:

Request Parameters 16C950 registers Description
TIOC9BITGET out: integer NMR Get current 9-bit status
TIOC9BITSET NMR Enable 9-bit support
TIOC9BITCLR NMR Disable 9-bit support
TIOCPRESCALERGET out: integer EFR, MCR Get prescaler status
TIOCPRESCALERSET EFR, MCR Enable prescaler
TIOCPRESCALERCLR EFR, MCR Disable prescaler
TIOCDIVLATCHGET out: integer LCR, DLL/DLM Get divisor latch register
TIOCDIVLATCHSET in: integer LCR, DLL/DLM Set divisor latch register
TIOCSAMPLINGCLKGET out: integer TCR Get sampling clock
TIOCSAMPLINGCLKSET in: integer TCR Set sampling clock
TIOCPRESCALERCLKGET out: integer CPR Get prescaler clock
TIOCPRESCALERCLKSET in: integer CPR Set prescaler clock

I’m not sure if this is the best way to do it, but it works. So, if you need 9-bit and custom baud rates support, apply one the following patches to the kernel (I have aslo updated the Sealevel patch for older and newer kernels than the one provided):

9-bit 2.6.24 2.6.26 2.6.31 2.6.32
9-bit and baud rate 2.6.24 2.6.26 2.6.31 2.6.32

I am not responsible for any damage that these patches can cause to your hardware. No warranty is provided, so use them at your own risk.

Screen Sharing with Mac OS X and GNU/Linux

December 12, 2007

Today, I discovered how to share my Mac OS X (Leopard) screen with another non-Mac OS X computer. Not a big deal, as it is almost automatic, but I’m posting it here as I did a search and I didn’t find how to do it.

What you need to do in your Mac OS X box is enabling the Screen Sharing service from the Sharing options in the System Preferences.

preferences1_small.png

Before establishing the connection you need to setup a password. This is done in the “Computer Settings…” button, just like this:

preferences2_small.png

Do not avoid the password step, if you do it the connection will not be established.

Finally, you only need a VNC client in your GNU/Linux box. Not all the clients work, one that it does is the TightVNC viewer. In Debian, you can just type:

apt-get install xtightvncviewer

Once installed, you only need to run it and supply the IP address of your Mac OS X box and the password you configured.

screensharing_small.png

Enjoy it!


Follow

Get every new post delivered to your Inbox.