Re: Flow control settings for RS232 modems

2017-03-31 Thread Dan Williams
On Sat, 2017-03-25 at 19:32 +0100, Aleksander Morgado wrote:
> Hey Dan, Daniele, Carlo & everyone,
> 
> This series of patches tries to implement proper flow control
> settings on the serial port, and is based on letting MM detect which
> are the supported modes with AT+IFC=?. This makes it unnecessary to
> subclass the flow control setting in plugins for modems that don't
> support XON/XOFF (what was being used as default), like the Telit
> plugin.

In general, patches 1-7 look good to me.  Only one comment on patch 8.

Dan

> The new logic will:
>   * Always open the serial ports without any flow control enabled.
>   * Query the modem which flow control methods are supported, with
> AT+IFC=?.
>   * If supported, prefer RTS/CTS over XON/XOFF, and notify the modem
> via AT+IFC=x,x our selection.
>   * When the port gets connected after an ATD call, reconfigure the
> TTY with the flow control attributes corresponding to the method we
> selected via AT+IFC.
>   * pppd may be run without any of the explicit options regarding
> flow control, which means that whatever was configured in the TTY is
> used.
>   * On port disconnection, we clear the flow control attributes of
> the TTY explicitly, although this is really not totally needed as we
> fully close and re-open the port (and during the re-open the port is
> opened without flow control enabled).
> 
> I prepared this logic for the Telit LE866-SV1, although it really is
> generic for every RS232 modem out there.
> 
> What do you guys think?
> 
> [PATCH 1/8] helpers: new parser for AT+IFC=?
> [PATCH 2/8] broadband-modem: query supported flow control modes
> [PATCH 3/8] wavecom: ignore custom flow control handling
> [PATCH 4/8] telit: ignore custom flow control handling
> [PATCH 5/8] port-serial: new internal method to run tcsetattr()
> [PATCH 6/8] port-serial: new method to explicitly set flow control
> [PATCH 7/8] port-serial: remove all default flow control settings
> [PATCH 8/8] broadband-bearer: once connected, set flow control
> ___
> ModemManager-devel mailing list
> ModemManager-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: Flow control settings for RS232 modems

2017-03-28 Thread Aleksander Morgado
On Tue, Mar 28, 2017 at 10:57 AM, carlo  wrote:
>> BTW; does the PLATFORM_DRIVER_PROBE tag work if you tag
>> "/devices/pnp0/00:05/" instead of "/devices/pnp0/00:05/tty/ttyS0"?
>
>
> uhm, no, this way ttyS0 is not whitelisted, but it works with
> "/devices/pnp0/00:05/*"
> (or "/devices/pnp0/00:05/tty/*" if we want to be more selective)"

Is it that multiple TTYs are being exposed under the same
/devices/pnp0/00:05/ path?

-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: Flow control settings for RS232 modems

2017-03-28 Thread Aleksander Morgado
On Tue, Mar 28, 2017 at 10:21 AM, carlo  wrote:
> Oops
> also a == for DEVPATH test
>

Oh, yeah, and that :)

> ACTION!="add|change|move", GOTO="mm_serial_end"
> DEVPATH=="/devices/pnp0/00:05/tty/ttyS0",
> ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1" LABEL="mm_serial_end"
>

I assume you have the LABEL in a new line? i.e. this:

ACTION!="add|change|move", GOTO="mm_serial_end"
DEVPATH=="/devices/pnp0/00:05/tty/ttyS0", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"
LABEL="mm_serial_end"


> Now ttyS0 is whitelisted correctly, but still some problems in using Telit
> plugin (or any other plugin). MM log attached.

Baudrate? The modem should use 57600bps, as that is what MM expects.
If a different one, you can add a new rule like:
DEVPATH=="/devices/pnp0/00:05/tty/ttyS0", ENV{ID_MM_TTY_BAUDRATE}="115200"

Also, 8N1 as serial port settings, but I doubt it's different in your modem.

BTW; does the PLATFORM_DRIVER_PROBE tag work if you tag
"/devices/pnp0/00:05/" instead of "/devices/pnp0/00:05/tty/ttyS0"?

-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: Flow control settings for RS232 modems

2017-03-28 Thread carlo
Thanks to Daniele's suggestion, I changed modem baudrate to 57600 and 
now it works fine



Carlo


On 28/03/2017 10:21, carlo wrote:
> Ok, please retry after adding the missing comma between the DEVPATH 
and the ENV:


Oops
also a == for DEVPATH test

