Skip to content

Commit

Permalink
remove unnecessary fd_read()/fd_write() wrapper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vsergeev committed Sep 15, 2014
1 parent 72cfcc5 commit 107844f
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions ssterm.py
Expand Up @@ -257,16 +257,6 @@ def stdin_reset():
except termios.error as err:
raise Exception("Setting stdin tty options: %s" % str(err))

###############################################################################
### fd read and write
###############################################################################

def fd_read(fd, n):
return os.read(fd, n)

def fd_write(fd, data):
return os.write(fd, data)

###############################################################################
### Input Processors
###############################################################################
Expand Down Expand Up @@ -506,7 +496,7 @@ def read_write_loop(serial_fd, stdin_fd, stdout_fd):
if stdin_fd in ready_read_fds:
# Read a buffer from stdin
try:
buf = fd_read(stdin_fd, READ_BUF_SIZE)
buf = os.read(stdin_fd, READ_BUF_SIZE)
except Exception as err:
raise Exception("Error reading stdin: %s\n" % str(err))

Expand All @@ -520,14 +510,14 @@ def read_write_loop(serial_fd, stdin_fd, stdout_fd):

# Write the buffer to the serial port
try:
fd_write(serial_fd, buf)
os.write(serial_fd, buf)
except Exception as err:
raise Exception("Error writing to serial port: %s\n" % str(err))

if serial_fd in ready_read_fds:
# Read a buffer from the serial port
try:
buf = fd_read(serial_fd, READ_BUF_SIZE)
buf = os.read(serial_fd, READ_BUF_SIZE)
except Exception as err:
raise Exception("Error reading serial port: %s\n" % str(err))

Expand All @@ -541,7 +531,7 @@ def read_write_loop(serial_fd, stdin_fd, stdout_fd):

# Write the buffer to stdout
try:
fd_write(stdout_fd, buf)
os.write(stdout_fd, buf)
except Exception as err:
raise Exception("Error writing to stdout: %s\n" % str(err))

Expand Down

0 comments on commit 107844f

Please sign in to comment.