MAVProxy icon indicating copy to clipboard operation
MAVProxy copied to clipboard

Forwarding to serial port issue (windows)

Open swanepoeljan opened this issue 11 years ago • 1 comments

Hi,

I have been forwarding packets from my ardu connected to a com port to upd ports with no problem but when I forward to other com ports it's not working. I receive this error:

Init ArduCopter V2.9.1b

Free RAM: 1813

FW Ver: 120

load_all took 2876us

Press ENTER 3 times to start interactive setup

STABILIZE> Mode STABILIZE Exception in thread Thread-2: Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner self.run() File "C:\Python27\lib\threading.py", line 763, in run self.__target(_self.__args, *_self.__kwargs) File "C:\MAVProxy-1.3.12\MAVProxy\mavproxy.py", line 908, in main_loop (rin, win, xin) = select.select(rin, [], [], 0.01) TypeError: argument must be an int, or have a fileno() method.

I have looked at the code but since my python skills are not that good I am having a hard time figuring out whats wrong. From the error message I take it the function expects an integer type that its not getting.

I have also found this piece of information on python.org regarding "select" which might explain it: "Note that on Windows, it only works for sockets;" and a com port is not a socket right... and fits the reason why it works when forwarding to UDP.

Any ideas or work-arounds that I could try?

swanepoeljan avatar Sep 01 '14 09:09 swanepoeljan

Old issue but I'm getting the same thing. It seems that the fd property for mavserial instances is None, though I am not sure if this is specific to Windows. I'm also not sure if select.select is even supported for serial ports on Windows.

I added the following snippet after this line: https://github.com/ArduPilot/MAVProxy/blob/6853c3758105d9449032781356998e16fa2b3ab1/MAVProxy/mavproxy.py#L1078

except TypeError:
    pass

Whcih skips the select call entirely. It appears to work correctly. Is the select call required?

auxym avatar Jul 07 '21 19:07 auxym