Hello,

I try to communicate with a cp210x-device on my usb bus. I create a sysfs
object with some simple lines of code like the next one ...

    static ssize_t cp210x_show_x(struct device *dev, struct device_attribute 
*attr, char *buf)
    {
        struct usb_serial_port *port = to_usb_serial_port(dev);

        if(!port) {
            printk("no port\n");
            goto exit;
        }

        if(!port->serial) {
            printk("no serial\n");
            goto exit;
        }

        struct cp210x_serial_private *spriv = usb_get_serial_data(port->serial);
        printk("%s:%s:%d num_ports:0x%08x\n", __FILE__, __func__, __LINE__, 
port->serial->num_ports);

    exit:
        return 0;
    }
    static DEVICE_ATTR(x, S_IRUGO, cp210x_show_x, NULL);

    static int create_sysfs_attrs(struct usb_serial *serial)
    {
        return device_create_file(&serial->dev->dev, &dev_attr_x);
    } 

I have the problem that port->serial is everytime NULL.

Some digging in usb-serial.c shows me that the port->serial is set on plugin of
my device through the usb_serial_probe-function.

Is this a bug or should I recive the usb_serial object with other mehods? What
methods should I use?

This Problem occurs on 3.9-rc7 and 3.13-rc3.

Thanks for some hints,
Silvio

-- 
-- S. Fricke ---------------------------------------- sil...@port1024.net --
   Diplom-Informatiker (FH)
   Linux-Entwicklung             JABBER: sil...@conversation.port1024.net   
----------------------------------------------------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to