title: using pySerial to get device data through RS485
body: <p>I want to get device data from RS485 serial port,</p>
  
  <p>use an RS485 to USB converter.</p>
  
  <p>I use the same code on Windows and Linux base.</p>
  
  <p>I can get data on windows,But can't get any data on Linux.</p>
  
  <p>Why...? I use the same code...</p>
  
  <p>Only different Windows port is 'COM7',
  and Linux port is '/dev/ttyUSB0'</p>
  
  <p>This is my code:</p>
  
  <pre><code># -*- coding: UTF-8 -*-
  
  import serial
  import binascii
  import time
  
  ser = serial.Serial()
  
  def initSerial():
      global ser
      ser.baudrate = 9600
      #ser.port = '/dev/ttyUSB0'
      ser.port = 'COM7'
      #ser.timeout =0
      ser.stopbits = serial.STOPBITS_ONE
      ser.bytesize = 8
      ser.parity = serial.PARITY_NONE
      ser.rtscts = 0
  
  def main():
      initSerial()
      global ser
      ser.open()
      while True:
          mHex = ser.read()
          if len(mHex)!= 0:
              print("get",binascii.hexlify(bytearray(mHex)))
          time.sleep(0.1)
  
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>and windows can get data like this:</p>
  
  <pre><code>('get', '01')
  ('get', 'ab')
  ('get', 'ba')
  ('get', '01')
  ('get', '01')
  </code></pre>