Skip to content

Commit dc6c38f

Browse files
committed
Add options to configure serial flow control
1 parent ea7db39 commit dc6c38f

4 files changed

Lines changed: 29 additions & 18 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v4
2121
with:
2222
fetch-depth: 0
2323
- name: Set up Python
24-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v5
2525
with:
2626
python-version: "3.x"
2727
- name: Install pypa/build
@@ -32,7 +32,7 @@ jobs:
3232
run: |
3333
python -m build
3434
- name: Upload dist files
35-
uses: actions/upload-artifact@v2
35+
uses: actions/upload-artifact@v4
3636
with:
3737
name: dist-files
3838
path: dist/
@@ -44,7 +44,7 @@ jobs:
4444
runs-on: ubuntu-latest
4545
steps:
4646
- name: Download dist files
47-
uses: actions/download-artifact@v2
47+
uses: actions/download-artifact@v4
4848
with:
4949
name: dist-files
5050
path: dist/
@@ -61,7 +61,7 @@ jobs:
6161
runs-on: ubuntu-latest
6262
steps:
6363
- name: Download dist files
64-
uses: actions/download-artifact@v2
64+
uses: actions/download-artifact@v4
6565
with:
6666
name: dist-files
6767
path: dist/

README.rst

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
python-gsmmodem-new
2-
===================
1+
python-gsmmodem-2025
2+
====================
33
*GSM modem module for Python*
44

55
python-gsmmodem is a module that allows easy control of a GSM modem attached
@@ -28,6 +28,12 @@ Bundled utilities:
2828
- **identify-modem.py**: simple utility to identify attached modem. Can also be
2929
used to provide debug information used for development of python-gsmmodem.
3030

31+
How is this different than https://github.com/babca/python-gsmmodem?
32+
--------------------------------------------------------------------
33+
It seems the `python-gsmmodem-new` repository is not maintained anymore.
34+
This fork is a copy of the last commit from the original repository, with some modifications.
35+
Specifically, I started this to handle SIM800 modem, which require xonxoff flow control to work properly.
36+
3137
How to use this package
3238
-----------------------
3339

@@ -44,32 +50,32 @@ Requirements
4450
How to install this package
4551
---------------------------
4652

47-
There are multiple ways to install ``python-gsmmodem-new`` package:
53+
There are multiple ways to install ``python-gsmmodem-2025`` package:
4854

4955
Automatic installation of the latest "stable" release from PyPI
5056
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5157

5258
::
5359

54-
pip install python-gsmmodem-new
60+
pip install python-gsmmodem-2025
5561

5662
`pip <http://www.pip-installer.org>`_ will automatically download and install
5763
all dependencies, as required. You can also utilise ``easy_install`` in the
5864
same manner as using ``pip`` above.
5965

60-
If you are utilising ``python-gsmmodem-new`` as part of another project,
66+
If you are utilising ``python-gsmmodem-2025`` as part of another project,
6167
add it to your ``install_requires`` section of your ``setup.py`` file and
6268
upon your project's installation, it will be pulled in automatically.
6369

6470
Manual installation of the latest "stable" release from PyPI
6571
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6672

67-
Download a ``python-gsmmodem-new`` archive from `PyPI
68-
<https://pypi.python.org/pypi/python-gsmmodem-new>`_, extract it and install the package with command::
73+
Download a ``python-gsmmodem-2025`` archive from `PyPI
74+
<https://pypi.python.org/pypi/python-gsmmodem-2025>`_, extract it and install the package with command::
6975

7076
python setup.py install
7177

72-
Note that ``python-gsmmodem-new`` package relies on ``pySerial`` for serial communications:
78+
Note that ``python-gsmmodem-2025`` package relies on ``pySerial`` for serial communications:
7379
https://github.com/pyserial/pyserial
7480

7581
Installation of the latest commit from GitHub
@@ -81,7 +87,7 @@ Clone from GitHub::
8187
cd python-gsmmodem/
8288
python setup.py install
8389

84-
Note that ``python-gsmmodem-new`` package relies on ``pySerial`` for serial communications:
90+
Note that ``python-gsmmodem-2025`` package relies on ``pySerial`` for serial communications:
8591
https://github.com/pyserial/pyserial
8692

8793
Testing the package

gsmmodem/serial_comms.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class SerialComms(object):
2222
# Default timeout for serial port reads (in seconds)
2323
timeout = 1
2424

25-
def __init__(self, port, baudrate=115200, notifyCallbackFunc=None, fatalErrorCallbackFunc=None, *args, **kwargs):
25+
def __init__(self, port, baudrate=115200, notifyCallbackFunc=None, fatalErrorCallbackFunc=None,
26+
xonxoff=False, dsrdtr=True, rtscts=True, *args, **kwargs):
2627
""" Constructor
2728
2829
:param fatalErrorCallbackFunc: function to call if a fatal error occurs in the serial device reading thread
@@ -32,6 +33,10 @@ def __init__(self, port, baudrate=115200, notifyCallbackFunc=None, fatalErrorCal
3233
self.port = port
3334
self.baudrate = baudrate
3435

36+
self.xonxoff = xonxoff
37+
self.dsrdtr = dsrdtr
38+
self.rtscts = rtscts
39+
3540
self._responseEvent = None # threading.Event()
3641
self._expectResponseTermSeq = None # expected response terminator sequence
3742
self._response = None # Buffer containing response to a written command
@@ -47,7 +52,7 @@ def __init__(self, port, baudrate=115200, notifyCallbackFunc=None, fatalErrorCal
4752

4853
def connect(self):
4954
""" Connects to the device and starts the read thread """
50-
self.serial = serial.Serial(dsrdtr=True, rtscts=True, port=self.port, baudrate=self.baudrate,
55+
self.serial = serial.Serial(xonxoff=self.xonxoff, dsrdtr=self.dsrdtr, rtscts=self.rtscts, port=self.port, baudrate=self.baudrate,
5156
timeout=self.timeout,*self.com_args,**self.com_kwargs)
5257
# Start read thread
5358
self.alive = True

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[metadata]
2-
name = python-gsmmodem-new
2+
name = python-gsmmodem-2025
33
description = Control an attached GSM modem: send/receive SMS messages, handle calls, etc
44
license = LGPLv3+
55
author = Francois Aucamp
66
author_email = francois.aucamp@gmail.com
7-
url = https://github.com/babca/python-gsmmodem
7+
url = https://github.com/jaydenpung/python-gsmmodem
88
long_description = file: README.rst
99
long_description_content_type = text/x-rst
1010
classifiers =

0 commit comments

Comments
 (0)