ACTION!="add|change|move", GOTO="mm_serial_end"
DEVPATH=="/devices/pnp0/00:05/tty/ttyS0", 
ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1" LABEL="mm_serial_end"


Now ttyS0 is whitelisted correctly, but still some problems in using 
Telit plugin (or any other plugin). MM log attached.


Carlo



On 28/03/2017 09:41, Aleksander Morgado wrote:

On Tue, Mar 28, 2017 at 9:01 AM, Carlo Lobrano  wrote:

Here it is

$ udevadm info -p /sys/class/tty/ttyS0
P: /devices/pnp0/00:05/tty/ttyS0
N: ttyS0
E: DEVNAME=/dev/ttyS0
E: DEVPATH=/devices/pnp0/00:05/tty/ttyS0
E: ID_MM_CANDIDATE=1
E: MAJOR=4
E: MINOR=64
E: SUBSYSTEM=tty
E: TAGS=:systemd:
E: USEC_INITIALIZED=955641


On Mon, 27 Mar 2017 at 20:44 Aleksander Morgado
wrote:

On Mon, Mar 27, 2017 at 6:04 PM, carlo  wrote:

Does this work?

# cat < /lib/udev/rules.d/78-mm-serial.rules
ACTION!="add|change|move", GOTO="mm_serial_end"
DEVPATH=”/devices/pnp0/00:05/tty/ttyS0”
ENV{ID_MM_PLATFORM_DRIVER_PROBE}=”1”
LABEL=”mm_serial_end"
EOF
# udevadm control --reload
# udevadm trigger
// Relaunch MM

Ok, please retry after adding the missing comma between the DEVPATH and the ENV:

# cat < /lib/udev/rules.d/78-mm-serial.rules
ACTION!="add|change|move", GOTO="mm_serial_end"
DEVPATH="/devices/pnp0/00:05/tty/ttyS0", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"
LABEL="mm_serial_end"
EOF
# udevadm control --reload
# udevadm trigger
# udevadm info -p /sys/class/tty/ttyS0

This should really add the tag.





___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: Flow control settings for RS232 modems

2017-03-28 Thread Aleksander Morgado
On Tue, Mar 28, 2017 at 9:01 AM, Carlo Lobrano  wrote:
> Here it is
>
> $ udevadm info -p /sys/class/tty/ttyS0
> P: /devices/pnp0/00:05/tty/ttyS0
> N: ttyS0
> E: DEVNAME=/dev/ttyS0
> E: DEVPATH=/devices/pnp0/00:05/tty/ttyS0
> E: ID_MM_CANDIDATE=1
> E: MAJOR=4
> E: MINOR=64
> E: SUBSYSTEM=tty
> E: TAGS=:systemd:
> E: USEC_INITIALIZED=955641
>
>
> On Mon, 27 Mar 2017 at 20:44 Aleksander Morgado 
> wrote:
>>
>> On Mon, Mar 27, 2017 at 6:04 PM, carlo  wrote:
>> >> Does this work?
>> >>
>> >> # cat < /lib/udev/rules.d/78-mm-serial.rules
>> >> ACTION!="add|change|move", GOTO="mm_serial_end"
>> >> DEVPATH=”/devices/pnp0/00:05/tty/ttyS0”
>> >> ENV{ID_MM_PLATFORM_DRIVER_PROBE}=”1”
>> >> LABEL=”mm_serial_end"
>> >> EOF
>> >> # udevadm control --reload
>> >> # udevadm trigger
>> >> // Relaunch MM
>> >

Ok, please retry after adding the missing comma between the DEVPATH and the ENV:

# cat < /lib/udev/rules.d/78-mm-serial.rules
ACTION!="add|change|move", GOTO="mm_serial_end"
DEVPATH="/devices/pnp0/00:05/tty/ttyS0", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"
LABEL="mm_serial_end"
EOF
# udevadm control --reload
# udevadm trigger
# udevadm info -p /sys/class/tty/ttyS0

This should really add the tag.

-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: Flow control settings for RS232 modems

2017-03-28 Thread Carlo Lobrano
Here it is

$ udevadm info -p /sys/class/tty/ttyS0
P: /devices/pnp0/00:05/tty/ttyS0
N: ttyS0
E: DEVNAME=/dev/ttyS0
E: DEVPATH=/devices/pnp0/00:05/tty/ttyS0
E: ID_MM_CANDIDATE=1
E: MAJOR=4
E: MINOR=64
E: SUBSYSTEM=tty
E: TAGS=:systemd:
E: USEC_INITIALIZED=955641


