Skip to content

TTY Line Discipline Issue with 3.10.y #446

Closed
@mholling

Description

@mholling

I have been running a line discipline for the DNT900 radio module on Raspberry Pi using the 3.6 kernel under Arch Linux. It works well. When I update the kernel to 3.10 the line discipline stops working.

I have pared down the problem to the receive_buf function for the line discipline, which receives incoming characters from the serial port. The function gets called on the 3.6 kernel, but not the 3.10 kernel.

Reproduce the problem using the following module code:

#include <linux/module.h>
#include <linux/tty.h>
#include <linux/tty_ldisc.h>
#include <linux/printk.h>

#define N_TEST 29

static void test_receive_buf(struct tty_struct *tty, \
    const unsigned char *cp, char *fp, int count)
{
    pr_info("test_receive_buf called\n");
}

static struct tty_ldisc_ops test_ops = {
    .magic        = TTY_LDISC_MAGIC,
    .owner        = THIS_MODULE,
    .num          = N_TEST,
    .name         = "test",
    .receive_buf  = test_receive_buf,
};

int __init test_init(void)
{
    return tty_register_ldisc(N_TEST, &test_ops);
}

void __exit test_exit(void)
{
    tty_unregister_ldisc(N_TEST);
}

module_init(test_init);
module_exit(test_exit);

MODULE_LICENSE("GPL");

Compile and insert the module, then attach the line discipline (number 29) to the serial port:

insmod test.ko
ldattach -8n1 -s 115200 29 /dev/ttyAMA0

Under kernel 3.6, the test_receive_buf function is called and the log entry written when ttyAMA0 receives characters. Under kernel 3.10, the function is not called.

I have no idea if this is Pi-specific or an upstream kernel issue, or something else again!

-- Matthew

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions