Page 1 of 1

How can I set a non standard baudrate with PB ?

Posted: Sat Nov 05, 2011 1:07 am
by infratec
Hi Mac OS X gurus,

yesterday I had the chance to test one of my programs on Mac OS X.
In general it works, but...
I have to open the serial port with a non standard baudraute.
The Linux method is not working :(

Code: Select all

LinuxSerialInfo.serial_struct

ioctl_(Handle , #TIOCGSERIAL, @LinuxSerialInfo)

LinuxSerialInfo\flags | #ASYNC_SPD_CUST
LinuxSerialInfo\custom_divisor = LinuxSerialInfo\baud_base / Baud

ioctl_(Handle, #TIOCSSERIAL, @LinuxSerialInfo)
Any ideas :?:

I only found examples with IOSSIOSPEED in 'C', but no idea how I can use this
in combination with PB.

Hope somebody can help me.

Bernd

Re: How can I set a non standard baudrate with PB ?

Posted: Sat Nov 05, 2011 8:42 am
by wilbert
I think it should be something like this

Code: Select all

#IOSSIOSPEED = $80045402

fileDescriptor = OpenSerialPort(0, "/dev/tty.Bluetooth-PDA-Sync", 300, #PB_SerialPort_NoParity, 8, 1, #PB_SerialPort_NoHandshake, 1024, 1024)

speed.l = 14400
If ioctl_(fileDescriptor, #IOSSIOSPEED, @speed) = -1
  Debug "error setting speed"
EndIf
but I'm not sure.
I guess only someone from the PB dev team can tell you the proper way to get the fileDescriptor .

Re: How can I set a non standard baudrate with PB ?

Posted: Sat Nov 05, 2011 10:00 am
by infratec
Hi Wilbert,

thanks for your reply. I hope that I can test this soon.
For the fd I use the following for Linux:

Code: Select all

If SerialPort = #PB_Any
  Handle = SerialPortID(Port)
Else
  Handle = Port
EndIf
I think it is the same on the Mac.

Bernd