On Mon, 27 Mar 2017 at 20:44 Aleksander Morgado 
wrote:

> On Mon, Mar 27, 2017 at 6:04 PM, carlo  wrote:
> >> Does this work?
> >>
> >> # cat < /lib/udev/rules.d/78-mm-serial.rules
> >> ACTION!="add|change|move", GOTO="mm_serial_end"
> >> DEVPATH=”/devices/pnp0/00:05/tty/ttyS0”
> >> ENV{ID_MM_PLATFORM_DRIVER_PROBE}=”1”
> >> LABEL=”mm_serial_end"
> >> EOF
> >> # udevadm control --reload
> >> # udevadm trigger
> >> // Relaunch MM
> >
> > unfortunately no, I got the same result
>
> Can you run "udevadm info -p /sys/class/tty/ttyS0" (i.e. without
> --atribute-walk)
>
> --
> Aleksander
> https://aleksander.es
>
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: Flow control settings for RS232 modems

2017-03-27 Thread Aleksander Morgado
On Mon, Mar 27, 2017 at 6:04 PM, carlo  wrote:
>> Does this work?
>>
>> # cat < /lib/udev/rules.d/78-mm-serial.rules
>> ACTION!="add|change|move", GOTO="mm_serial_end"
>> DEVPATH=”/devices/pnp0/00:05/tty/ttyS0”
>> ENV{ID_MM_PLATFORM_DRIVER_PROBE}=”1”
>> LABEL=”mm_serial_end"
>> EOF
>> # udevadm control --reload
>> # udevadm trigger
>> // Relaunch MM
>
> unfortunately no, I got the same result

Can you run "udevadm info -p /sys/class/tty/ttyS0" (i.e. without
--atribute-walk)

-- 
Aleksander
https://aleksander.es
___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel


Re: Flow control settings for RS232 modems

2017-03-27 Thread carlo

>  Does this work?


# cat < /lib/udev/rules.d/78-mm-serial.rules
ACTION!="add|change|move", GOTO="mm_serial_end"
DEVPATH=”/devices/pnp0/00:05/tty/ttyS0” ENV{ID_MM_PLATFORM_DRIVER_PROBE}=”1”
LABEL=”mm_serial_end"
EOF
# udevadm control --reload
# udevadm trigger
// Relaunch MM


unfortunately no, I got the same result

Carlo
On 27/03/2017 17:38, Aleksander Morgado wrote:

On Mon, Mar 27, 2017 at 3:52 PM, Carlo Lobrano  wrote:

I've got some problems configuring MM for this test. This is the message I
got just after applying the patch:

ModemManager[28005]:  [1490621030.009049] [mm-base-manager.c:263]
device_added(): (tty/ttyS0): adding device at sysfs path:
/sys/devices/pnp0/00:05/tty/ttyS0
ModemManager[28005]:  [1490621030.009100]
[kerneldevice/mm-kernel-device-udev.c:474] kernel_device_is_candidate():
(tty/ttyS0): port's parent platform driver is not whitelisted

I saw the other email about udev rule to whitelist the serial device, but it
seems I could not get it right.

This is the udevadm info about the serial that responds to AT commands

$ udevadm info --attribute-walk /sys/class/tty/ttyS0

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

   looking at device '/devices/pnp0/00:05/tty/ttyS0':
 KERNEL=="ttyS0"
 SUBSYSTEM=="tty"
 DRIVER==""

   looking at parent device '/devices/pnp0/00:05':
 KERNELS=="00:05"
 SUBSYSTEMS=="pnp"
 DRIVERS=="serial"
 ATTRS{id}=="PNP0501"

   looking at parent device '/devices/pnp0':
 KERNELS=="pnp0"
 SUBSYSTEMS==""
 DRIVERS==""

I tried adding the line

 DRIVERS=="serial", ENV{ID_MM_PLATFORM_DRIVER_PROBE}="1"

to 77-mm-platform-serial-whitelist.rules and reloading the rules, but it
doesn't seem the correct way to do it.

What am I doing wrong?

Does this work?

# cat < /lib/udev/rules.d/78-mm-serial.rules
ACTION!="add|change|move", GOTO="mm_serial_end"
DEVPATH=”/devices/pnp0/00:05/tty/ttyS0” ENV{ID_MM_PLATFORM_DRIVER_PROBE}=”1”
LABEL=”mm_serial_end"
EOF
# udevadm control --reload
# udevadm trigger
// Relaunch MM




___
ModemManager-devel mailing list
ModemManager-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel