Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better OS detection #4

Open
ptrdvds opened this issue Jul 25, 2022 · 1 comment
Open

Better OS detection #4

ptrdvds opened this issue Jul 25, 2022 · 1 comment

Comments

@ptrdvds
Copy link

ptrdvds commented Jul 25, 2022

I found that os detection does not work for Mac OS.

Please use:


import platform

if platform.system() == "Linux":
    import fcntl

def sender(self):
    while True:
        if not(self.enabled):
            continue
        if platform.system() == "Linux":
            fcntl.ioctl(self.desc, 0x5427) # Yeah, it's magic. Start Break (TIOCSBRK)
            time.sleep(0.0001)
            fcntl.ioctl(self.desc, 0x5428) # Yeah, it's magic. End Break (TIOCCBRK)
        else:
            self.ser.send_break(0.0001)

https://docs.python.org/3.8/library/platform.html

I tried to use a pull request, but it was to cumbersome.

Thanks for the code, it works for me, but with changes merged to master for OS detection, it easier to use.
I am a mac and linux user :)

Chears Peter

@ptrdvds
Copy link
Author

ptrdvds commented Jul 25, 2022

The platform test could also be used to set the default USB port for an OS.
Eg.:
For "Darwin" : '/dev/tty.usbserial-1420'
For "Linux" : '/dev/ttyUSB0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant