Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 04-18-2013, 03:46 AM   #1
LQ Newbie
Registered: Apr 2013
Posts: 1

Rep: Reputation: Disabled
Proper Way to change Parity in Kernel Space

Hello together,

can somebody maybe help me with this issue:

I need to change the parity within a frame. User-Space is sending a frame (incl. some "control chars") and i need to send the first byte with Space parity, where all remaining bytes must be send with Mark parity.

The parity will be updated successfully for the first byte (i checked it by toggling between S->M and M->S on each incoming frame), but it is not changing for the remaining bytes. So it seems, you can change the parity before the first char of a frame is sent, but you cannot change the parity "within" the frame (just plain explanation).


What i have done:
In "serial8250_start_tx()" i am catching all incoming bytes and then check them for my "control bytes". If it is a control-byte, then i am changing the parity. If its not a control-byte, then i am sending this one like the "normal" serial8250_start_tx() does.

This is the code, which is changing the parity, where c is the byte from xmit, which described the new parity, and "tUserTermios" is the termios, which has been set by user-space. I am saving the termios to store information about baud, databits, stopsbits, etc.:

      printk("Update Parity <%c>!\n", c);

      /* Wait for transmitter register to empty */
      wait_for_xmitr(up, UART_LSR_TEMT);

      /* Check and update parity */
      up->tUserTermios.c_cflag &= ~(PARENB | PARODD | CMSPAR);
      up->tUserTermios.c_cflag |= (c=='O') ? (PARENB|PARODD) : 0;
      up->tUserTermios.c_cflag |= (c=='E') ? PARENB : 0;
      up->tUserTermios.c_cflag |= (c=='M') ? (PARENB|PARODD|CMSPAR): 0;
      up->tUserTermios.c_cflag |= (c=='S') ? (PARENB|CMSPAR): 0;
      /* Set new termios */
      serial8250_set_termios(&up->port, &up->tUserTermios, &old);

Any hints, what is wrong? Or did i miss something?



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
linux partion is not shoing the proper free disk space rajini23 Linux - Desktop 4 02-01-2012 01:36 AM
Filling unused CD/DVD space with parity or other redundant information jgombos Linux - Software 1 04-18-2010 09:38 AM
what's the proper way to change domains? steve51184 Linux - Server 3 03-18-2010 11:52 AM
kernel: Additional sense: Scsi parity error () SBN Linux - Hardware 3 12-24-2008 06:40 PM
Space parity in Linux vedion Linux - Software 1 03-23-2004 12:36 PM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 08:01 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration