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

Unable to open the port on MAC #83

Open
SteMMo33 opened this issue Apr 5, 2024 · 9 comments
Open

Unable to open the port on MAC #83

SteMMo33 opened this issue Apr 5, 2024 · 9 comments

Comments

@SteMMo33
Copy link

SteMMo33 commented Apr 5, 2024

Describe the bug
I'm not able to open the serial port on MAC 12.7.4 and Qt.

From my code I get all the serial ports recalling the function QSerialPortInfo::availablePorts()
This call returns always couples of ports: example:

">> 'cu.Bluetooth-Incoming-Port' - loc: '/dev/cu.Bluetooth-Incoming-Port' - desc: ''"
">> 'tty.Bluetooth-Incoming-Port' - loc: '/dev/tty.Bluetooth-Incoming-Port' - desc: ''"
">> 'cu.usbmodem00000000001A1' - loc: '/dev/cu.usbmodem00000000001A1' - desc: 'VIOS118 ComPort'"
">> 'tty.usbmodem00000000001A1' - loc: '/dev/tty.usbmodem00000000001A1' - desc: 'VIOS118 ComPort'"

If I open a port I always have an error, regardless the selected port:

TerminalProt] Open '/dev/cu.usbmodem00000000001A1'
open port error: Unable to open : No such file or directory
[TerminalProt] Open ret: 0
[TerminalProt] Open '/dev/tty.usbmodem00000000001A1'
open port error: Unable to open : No such file or directory
TerminalProt] Open ret: 0

The code is very simply:

               std::cout << "[TerminalProt] Open '" << serial_port_parameters.PortName << "'" << std::endl;

		if (_serialPort.isOpen())
			_serialPort.close();
                _serialPort.setPortName(serial_port_parameters.PortName.c_str());
		bool ret = _serialPort.open();
		std::cout << "[TerminalProt] Open ret: " << ret << std::endl;

Please, any idea?
Thanks!

@itas109
Copy link
Owner

itas109 commented Apr 8, 2024

Could you test the example CommQT( or CommNoGui) of CSerialPort v4.3.1 ?
The example project at CSerialPort/examples/CommQT.
CommNoGui is console(no gui) example, and default output more debug info.

@SteMMo33
Copy link
Author

Hello, sorry for my delay.
This is the results of my tests.

-- Windows --
Everything is running ok.

-- MAC --
I need to apply a conditioned code:

#ifdef WIN32
		ui->cmbSeriali->addItem(Port.portName() + " - " + Port.description(), Port.portName());
#elif defined __APPLE__
		ui->cmbSeriali->addItem(Port.portName() + " - " + Port.description(), Port.systemLocation());
#endif

cause MAC uses systemLocation as 'device' name.
This is some of my debug info:

[TerminalProt] Open '/dev/cu.usbmodem00000000001A1'
[TerminalProt] ver: https://github.com/itas109/CSerialPort - V4.3.0.230215
[TerminalProt] Open ret: 0
[TerminalProt] Open err: 14
[dlThread] open '/dev/cu.usbmodem00000000001A1' - tpRet: 1
[dlThread] open failed
[dlThread] start @ Wed May 15 11:25:19 2024

[TerminalProt] Open '/dev/tty.usbmodem00000000001A1'
[TerminalProt] ver: https://github.com/itas109/CSerialPort - V4.3.0.230215
[TerminalProt] Open ret: 0
[TerminalProt] Open err: 14
[dlThread] open '/dev/tty.usbmodem00000000001A1' - tpRet: 1
[dlThread] open failed
[Updater] Close

and

2024-05-15 11:24:35.053898+0200 TestLibUpgrade[20501:291945] Sfoglia per log ..
2024-05-15 11:25:09.187749+0200 TestLibUpgrade[20501:291945] Click DownloadLog ..
2024-05-15 11:25:09.187791+0200 TestLibUpgrade[20501:291945] Click DownloadLog port:  "/dev/cu.usbmodem00000000001A1"
2024-05-15 11:25:09.188455+0200 TestLibUpgrade[20501:291945] start DownloadLog:  0
not support custom baudrate
uart set failed
2024-05-15 11:25:09.192322+0200 TestLibUpgrade[20501:292352] [logCallback] ERROR  5
2024-05-15 11:25:19.321363+0200 TestLibUpgrade[20501:291945] Click DownloadLog ..
2024-05-15 11:25:19.321403+0200 TestLibUpgrade[20501:291945] Click DownloadLog port:  "/dev/tty.usbmodem00000000001A1"
2024-05-15 11:25:19.321476+0200 TestLibUpgrade[20501:291945] start DownloadLog:  0
not support custom baudrate
uart set failed
2024-05-15 11:25:19.324640+0200 TestLibUpgrade[20501:292403] [logCallback] ERROR  5

