* [Fuego] [PATCH v2] sercp: Add support for full device paths
@ 2017-04-13 22:47 Bird, Timothy
2017-04-13 23:31 ` Frank Rowand
0 siblings, 1 reply; 4+ messages in thread
From: Bird, Timothy @ 2017-04-13 22:47 UTC (permalink / raw)
To: Frank Rowand, monstr@monstr.eu, fuego@lists.linuxfoundation.org
Add a new argument (-d, --device) to support a full device path.
Due to file argument parsing constraints, sercp cannot handle
certain serial paths used as the host for the source or destination.
This feature makes it possible to use a full path, with slashes and
colons, to specify the serial port for the operation. Use something
like:
$ sercp -d /dev/serial/by-path/pci-0000:08:00-usb-0:3:1.4 file1 serial:/tmp
The reason for this is that in some cases, using the full path is more
convenient than the single-word device. For example, the full path can
uniquely identify a serial port on a USB port, that might change device
names as USB ports are connected and disconnected.
Signed-off-by: Tim Bird <tim.bird@sony.com>
---
serio | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/serio b/serio
index f93290e..7518ca9 100755
--- a/serio
+++ b/serio
@@ -537,6 +537,7 @@ def usage_sercp():
print '''
-b, --baudrate=<baud> Serial port baud rate [115200]
-B, --basic Use basic (minimal) remote system commands
+ -d, --device=<device path> Use serial device specified
-h, --help Show help and exit
-M, --md5sum verify file transfer with md5sum
-m, --minicom=<name> Name of the minicom config file to use
@@ -555,6 +556,13 @@ Notes:
a "/" before the ":". This means that "host1" and "host2" may not
contain a "/". Due to this constraint "host1" and "host2" are device
names relative to "/dev/".
+ - if a device path is specified, then it should be a fully-qualified path
+ (not relative to '/dev/'), and you should use "serial" in the source
+ or destination path as the host. In this case the hostname is just
+ a placeholder.
+ ex: sercp -d /dev/serial/by-path/pci-0000:00:00-usb-0:3:1.4 file1 serial:/tmp
+ If multiple source files are specified, the hostname must be the
+ same for each one.
- All source files ("file1 ...") must be on the same host.
- The source files ("file1 ...") and the destination location ("file2")
must be on different hosts. Local copies and copies between remote
@@ -625,7 +633,8 @@ def usage_sersh():
Notes:
- user is ignored
- - host is a serial device name, relative to "/dev/".
+ - host is a serial device name, relative to "/dev/", or a full path
+ to the serial device, starting with "/".
- --timeout is a big stick. Setting <seconds> to a small value will result
in errors or unstable behaviour. <seconds> must be long enough to allow
the entire command to be echoed.
@@ -652,7 +661,7 @@ Return:
def main():
- def parse_arg_for_files(args):
+ def parse_arg_for_files(args, device_path):
host = None
files = []
@@ -687,9 +696,7 @@ def main():
host_start = arg.find('@') + 1
else:
host_start = 0
- new_host = arg[host_start:host_end]
- if not '/' in new_host:
- new_host = '/dev/' + new_host
+ new_host = "/dev/"+arg[host_start:host_end]
if host is None:
host = new_host
elif host != new_host:
@@ -705,6 +712,9 @@ def main():
file = arg
files.append(file)
+ if host is not None and device_path is not None:
+ host = device_path
+
return host, files
@@ -717,6 +727,7 @@ def main():
create_link_path = None
create_links = None
destination = None
+ device_path = None
timeout = None
minicom = None
port = None
@@ -763,10 +774,11 @@ def main():
try:
opts, args = getopt.getopt(sys.argv[1:],
- 'b:BhMm:rT:v',
+ 'b:Bd:hMm:rT:v',
[
'baudrate=',
'basic',
+ 'device=',
'help',
'md5sum',
'minicom=',
@@ -786,6 +798,8 @@ def main():
baudrate = arg
elif opt in ('-B', '--basic'):
basic = 1
+ elif opt in ('-d', '--device'):
+ device_path = arg
elif opt in ('-h', '--help'):
usage_sercp()
sys.exit(EX_OK)
@@ -885,8 +899,8 @@ def main():
print 'ERROR: file1 and file2 required'
sys.exit(EX_USAGE)
- src_host, source = parse_arg_for_files(args[0:len(args) - 1])
- dst_host, dst = parse_arg_for_files(args[len(args) - 1:])
+ src_host, source = parse_arg_for_files(args[0:len(args) - 1], device_path)
+ dst_host, dst = parse_arg_for_files(args[len(args) - 1:], device_path)
if src_host:
if dst_host:
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [Fuego] [PATCH v2] sercp: Add support for full device paths
2017-04-13 22:47 [Fuego] [PATCH v2] sercp: Add support for full device paths Bird, Timothy
@ 2017-04-13 23:31 ` Frank Rowand
2017-04-13 23:43 ` Frank Rowand
0 siblings, 1 reply; 4+ messages in thread
From: Frank Rowand @ 2017-04-13 23:31 UTC (permalink / raw)
To: Bird, Timothy, monstr@monstr.eu, fuego@lists.linuxfoundation.org
On 04/13/17 15:47, Bird, Timothy wrote:
> Add a new argument (-d, --device) to support a full device path.
> Due to file argument parsing constraints, sercp cannot handle
> certain serial paths used as the host for the source or destination.
>
> This feature makes it possible to use a full path, with slashes and
> colons, to specify the serial port for the operation. Use something
> like:
> $ sercp -d /dev/serial/by-path/pci-0000:08:00-usb-0:3:1.4 file1 serial:/tmp
>
> The reason for this is that in some cases, using the full path is more
> convenient than the single-word device. For example, the full path can
> uniquely identify a serial port on a USB port, that might change device
> names as USB ports are connected and disconnected.
>
> Signed-off-by: Tim Bird <tim.bird@sony.com>
> ---
> serio | 30 ++++++++++++++++++++++--------
> 1 file changed, 22 insertions(+), 8 deletions(-)
< snip >
Accepted.
I am assuming you have tested and will apply without further test
given your time contraints.
-Frank
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Fuego] [PATCH v2] sercp: Add support for full device paths
2017-04-13 23:31 ` Frank Rowand
@ 2017-04-13 23:43 ` Frank Rowand
2017-04-14 0:48 ` Bird, Timothy
0 siblings, 1 reply; 4+ messages in thread
From: Frank Rowand @ 2017-04-13 23:43 UTC (permalink / raw)
To: Bird, Timothy, monstr@monstr.eu, fuego@lists.linuxfoundation.org
On 04/13/17 16:31, Frank Rowand wrote:
> On 04/13/17 15:47, Bird, Timothy wrote:
>> Add a new argument (-d, --device) to support a full device path.
>> Due to file argument parsing constraints, sercp cannot handle
>> certain serial paths used as the host for the source or destination.
>>
>> This feature makes it possible to use a full path, with slashes and
>> colons, to specify the serial port for the operation. Use something
>> like:
>> $ sercp -d /dev/serial/by-path/pci-0000:08:00-usb-0:3:1.4 file1 serial:/tmp
>>
>> The reason for this is that in some cases, using the full path is more
>> convenient than the single-word device. For example, the full path can
>> uniquely identify a serial port on a USB port, that might change device
>> names as USB ports are connected and disconnected.
>>
>> Signed-off-by: Tim Bird <tim.bird@sony.com>
>> ---
>> serio | 30 ++++++++++++++++++++++--------
>> 1 file changed, 22 insertions(+), 8 deletions(-)
>
> < snip >
>
> Accepted.
>
> I am assuming you have tested and will apply without further test
> given your time contraints.
>
> -Frank
>
>
And commit pushed, with an added commit to update the version.
-Frank
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Fuego] [PATCH v2] sercp: Add support for full device paths
2017-04-13 23:43 ` Frank Rowand
@ 2017-04-14 0:48 ` Bird, Timothy
0 siblings, 0 replies; 4+ messages in thread
From: Bird, Timothy @ 2017-04-14 0:48 UTC (permalink / raw)
To: Frank Rowand, monstr@monstr.eu, fuego@lists.linuxfoundation.org
> -----Original Message-----
> From: Frank on Thursday, April 13, 2017 4:44 PM
> > < snip >
> >
> > Accepted.
> >
> > I am assuming you have tested and will apply without further test
> > given your time contraints.
Yes I did some testing. I'll do some more tomorrow with Fuego, to make
sure that using the /dev/serial/by-path/... paths work, if used in a
board's configuration.
> >
> > -Frank
> >
> >
>
> And commit pushed, with an added commit to update the version.
Thanks!
-- Tim
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-04-14 0:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-13 22:47 [Fuego] [PATCH v2] sercp: Add support for full device paths Bird, Timothy
2017-04-13 23:31 ` Frank Rowand
2017-04-13 23:43 ` Frank Rowand
2017-04-14 0:48 ` Bird, Timothy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.