[MM qmi-support] "Set Operating Mode" on shutdown and more..
- From: Bjørn Mork <bjorn mork no>
- To: networkmanager-list gnome org
- Subject: [MM qmi-support] "Set Operating Mode" on shutdown and more..
- Date: Tue, 31 Jul 2012 15:33:44 +0200
Hello,
I am playing a bit with the qmi-support branch, which seems to be
getting close to operational. Nice work!
But I have a few issues I don't like, as usual :-)
1) On exit, ModemManager does this:
ModemManager[5390]: <debug> [1343739104.306007] [mm-serial-port.c:969] mm_serial_port_close(): (ttyUSB2) device open count is 1 (close)
ModemManager[5390]: <info> [1343739104.306225] [mm-iface-modem.c:979] mm_iface_modem_update_state(): Modem /org/freedesktop/ModemManager1/Modem/0: state changed (enabled -> disabling)
ModemManager[5390]: <debug> [1343739104.306713] [mm-broadband-modem-qmi.c:1488] common_power_up_down(): Setting device operating mode...
ModemManager[5390]: [/dev/cdc-wdm0] Sending message...
<<<<<< QMUX:
<<<<<< length = 16
<<<<<< flags = 0x00
<<<<<< service = "dms"
<<<<<< client = 1
<<<<<< QMI:
<<<<<< flags = "none"
<<<<<< transaction = 24
<<<<<< tlv_length = 4
<<<<<< message = "Set Operating Mode" (0x002E)
<<<<<< TLV:
<<<<<< type = "Mode" (0x01)
<<<<<< length = 1
<<<<<< value = 03
<<<<<< translated = 3
ModemManager[5390]: KEY: 18:00:01:02:00:00:00:00
ModemManager[5390]: Service: 02
ModemManager[5390]: Client ID: 01
ModemManager[5390]: Transaction ID: 18:00
ModemManager[5390]: [/dev/cdc-wdm0] Received message...
>>>>>> QMUX:
>>>>>> length = 19
>>>>>> flags = 0x80
>>>>>> service = "dms"
>>>>>> client = 1
>>>>>> QMI:
>>>>>> flags = "response"
>>>>>> transaction = 24
>>>>>> tlv_length = 7
>>>>>> message = "Set Operating Mode" (0x002E)
>>>>>> TLV:
>>>>>> type = "Result" (0x02)
>>>>>> length = 4
>>>>>> value = 00:00:00:00
>>>>>> translated = SUCCESS
ModemManager[5390]: KEY: 18:00:01:02:00:00:00:00
ModemManager[5390]: Service: 02
ModemManager[5390]: Client ID: 01
ModemManager[5390]: Transaction ID: 18:00
ModemManager[5390]: <debug> [1343739104.320498] [mm-iface-modem.c:2361] modem_power_down_ready(): Modem properly powered down...
ModemManager[5390]: <info> [1343739104.320551] [mm-iface-modem.c:979] mm_iface_modem_update_state(): Modem /org/freedesktop/ModemManager1/Modem/0: state changed (disabling -> disabled)
I don't know how other modems react to that, but my MC7710 does not play
nice. The only way I've found to get it out of "offline" mode is by
resetting it. Any other transition will result in an
"invalid-transition" error. This means that ModemManager itself is
unable to get the modem out of this state, because it only tries
setting "online" mode directly:
ModemManager[3539]: <debug> [1343734861.156480] [mm-broadband-modem.c:6428] enabling_started(): Flashing primary port before enabling...
ModemManager[3539]: <info> [1343734861.257123] [mm-iface-modem.c:979] mm_iface_modem_update_state(): Modem /org/freedesktop/ModemManager1/Modem/0: state changed (disabled -> enabling)
ModemManager[3539]: <debug> [1343734861.257485] [mm-broadband-modem-qmi.c:1488] common_power_up_down(): Setting device operating mode...
ModemManager[3539]: [/dev/cdc-wdm0] Sending message...
<<<<<< QMUX:
<<<<<< length = 16
<<<<<< flags = 0x00
<<<<<< service = "dms"
<<<<<< client = 3
<<<<<< QMI:
<<<<<< flags = "none"
<<<<<< transaction = 17
<<<<<< tlv_length = 4
<<<<<< message = "Set Operating Mode" (0x002E)
<<<<<< TLV:
<<<<<< type = "Mode" (0x01)
<<<<<< length = 1
<<<<<< value = 00
<<<<<< translated = 0
ModemManager[3539]: KEY: 11:00:03:02:00:00:00:00
ModemManager[3539]: Service: 02
ModemManager[3539]: Client ID: 03
ModemManager[3539]: Transaction ID: 11:00
ModemManager[3539]: [/dev/cdc-wdm0] Received message...
>>>>>> QMUX:
>>>>>> length = 19
>>>>>> flags = 0x80
>>>>>> service = "dms"
>>>>>> client = 3
>>>>>> QMI:
>>>>>> flags = "response"
>>>>>> transaction = 17
>>>>>> tlv_length = 7
>>>>>> message = "Set Operating Mode" (0x002E)
>>>>>> TLV:
>>>>>> type = "Result" (0x02)
>>>>>> length = 4
>>>>>> value = 01:00:3C:00
>>>>>> translated = FAILURE: invalid-transition
ModemManager[3539]: KEY: 11:00:03:02:00:00:00:00
ModemManager[3539]: Service: 02
ModemManager[3539]: Client ID: 03
ModemManager[3539]: Transaction ID: 11:00
ModemManager[3539]: <info> [1343734861.265084] [mm-iface-modem.c:979] mm_iface_modem_update_state(): Modem /org/freedesktop/ModemManager1/Modem/0: state changed (enabling -> disabled)
I don't think ModemManager should mess too much with the operating mode.
At most it could enable "online" mode if not already there, and possibly
reset back to the initial mode on exit. But to do this it needs to save
the initial mode and understand the allowed transitions. I really think
it's best not to touch this at all for now...
In any case, if the quest is to save power, then at least use
"low-power" and not "offline". I can switch back and forth between
these modes:
bjorn@nemi:/usr/local/src/git/modemmanager$ qmicli -d /dev/cdc-wdm1 --dms-set-operating-mode=low-power
[/dev/cdc-wdm1] Operating mode set successfully
bjorn@nemi:/usr/local/src/git/modemmanager$ qmicli -d /dev/cdc-wdm1 --dms-get-operating-mode
[/dev/cdc-wdm1] Operating mode retrieved:
Mode: 'low-power'
HW restricted: 'no'
bjorn@nemi:/usr/local/src/git/modemmanager$ qmicli -d /dev/cdc-wdm1 --dms-set-operating-mode=online
[/dev/cdc-wdm1] Operating mode set successfully
bjorn@nemi:/usr/local/src/git/modemmanager$ qmicli -d /dev/cdc-wdm1 --dms-get-operating-mode
[/dev/cdc-wdm1] Operating mode retrieved:
Mode: 'online'
HW restricted: 'no'
2) I seem to lose all but one data port on multi-port devices:
ModemManager[5836]: <debug> [1343739886.255573] [mm-plugin-manager.c:299] plugin_supports_port_ready(): (Gobi): (tty/ttyUSB1) found best plugin for port
ModemManager[5836]: <info> [1343739886.255610] [mm-device.c:427] mm_device_create_modem(): Creating modem with plugin 'Gobi' and '7' ports
ModemManager[5836]: <debug> [1343739886.255644] [gobi/mm-plugin-gobi.c:44] create_modem(): QMI-powered Gobi modem found...
ModemManager[5836]: <debug> [1343739886.256795] [mm-base-modem.c:247] mm_base_modem_grab_port(): (cdc-wdm0) type 'qmi' claimed by /sys/devices/pci0000:00/0000:00:1d.7/usb8/8-4
ModemManager[5836]: <debug> [1343739886.256859] [mm-base-modem.c:247] mm_base_modem_grab_port(): (cdc-wdm1) type 'qmi' claimed by /sys/devices/pci0000:00/0000:00:1d.7/usb8/8-4
ModemManager[5836]: <debug> [1343739886.256908] [mm-base-modem.c:247] mm_base_modem_grab_port(): (wwan0) type 'net' claimed by /sys/devices/pci0000:00/0000:00:1d.7/usb8/8-4
ModemManager[5836]: <debug> [1343739886.256961] [mm-base-modem.c:247] mm_base_modem_grab_port(): (wwan1) type 'net' claimed by /sys/devices/pci0000:00/0000:00:1d.7/usb8/8-4
ModemManager[5836]: <debug> [1343739886.257076] [mm-base-modem.c:247] mm_base_modem_grab_port(): (ttyUSB2) type 'at' claimed by /sys/devices/pci0000:00/0000:00:1d.7/usb8/8-4
ModemManager[5836]: <warn> [1343739886.257145] [mm-plugin.c:664] mm_plugin_create_modem(): Could not grab port (tty/ttyUSB1): 'Cannot add port 'tty/ttyUSB1', unhandled serial type'
ModemManager[5836]: <debug> [1343739886.257206] [mm-base-modem.c:247] mm_base_modem_grab_port(): (ttyUSB0) type 'qcdm' claimed by /sys/devices/pci0000:00/0000:00:1d.7/usb8/8-4
ModemManager[5836]: <debug> [1343739886.257235] [mm-base-modem.c:626] log_port(): (/sys/devices/pci0000:00/0000:00:1d.7/usb8/8-4) tty/ttyUSB2 primary
ModemManager[5836]: <debug> [1343739886.257258] [mm-base-modem.c:626] log_port(): (/sys/devices/pci0000:00/0000:00:1d.7/usb8/8-4) net/wwan0 data
ModemManager[5836]: <debug> [1343739886.257279] [mm-base-modem.c:626] log_port(): (/sys/devices/pci0000:00/0000:00:1d.7/usb8/8-4) tty/ttyUSB0 qcdm
ModemManager[5836]: <debug> [1343739886.257300] [mm-base-modem.c:626] log_port(): (/sys/devices/pci0000:00/0000:00:1d.7/usb8/8-4) usbmisc/cdc-wdm0 qmi
ModemManager[5836]: <info> [1343739886.257350] [mm-iface-modem.c:979] mm_iface_modem_update_state(): Modem: state changed (unknown -> initializing)
ModemManager[5836]: <info> [1343739886.257635] [mm-manager.c:149] find_device_support_ready(): Modem for device at '/sys/devices/pci0000:00/0000:00:1d.7/usb8/8-4' successfully created
ModemManager[5836]: [/dev/cdc-wdm0] Checking version info (10 retries)...
Don't know how the abstraction should be here, but it would be nice to
be able to use both wwan0 and wwan1 (and possibly also do PPP on
ttyUSB2). Note that these cannot be seen as separate modems. They
share the SIM interface and all QMI services except WDS.
Do also note that the above setup is working by pure luck. The code
really should try to match the wwanX and cdc-wdmY devices by USB
interface and not by USB device. If we ignore the unfortunate 3.4 and
3.5 kernels, then a matching wwanX and cdc-wdmY set will always share
the same parent USB interface on QMI devices.
Having the same parent USB device is *not* sufficient. You cannot
control wwan0 using cdc-wdm1 in the above example.
3) I still wonder how to handle the usb => usbmisc transition. For now
I've just been searching and replacing, but that is of course not
supportable. And it isn't really a one-to-one replacement either.
There are places where "usb" actually refer to the subsystem and not the
class.
Should "usbmisc" be added as an additional device class, keeping "usb",
or should there be some kernel version checking code there?
Bjørn
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]