1. atlas 0f d00m
  2. rfcat
  3. Issues


Issue #15 new

No receive capability on Windows

created an issue

With rfcat and Windows, none of the receive functions appear to work. RFlisten(), discover(), etc - all fail. Transmit works ok. The error returned is...

File "C:\SDR\rfcat\rflib\chipcon_usb.py", line 120, in keystop return len(select.select([sys.stdin],[],[],delay)[0]) error: (10093, 'Either the application has not called WSAStartup, or WSAStartup failed')

Searching the net reveals that the select function is provided by the socket library on Windows. So, adding 'import socket' corrects that error. Then, a new error...

File "C:\SDR\rfcat\rflib\chipcon_usb.py", line 120, in keystop return len(select.select([sys.stdin],[],[],delay)[0]) error: (10038, 'An operation was attempted on something that is not a socket')

Again, searching the net says that select can only be used for sockets, not sys.stdin.

Any ideas on how to get the rfcat receive functions to work properly in Windows?

Comments (8)

  1. atlas 0f d00m repo owner

    wow, interesting. that's just the "keystop" functionality, which checks to see if you've typed <enter> so it can nicely stop the display loop.
    are you able to receive on Windows if you turn that line into:

    time.sleep(delay) return 0

    ?? you won't be able to stop sniffing/receiving without CTRL-C, but if that's the only problem receiving on Windows, i'll find another solution.

  2. atlas 0f d00m repo owner

    could you please try replacing the keystop code with this:

    import os if os.name == 'nt': import msvcrt

    def keystop(delay=0): if os.name == 'posix': return len(select.select([sys.stdin],[],[],delay)[0]) else: return msvcrt.kbhit()

    please let me know if that solves the problem

  3. DJW reporter

    That sort-of worked. RFlisten seems to work. On first attempt, discover() returned a USB timeout error and aborted. After changing the baud rate to something I knew was transmitting (using setMdmDRate), many messages started to be returned. However, pressing control-C doesn't stop the process - just says 'Keyboard interrupt' and keeps going. Only way to stop it was to close the command prompt window. After that, I get this when trying to restart rfcat...

    C:\SDR\rfcat>python rfcat -r Error in resetup():ChipconUsbTimeoutException() Traceback (most recent call last): File "rfcat", line 56, in <module> interactive(ifo.index, DongleClass=RfCat, intro=intro) File "C:\SDR\rfcat\rflib__init.py", line 190, in interactive d = DongleClass(idx=idx) File "C:\SDR\rfcat\rflib\chipcon_nic.py", line 301, in init__ self.mhz = CHIPmhz.get(self.chipnum) AttributeError: RfCat instance has no attribute 'chipnum'

    To get operation back, I unplugged the Yardstick and rebooted (not sure which solved it). So it seems that the fix needs something a bit more than the sleep delay only. I'll try your new fix shortly.

  4. DJW reporter

    Yes, that appears to work fine. Thank you.

    Also, if you decide to update the code base with this - there is at least one other problem on Windows. In the rfcat file in the root, there are these two lines...

    import readline readline.parse_and_bind("tab: complete")

    Readline is not supported with Python on Windows. I had to comment out those two lines - not sure of the implication, or if there is a better solution.

    Thanks again, Dave

  5. atlas 0f d00m repo owner

    PyReadline is an installable package on Windows. It's required for IPython to be used to it's full capability. PyReadline is required for RfCat on Windows


    or probably:

    pip install pyreadline

    please try installing and running it. let me know how it goes and i'll be sure to update the documentation once you confirm.

  6. DJW reporter

    When I got the initial readline errors, installing pyreadline was the first thing I tried. First problem - the library is named differently, so 'import readline' still failed. The import line can be changed to 'import pyreadline as readline', or with the following for more universal compatibility...

      import readline
    except ImportError:
      import pyreadline as readline

    However, the code a couple lines down then fails - readline.parse_and_bind("tab: complete"). At that point, I just commented out the import and the parse_and_bind lines, and everything seemed to be working. I'm not actually sure what the 'parse_and_bind' line of code is doing in the context of rfcat (tab complete of function names??), but I didn't see any adverse side affects of removing it (for Windows anyway).

    I haven't installed IPython, but I don't think that relates to the readline import errors on Windows. But the IPython shell does appear to provide native tab completion automatically, from what I've read.

  7. atlas 0f d00m repo owner

    IPython only provides tab-complete if readline is installed.

    what kind of failure are you getting on windows at the parse_and_bind line? is it something we can fix? i hate tweaking for one OS versus the other, it's why i like Python, but if we are having RfCat working on Windows, we'll make the changes for usability and happiness ;)

  8. DJW reporter

    OK, so I just reinstalled pyreadline and installed IPython. The unmodified rfcat file is now working ok. Oddly, now that IPython is installed, I don't see the welcome screen when launching with rfcat -r. It goes right to a command prompt, after several seconds of loading. Tab complete does work once it loads. But given the load delay and missing welcome text, I decided to uninstall IPython. Lost tab complete, but the unmodified rfcat file is still working - no import error.

    So I would say, forget about the readline import issue on Windows - seems ok if pyreadline does get installed correctly. But the 'select' issue for receiving would be welcome fix in the mainline code.

    My only issue now is how to update the firmware via my working Windows 7 PC's to get the Yardstick One to work on Windows 10. My new Yardstick has older firmware, hence the USB descriptor issue.

  9. Log in to comment