summaryrefslogtreecommitdiff
path: root/serial/__init__.py
diff options
context:
space:
mode:
authorcliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2009-08-06 01:44:34 +0000
committercliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a>2009-08-06 01:44:34 +0000
commitc6ad6489c518831d5a32fe33760a2f99e5ae703b (patch)
treec6f1f725b582961a3b4886c84c27fa857c6d2937 /serial/__init__.py
parent0d74c5f242f9ff2c85dd9091450a91c305c2b2bb (diff)
downloadpyserial-c6ad6489c518831d5a32fe33760a2f99e5ae703b.tar.gz
- add simple socket connection implementationa
- update docs git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@310 f19166aa-fa4f-0410-85c2-fa1106f25c8a
Diffstat (limited to 'serial/__init__.py')
-rw-r--r--serial/__init__.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/serial/__init__.py b/serial/__init__.py
index d7d968f..06aab05 100644
--- a/serial/__init__.py
+++ b/serial/__init__.py
@@ -3,7 +3,7 @@
# portable serial port access with python
# this is a wrapper module for different platform implementations
#
-# (C)2001-2002 Chris Liechti <cliechti@gmx.net>
+# (C) 2001-2009 Chris Liechti <cliechti@gmx.net>
# this is distributed under a free software license, see license.txt
VERSION = '2.5'
@@ -26,8 +26,8 @@ else:
def serial_for_url(url, *args, **kwargs):
- """Get a native or a RFC2217 implementation of the Serial class, depending
- on port/url. The port is not opened when the keyword parameter
+ """Get a native, a RFC2217 or socket implementation of the Serial class,
+ depending on port/url. The port is not opened when the keyword parameter
'do_not_open' is true, by default it is."""
# check remove extra parameter to not confuse the Serial class
do_open = 'do_not_open' not in kwargs or not kwargs['do_not_open']
@@ -44,6 +44,9 @@ def serial_for_url(url, *args, **kwargs):
if url_nocase.startswith('rfc2217://'):
import rfc2217 # late import, so that users that don't use it don't have to load it
klass = rfc2217.Serial # RFC2217 implementation
+ elif url_nocase.startswith('socket://'):
+ import socket_connection # late import, so that users that don't use it don't have to load it
+ klass = socket_connection.Serial
else:
klass = Serial # 'native' implementation
# instantiate and open when desired