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

invalid conversion from 'int' to 'libusb_hotplug_flag' #16

Open
JesseMFrey opened this issue Mar 28, 2021 · 18 comments
Open

invalid conversion from 'int' to 'libusb_hotplug_flag' #16

JesseMFrey opened this issue Mar 28, 2021 · 18 comments

Comments

@JesseMFrey
Copy link

I get the following error when I try to compile aasdk:
In file included from /home/alarm/pkgbuilds/aasdk-git/src/aasdk-dash-git/include/aasdk/USB/IUSBWrapper.hpp:24, from /home/alarm/pkgbuilds/aasdk-git/src/aasdk-dash-git/src/USB/USBHub.cpp:20: /home/alarm/pkgbuilds/aasdk-git/src/aasdk-dash-git/src/USB/USBHub.cpp: In lambda function: /home/alarm/pkgbuilds/aasdk-git/src/aasdk-dash-git/src/USB/USBHub.cpp:52:103: error: invalid conversion from 'int' to 'libusb_hotplug_flag' [-fpermissive] 52 | hotplugHandle_ = usbWrapper_.hotplugRegisterCallback(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, LIBUSB_HOTPLUG_NO_FLAGS, LIBUSB_HOTPLUG_MATCH_ANY, LIBUSB_HOTPLUG_MATCH_ANY, | ^~~~~~~~~~~~~~~~~~~~~~~ | | | int In file included from /home/alarm/pkgbuilds/aasdk-git/src/aasdk-dash-git/src/USB/USBHub.cpp:20: /home/alarm/pkgbuilds/aasdk-git/src/aasdk-dash-git/include/aasdk/USB/IUSBWrapper.hpp:75:108: note: initializing argument 2 of 'virtual aasdk::usb::HotplugCallbackHandle aasdk::usb::IUSBWrapper::hotplugRegisterCallback(libusb_hotplug_event, libusb_hotplug_flag, int, int, int, libusb_hotplug_callback_fn, void*)' 75 | virtual HotplugCallbackHandle hotplugRegisterCallback(libusb_hotplug_event events, libusb_hotplug_flag flags, int vendor_id, int product_id, int dev_class, | ~~~~~~~~~~~~~~~~~~~~^~~~~ make[2]: *** [CMakeFiles/aasdk.dir/build.make:678: CMakeFiles/aasdk.dir/src/USB/USBHub.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/aasdk.dir/all] Error 2 make: *** [Makefile:136: all] Error 2
I have libusb version 1.0.24

@robert5974
Copy link

Did you try the install.sh script or are you manually building?

@JesseMFrey
Copy link
Author

Manually building

@robert5974
Copy link

robert5974 commented Mar 30, 2021

I'd recommend the install script. You might be missing a package that is needed. You could even look at the packages the install script installs. The install script is in the dash directory after you clone that repo. The install script will build aasdk, Openauto, qt-gstreamer, and dash.

What hardware and OS are you using?

@JesseMFrey
Copy link
Author

The install script uses apt (I think) and this, doesn't work
I'm using arch on a pi4

@robert5974
Copy link

Yeah, we haven't had any support for another OS outside of RPi OS and Ubuntu (debian based). I think I might be the only one to try Ubuntu 64bit 20.10 on the Pi4 with OpenDash. I got everything installed but I had to find a few packages that had different names due to those packages having a 64bit variant.

You should check your libusb version against the package in debian based OS and see if what Arch has is the same or newer. I've never used Arch so I couldn't tell you without diving into it. Let us know what you find.

Also, everything for dash is written to not require running as root. Only exception is when installing aasdk and Openauto to /usr/local directory with "sudo make install". If built using root, there can be issues when connecting your device for Openauto functionality.

@JesseMFrey
Copy link
Author

JesseMFrey commented Mar 30, 2021

Like I said in the first post, I have libusb version 1.0.24. Not sure what version other distros are using but, Arch often adopts new things first.

I did get it to work with the following patch, just casting to libusb_hotplug_flag (not sure this is the "right way" but, it works)

diff --git a/src/USB/USBHub.cpp b/src/USB/USBHub.cpp
index cc302d9..7898d48 100644
--- a/src/USB/USBHub.cpp
+++ b/src/USB/USBHub.cpp
@@ -49,7 +49,7 @@ void USBHub::start(Promise::Pointer promise)
         if(self_ == nullptr)
         {
             self_ = this->shared_from_this();
-            hotplugHandle_ = usbWrapper_.hotplugRegisterCallback(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, LIBUSB_HOTPLUG_NO_FLAGS, LIBUSB_HOTPLUG_MATCH_ANY, LIBUSB_HOTPLUG_MATCH_ANY,
+            hotplugHandle_ = usbWrapper_.hotplugRegisterCallback(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, (libusb_hotplug_flag)LIBUSB_HOTPLUG_NO_FLAGS, LIBUSB_HOTPLUG_MATCH_ANY, LIBUSB_HOTPLUG_MATCH_ANY,
                                                                  LIBUSB_HOTPLUG_MATCH_ANY, reinterpret_cast<libusb_hotplug_callback_fn>(&USBHub::hotplugEventsHandler), reinterpret_cast<void*>(this));
         }
     });

installing things has not been a huge problem. The Arch scripts install things to a temp directory as fakeroot and then it's installed to / with the package manager.

@robert5974
Copy link

Nice. It'll be good to document how to get it working on other distros. Hope everything else goes smooth. When you get to qt-gstreamer, perhaps Arch has it already for installation like Ubuntu. Instead of having to build it manually for the Pi.

@JesseMFrey
Copy link
Author

JesseMFrey commented Mar 30, 2021

I ended up building dash with:

cmake -DCMAKE_BUILD_TYPE=Release ../ -DRPI_BUILD=FALSE -DGST_BUILD=TRUE

arch does have a qt-gstreamer package

@robert5974
Copy link

So you had to build qt-gstreamer then? Was that as intended or did you have to make adjustments?

Are you using an official Raspberry Pi 7" touchscreen? If so, make sure you create the udev rules for the backlight.

@JesseMFrey
Copy link
Author

It was missing libraries without -DGST_BUILD=TRUE it would complain about some includes

Not sure if I made some rules previously or added myself to the right group but, brightness works

@robert5974
Copy link

Awesome yeah that makes sense. Probably that you are in the right group.

Just curious, Are you using 32bit or 64bit Arch?

@JesseMFrey
Copy link
Author

I'm using the 32 bit arch linux

@stefan-sherwood
Copy link

FWIW, in order to get the build to work on WSL I had to change apt to apt-get. I don't know of any reason why that can't be done across the board.

@robert5974
Copy link

@JesseMFrey how's the build running for you on Arch?

@JesseMFrey
Copy link
Author

I haven't tried but, switching from apt to apt-get shouldn't help because Arch uses pacman

@stefan-sherwood
Copy link

Should be easy enough to conditionalize the script for Arch and pacman

@JesseMFrey
Copy link
Author

JesseMFrey commented May 5, 2021

I suppose that's possible. I guess I'd rather have an actual package built with dependencies

@stefan-sherwood
Copy link

Not sure I understand. This project doesn't have a prebuilt images so you have to build it yourself by running the install script.

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

3 participants