Effectively I absolutely need a 'non standard' baud rate (1177): but under Windows I don't have this problem, is it a MAC problem??

Thanks

@itas109
Copy link
Owner

itas109 commented May 15, 2024

non standard baud rate only support windows and linux now.
I need some time to support it on macos.

@SteMMo33
Copy link
Author

ok itas109,
thanks.

Anyway, I'm using the package by vcpkg and right now there the version is one step behind.
(I don't know the dynamics for the deploy on vcpkg ...)
Thanks!

@itas109
Copy link
Owner

itas109 commented May 15, 2024

Mac OS X Tiger(10.4.11) support non-standard baud rate.

You could try the master code.

vcpkg get github master

vcpkg install cserialport --head

@SteMMo33
Copy link
Author

stefano@MacMiniNewdep vcpkg % vcpkg install cserialport --head
Computing installation plan...
The following packages are already installed:
    cserialport:x64-osx@4.3.0#1
cserialport:x64-osx is already installed
Total install time: 12.7 us

but it is not aligned with the version on GitHub (4.3.1)

@itas109
Copy link
Owner

itas109 commented May 16, 2024

try remove fisrt, then install --head

vcpkg remove cserialport
vcpkg install cserialport --head

@SteMMo33
Copy link
Author

Here I'm under Windows but again the installed version is 4.3.0#1

C:\Progetti\vcpkg>vcpkg remove cserialport
The following packages will be removed:
    cserialport:x64-windows
Removing 1/1 cserialport:x64-windows

C:\Progetti\vcpkg>
C:\Progetti\vcpkg>
C:\Progetti\vcpkg>vcpkg install cserialport --head
Computing installation plan...
The following packages will be built and installed:
    cserialport:x64-windows@4.3.0#1 (+HEAD)
Installing 1/1 cserialport:x64-windows@4.3.0#1...
Building cserialport:x64-windows@4.3.0#1 from HEAD...
-- Downloading https://api.github.com/repos/itas109/CSerialPort/git/refs/heads/master -> itas109-CSerialPort-master.version...
-- Downloading https://github.com/itas109/CSerialPort/archive/7e6d9df9130376b463a5e0f22c687f5b64934ece.tar.gz -> itas109-CSerialPort-7e6d9df9130376b463a5e0f22c687f5b64934ece.tar.gz...
-- Extracting source C:/Progetti/vcpkg/downloads/itas109-CSerialPort-7e6d9df9130376b463a5e0f22c687f5b64934ece.tar.gz
-- Using source at C:/Progetti/vcpkg/buildtrees/cserialport/src/head/5b64934ece-90153dc8ce.clean
-- Found external ninja('1.11.0').
-- Configuring x64-windows
-- Building x64-windows-dbg
-- Building x64-windows-rel
CMake Warning at scripts/cmake/vcpkg_copy_pdbs.cmake:44 (message):
  Could not find a matching pdb file for:

      C:/Progetti/vcpkg/packages/cserialport_x64-windows/bin/libcserialport.dll
      C:/Progetti/vcpkg/packages/cserialport_x64-windows/debug/bin/libcserialport.dll

Call Stack (most recent call first):
  ports/cserialport/portfile.cmake:17 (vcpkg_copy_pdbs)
  scripts/ports.cmake:175 (include)


-- Using cached msys2-mingw-w64-x86_64-pkgconf-1~2.2.0-1-any.pkg.tar.zst.
-- Using cached msys2-msys2-runtime-3.4.10-4-x86_64.pkg.tar.zst.
-- Using msys root at C:/Progetti/vcpkg/downloads/tools/msys2/d33df895d441a36d
-- Installing: C:/Progetti/vcpkg/packages/cserialport_x64-windows/share/cserialport/copyright
-- Performing post-build validation
Elapsed time to handle cserialport:x64-windows: 12 s
Total install time: 12 s

C:\Progetti\vcpkg>

@itas109
Copy link
Owner

itas109 commented May 17, 2024

4.3.0#1 (+HEAD) is already github master version.

Downloading https://api.github.com/repos/itas109/CSerialPort/git/refs/heads/master -> itas109-CSerialPort-master.version...

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

No branches or pull requests

2 participants