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

Not working on Monterey #4

Closed
mauriciofarina opened this issue Oct 27, 2021 · 17 comments
Closed

Not working on Monterey #4

mauriciofarina opened this issue Oct 27, 2021 · 17 comments

Comments

@mauriciofarina
Copy link

Hello!

After upgrading my Mac to Monterey I lost access to my device. When Running the Python Example I receive the error:
Error: (0, b'The driver is not loaded')

The Mac still recognizes the PCAN-USB device and shows it on system report menu

PCAN-USB:

  Product ID:	0x000c
  Vendor ID:	0x0c72
  Version:	54.ff
  Speed:	Up to 12 Mb/s
  Manufacturer:	PEAK-System Technik GmbH
  Location ID:	0x14222000 / 9
  Current Available (mA):	500
  Current Required (mA):	200
  Extra Operating Current (mA):	0

I tried searching on how to reload Mac drivers and things like that, but I have no experience on Mac drivers, kernel....

@mauriciofarina
Copy link
Author

An update,

I got able to access the device by compiling your PCBUSB-Wrapper and running the can_moni application. However, the Python example in this repository doesn't work either.

Running the can_recv.py example I get:

CAN API V3 for generic CAN Interfaces (Python Wrapper 0.1.1)
>>> can = CANAPI(libUVCANPCB.dylib)
>>> can.init(81, 0x00)
+++ error: can.init returned -202

I think the problem might be related to the libUVCANPCB.dylib/libPCBUSB.dylib dll

@mac-can
Copy link
Owner

mac-can commented Oct 28, 2021

First, there is no Kernel driver for the PCAN USB interfaces. USB is part of the OS and the access to the CAN device is build upon the USB URBs in user space.

That the CLI tool can_moni is running on Monterey is good. It means that the “driver” implementation is still compatible with the news version of Apple´s mostest advanced operation system.

can_moni does not depend on the PCBUSB library. The “driver” sources are built in. In this sense, it is a driverless CAN application. Your issue then seems to be an installation problem.
Can you please check if
• the symbolic link libPCBUSB.dylib is located in the folder /usr/local/lib and
• it points to the dynamic library libPCBUSB.0.10.dylib (in the same folder)
• that the permissions -rw-r-r-x are set correctly and
• the folder /usr/local/lib is in the library search path
When all these conditions are fulfilled, please check the security setting on your Mac.

@mauriciofarina
Copy link
Author

I checked the files in /usr/local/lib and it all seems ok

-rwxr-xr-x@  1 mauricio  admin  151496 Oct 27 16:35 libPCBUSB.0.10.dylib
lrwxr-xr-x   1 root      admin      35 Oct 27 16:35 libPCBUSB.dylib -> /usr/local/lib/libPCBUSB.0.10.dylib

About the last item, the PCANBasic.py searches the library this way:

self.__m_dllBasic = cdll.LoadLibrary("libPCBUSB.dylib")

Not sure if that's what you're asking for...

Regarding the security settings, I couldn't find any thing relevant under the Security & Privacy menu.. What do you suggest checking?

@mrbell321
Copy link

I'm facing basically exactly the same issue:
Monterrey, permissions are correct. cddl.LoadLibrary loads correctly, but unable to initialize the connection w/ the report of "NODRIVER"

@mac-can
Copy link
Owner

mac-can commented Nov 3, 2021

Hey guys,
can you try to compile and run the PCBUSB Monitor App. It also loads the PCBUSB dylib at run-time.
Just to make sure it is not a Python issue on Monterey.

@mauriciofarina
Copy link
Author

I also thought this could be the issue. However, I tried installing anaconda and running with different python releases and the problem persisted. So I don't think this is the problem...
Anyway, I'll try the Monitor App and I'll let you know

@mac-can
Copy link
Owner

mac-can commented Nov 3, 2021

@mauriciofarina A while ago I´ve patched the PCANBasic.py from Peak-System after I ran into problems with Python 2.7 on macOS (10.13 and 11.x). Maybe you can try out this patch: PCANBasic.zip
See also my Gist macOS Library for PCAN-USB Interfaces: Python Example

@mauriciofarina
Copy link
Author

@mac-can I tried using the patch you provided and compiling the PCBUSB Monitor App (V0.3) and, in both cases, the problem persists.

The error is always the same (No driver Loaded)...

Here's a screenshot of the Monitor App Screen and Xcode Logs:
Screen Shot 2021-11-06 at 12 57 09

@mac-can
Copy link
Owner

mac-can commented Nov 10, 2021

hmm, ...

The library is compiled with the old Eclipse build environment; no target system is set, so it still runs under macOS 10.x.
Maybe that this is denied by macOS 12.x and reveals the error message.

A preliminary version of the PCBUSB dylib compiled as Universal macOS Binary can be downloaded here:
https://www.uv-software.de/dokuwiki/doku.php?id=uvs:programs:pcbusb_library
It should run on Intel and ARM architectures, but it is not tested on arm64.
And a colleague has confirmed that it is running on Monterey.

Happy CANgineering.

@mauriciofarina
Copy link
Author

Hello @mac-can !

Just tried the preliminary version and it work perfectly!

Thank you for the help!

@taraskarpuk
Copy link

taraskarpuk commented Feb 7, 2022

python3 pcbusb_recv.py
Error: (0, b'The driver is not loaded')
Same Issue on Monterey :(

Well, seems it work once ...

ls -la /usr/local/lib/libPC*
-rwxr-xr-x@ 1 flow admin 151496 May 6 2021 /usr/local/lib/libPCBUSB.0.10.dylib
-rwxr-xr-x@ 1 flow admin 401616 Feb 7 12:57 /usr/local/lib/libPCBUSB.0.11.dylib
lrwxr-xr-x 1 flow admin 35 Feb 7 12:57 /usr/local/lib/libPCBUSB.dylib -> /usr/local/lib/libPCBUSB.0.11.dylib

Tried different versions ... and nothing. Intel x64 platform

@mauriciofarina
Copy link
Author

@taraskarpuk

Did you tried this?

hmm, ...

The library is compiled with the old Eclipse build environment; no target system is set, so it still runs under macOS 10.x. Maybe that this is denied by macOS 12.x and reveals the error message.

A preliminary version of the PCBUSB dylib compiled as Universal macOS Binary can be downloaded here: https://www.uv-software.de/dokuwiki/doku.php?id=uvs:programs:pcbusb_library It should run on Intel and ARM architectures, but it is not tested on arm64. And a colleague has confirmed that it is running on Monterey.

Happy CANgineering.

@taraskarpuk
Copy link

@mauriciofarina What does preliminary version mean? i have tried 0.11 version

@mauriciofarina
Copy link
Author

@taraskarpuk the preliminary version is the OS_X_Library_for_PCANUSB_v0.10.ub.tar file. Try using it and see if it works for you. That was the solution for me!

@taraskarpuk
Copy link

Ok! Now it's working with "MacCan Monitor"... But i use python-can library... And seems i have problem with sending messages. Transmits only ID and DLC=0 and No data transmitted

@taraskarpuk
Copy link

hardbyte/python-can#1117

@mac-can
Copy link
Owner

mac-can commented Feb 13, 2022

Hi all,
I saw that you have already solved the issue. Nevertheless, for root causing of issues related to installing or using libPCBUSB.dylib on macOS Monterey (12.x) and/or Apple Silicon (M1 chip) I´ve created a trouble shooting guide and published it as a Gist.
Uwe

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

No branches or pull requests

4 participants