mikepb / go-serial

Go binding to libserialport for serial port functionality.
53 stars 28 forks source link

SP_ERR_SUP just trying to open port on MacOS 10.10 #2

Open jimbojsb opened 9 years ago

jimbojsb commented 9 years ago

Given the following simple example of attempting to write to an Arduino Uno:

    serial.SetDebug(true)
    options := serial.RawOptions
    options.Parity = serial.PARITY_EVEN

    port, err := options.Open("dev/cu.usbmodem14131")
    if err != nil {
        fmt.Println(err)
    }

I get the following output:

sp_set_debug_handler returning.
sp_get_port_by_name(/dev/cu.usbmodem14131, 0xc20801d5d8) called.
Building structure for port /dev/cu.usbmodem14131.
Getting serial port list.
Iterating over results.
Found port /dev/cu.usbmodem14131.
Found USB class device.
Found description Arduino Uno.
Found matching USB bus:address 010:007.
Found matching USB vid:pid 2341:0001.
Found manufacturer Arduino (www.arduino.cc).
Found product name Arduino Uno.
Found serial number 649383233313513141E1.
get_port_details returning SP_OK.
sp_get_port_by_name returning SP_OK.
sp_copy_port(0x4600020, 0xc208040190) called.
Copying port structure.
sp_get_port_by_name(/dev/cu.usbmodem14131, 0xc208040190) called.
Building structure for port /dev/cu.usbmodem14131.
Getting serial port list.
Iterating over results.
Found port /dev/cu.usbmodem14131.
Found USB class device.
Found description Arduino Uno.
Found matching USB bus:address 010:007.
Found matching USB vid:pid 2341:0001.
Found manufacturer Arduino (www.arduino.cc).
Found product name Arduino Uno.
Found serial number 649383233313513141E1.
get_port_details returning SP_OK.
sp_get_port_by_name returning SP_OK.
sp_copy_port returning 0.
sp_open(0x4600120, 0x1) called.
Opening port /dev/cu.usbmodem14131.
get_config(0x4600120, 0x7fff5fbff7b0, 0x7fff5fbff788) called.
Getting configuration for port /dev/cu.usbmodem14131.
get_config returning SP_OK.
set_config(0x4600120, 0x7fff5fbff7b0, 0x7fff5fbff788) called.
Setting configuration for port /dev/cu.usbmodem14131.
set_config returning SP_OK.
sp_open returning SP_OK.
sp_new_config(0xc2080401a0) called.
sp_new_config returning SP_OK.
sp_get_config(0x4600120, 0x4700000) called.
get_config(0x4600120, 0x7fff5fbff7b8, 0x4700000) called.
Getting configuration for port /dev/cu.usbmodem14131.
get_config returning SP_OK.
sp_get_config returning SP_OK.
sp_new_config(0xc20801d5d0) called.
sp_new_config returning SP_OK.
sp_set_config_bits(0x4700030, 8) called.
sp_set_config_bits returning SP_OK.
sp_set_config_stopbits(0x4700030, 1) called.
sp_set_config_stopbits returning SP_OK.
sp_set_config_parity(0x4700030, 2) called.
sp_set_config_parity returning SP_OK.
sp_set_config_flowcontrol returning SP_OK.
sp_set_config(0x4600120, 0x4700030) called.
get_config(0x4600120, 0x7fff5fbff7b8, 0x7fff5fbff790) called.
Getting configuration for port /dev/cu.usbmodem14131.
get_config returning SP_OK.
set_config(0x4600120, 0x7fff5fbff7b8, 0x4700030) called.
Setting configuration for port /dev/cu.usbmodem14131.
set_config returning SP_ERR_SUPP: RTS & CTS flow control must be disabled together.
sp_set_config returning SP_ERR_SUPP.
sp_free_config(0x4700030) called.
sp_free_config returning.
sp_close(0x4600120) called.
Closing port /dev/cu.usbmodem14131.
sp_close returning SP_OK.
The requested operation is not supported by this system or device

My goal is to 1) be able to use 9600 8E1 instead of 8N1 (this go program is a simulator for a real world device that's hard to access, and only speak 8E1), and 2) Ideally completely turn off flow control in an effort to stop the Arduino auto-reboot on connect (less important). I took a look at serial.c but couldn't quite figure out how it'd get into that state, since I think it should be using no flow control at all by default.

mikepb commented 9 years ago

Have you tried giving it an absolute path?

port, err := options.Open("/dev/cu.usbmodem14131")
jimbojsb commented 9 years ago

Sorry, yeah, It does have one. I messed that up when transcribing the example (actual path comes from a command line argument)

mikepb commented 9 years ago

I haven't used this library in a while. I remember that it has issues with emulated devices from our last conversation (see closed issues). The underlying library has probably been updated since then.

Would you have the time to update libserialport? To get it to build with cgo I also added preprocessor directives on platform-dependent code.

On Jul 9, 2015, at 11:07 AM, Josh Butts notifications@github.com wrote:

Sorry, yeah, It does have one. I messed that up when transcribing the example (actual path comes from a command line argument)

— Reply to this email directly or view it on GitHub.