Re: Question: USBserial suspend/resume issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Please excuse me if the email is too long....

I'm using kernel 2.6.31-5 on OpenSuse. Currently I have a usbserial
device with three interfaces showing under
/dev/ttyUSB0
/dev/ttyUSB1
/dev/ttyUSB2
Since this device is not belong to any existing special drivers, by
default, kernel load generic usb-serial driver with the source code
under driver/usb/serial/generic.c. The basic communication works fine
except the suspend/resume feature.


The issue I have is:
If I start a program which open the port of /dev/ttyUSB1 and
/dev/ttyUSB2 and then suspend PC (s2ram --force) and resume, I will
see
/dev/ttyUSB0
/dev/ttyUSB3 instead of /dev/ttyUSB1
/dev/ttyUSB4 instead of /dev/ttyUSB2

I didn't close /dev/ttyUSB1 and /dev/ttyUSB2 before PC suspend and my
goal is NOT to close these ports before suspend and, of course, keep
the port communication work after resume.

I checked /sys/bus/usb/devices/4-1/power/persist has the value of 1,
but there is NO persist file under
/sys/bus/usb/devices/4-1/4-1:1.0/power/
/sys/bus/usb/devices/4-1/4-1:1.1/power/
/sys/bus/usb/devices/4-1/4-1:1.2/power/
/sys/bus/usb/devices/4-1/4-1:1.3/power/
/sys/bus/usb/devices/4-1/4-1:1.4/power/
/sys/bus/usb/devices/4-1/4-1:1.5/power/

I hope this still means the device including the interfaces support
suspend/resume feature. Please confirm me.
Note: I mention 4-1 because from /var/log/message, kernel uses 4-1 and
4-1:1.x when I type the command "modprobe usbserial vendor=0xc1ca
product=0x2e"


I also use udev rules to force the mapping between usb port name and
the USB endpoint number. For e.x.
/dev/ttyUSB0 use endpoint 1
/dev/ttyUSB1 use endpoint 3
/dev/ttyUSB2 use endpoint 5

now using udev rules, I created symbolic link at the boot
/dev/myDev0  --> /dev/ttyUSB0
/dev/myDev1  --> /dev/ttyUSB1
/dev/myDev2  --> /dev/ttyUSB2

and after suspend resume,
/dev/myDev0  --> /dev/ttyUSB0
/dev/myDev1  --> /dev/ttyUSB3
/dev/myDev2  --> /dev/ttyUSB4

My userspace application uses /dev/myDevX instead of /dev/ttyUSBX.
However, after resume, the application still couldn't talk to the
device anymore.

So I think I still need to work on the driver.

I noticed drivers/usb/serial/generic.c doesn't have suspend and resume
function. so I added as below.
static struct usb_driver generic_driver = {
        .name =         "usbserial_generic",
        .probe =        generic_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     generic_serial_ids,
        .suspend =      usb_serial_suspend,  ==> call usb-serial.c's
usb_serial_suspend
        .resume =       usb_serial_resume,   ==>  call usb-serial.c's
usb_serial_resume
        .no_dynamic_id =        1,
};

But still no luck. The result is the same.

So can somebody provide me more information about usbserial
suspend/resume feature?
1. In the driver/usb/serial/usb-serial.c, are usb_serial_suspend and
usb_serial_resume work well for other products?
2. If need to change the driver, what do you suggest to modify for the
suspend/resume feature in usb-serial.c, generic.c or even
core/driver.c, etc?
3. Is there a way that I can selectively not to suspend the ttyUSBX ports?


I badly need instruction on this issue! Really appreciate if you could
provide any advice!

Best Regards,

Xu
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux