serial-rs icon indicating copy to clipboard operation
serial-rs copied to clipboard

Higher baud rates for macOS

Open tkornack opened this issue 8 years ago • 2 comments

Arbitrary baud rates—in particular 460800—are available on macOS using a special IOKit call. Kindly consider a special case ioctl call for them. Here is what pyserial does:

    IOSSIOSPEED = 0x80045402 
    class PlatformSpecific(PlatformSpecificBase):
        osx_version = os.uname()[2].split('.')
        # Tiger or above can support arbitrary serial speeds
        if int(osx_version[0]) >= 8:
            def _set_special_baudrate(self, baudrate):
                # use IOKit-specific call to set up high speeds
                buf = array.array('i', [baudrate])
                fcntl.ioctl(self.fd, IOSSIOSPEED, buf, 1)

tkornack avatar Aug 21 '16 21:08 tkornack

@tkornack Not just Mac, but Linux supports this too with a different ioctl.

dcuddeback avatar Feb 14 '17 16:02 dcuddeback

Any further works? :)

luojia65 avatar Apr 21 '20 08:04 luojia65