Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
b67990f9
Commit
b67990f9
authored
Aug 03, 2012
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable hup on serial port
parent
99ec219e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
printcore.py
printrun/printcore.py
+17
-1
No files found.
printrun/printcore.py
View file @
b67990f9
...
@@ -19,6 +19,21 @@ from serial import Serial, SerialException
...
@@ -19,6 +19,21 @@ from serial import Serial, SerialException
from
threading
import
Thread
from
threading
import
Thread
from
select
import
error
as
SelectError
from
select
import
error
as
SelectError
import
time
,
getopt
,
sys
import
time
,
getopt
,
sys
import
platform
,
os
def
control_ttyhup
(
port
,
disable_hup
):
"""Controls the HUPCL"""
if
platform
.
system
()
==
"Linux"
:
if
disable_hup
:
os
.
system
(
"stty -F
%
s -hup"
%
port
)
else
:
os
.
system
(
"stty -F
%
s hup"
%
port
)
def
enable_hup
(
port
):
control_ttyhup
(
port
,
False
)
def
disable_hup
(
port
):
control_ttyhup
(
port
,
True
)
class
printcore
():
class
printcore
():
def
__init__
(
self
,
port
=
None
,
baud
=
None
):
def
__init__
(
self
,
port
=
None
,
baud
=
None
):
...
@@ -80,7 +95,8 @@ class printcore():
...
@@ -80,7 +95,8 @@ class printcore():
if
baud
is
not
None
:
if
baud
is
not
None
:
self
.
baud
=
baud
self
.
baud
=
baud
if
self
.
port
is
not
None
and
self
.
baud
is
not
None
:
if
self
.
port
is
not
None
and
self
.
baud
is
not
None
:
self
.
printer
=
Serial
(
port
=
self
.
port
,
baudrate
=
self
.
baud
,
timeout
=
1
,
dsrdtr
=
True
)
disable_hup
(
self
.
port
)
self
.
printer
=
Serial
(
port
=
self
.
port
,
baudrate
=
self
.
baud
,
timeout
=
1
)
self
.
stop_read_thread
=
False
self
.
stop_read_thread
=
False
self
.
read_thread
=
Thread
(
target
=
self
.
_listen
)
self
.
read_thread
=
Thread
(
target
=
self
.
_listen
)
self
.
read_thread
.
start
()
self
.
read_thread
.
start
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment