serial-rs
serial-rs copied to clipboard
Higher baud rates for macOS
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 Not just Mac, but Linux supports this too with a different ioctl.
Any further works? :)