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

Warnings when compiling on Raspberry Pi Zero W #35

Open
400lab opened this issue Apr 16, 2021 · 8 comments
Open

Warnings when compiling on Raspberry Pi Zero W #35

400lab opened this issue Apr 16, 2021 · 8 comments

Comments

@400lab
Copy link

400lab commented Apr 16, 2021

Hi! I've tried several times to compile ddserver on a Raspberry Pi Zero W and I get the following warnings (the software does not run at the end)

src/main.cpp: In function 'void startUdpListener()':
src/main.cpp:137:21: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'ssize_t' {aka 'int'} [-Wformat]
    syslog(LOG_INFO, "recv: %ld", bytes);
                     ^~~~~~~~~~~  ~~~~~
src/main.cpp: In function 'void joinGroup(int, char*)':
src/main.cpp:280:55: warning: comparison of integer expressions of different signedness: 'in_addr_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
  if ((groupStruct.sin_addr.s_addr = inet_addr(group)) == -1)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
src/main.cpp: In function 'void leaveGroup(int, char*)':
src/main.cpp:302:55: warning: comparison of integer expressions of different signedness: 'in_addr_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
  if ((groupStruct.sin_addr.s_addr = inet_addr(group)) == -1)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
src/main.cpp: In function 'void startUdpListener()':
src/main.cpp:145:12: warning: 'char* strncpy(char*, const char*, size_t)' output truncated before terminating nul copying 19 bytes from a string of the same length [-Wstringop-truncation]
     strncpy(buf, DD_SERVER, sizeof(DD_SERVER)-1);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/communicator.cpp:456:3: warning: "/*" within comment [-Wcomment]
   /*
    
In file included from src/communicator.cpp:8:
src/communicator.h: In constructor 'Communicator::Communicator()':
src/communicator.h:64:24: warning: 'Communicator::mHandle' will be initialized after [-Wreorder]
  libusb_device_handle *mHandle;
                        ^~~~~~~
src/communicator.h:63:17: warning:   'libusb_device* Communicator::mDevice' [-Wreorder]
  libusb_device *mDevice;
                 ^~~~~~~
src/communicator.cpp:10:1: warning:   when initialized here [-Wreorder]
 Communicator::Communicator() : mSocket(0), mCtx(nullptr), //mIsInitialized(false), mIsUsbInitialized(false),
 ^~~~~~~~~~~~
src/communicator.cpp:16:27: warning: 'void libusb_set_debug(libusb_context*, int)' is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations]
   libusb_set_debug(mCtx, 0); //set verbosity level to 3, as suggested in the documentation
                           ^
In file included from src/communicator.h:12,
                 from src/communicator.cpp:8:
/usr/include/libusb-1.0/libusb.h:1300:18: note: declared here
 void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
                  ^~~~~~~~~~~~~~~~
src/communicator.cpp:16:27: warning: 'void libusb_set_debug(libusb_context*, int)' is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations]
   libusb_set_debug(mCtx, 0); //set verbosity level to 3, as suggested in the documentation
                           ^
In file included from src/communicator.h:12,
                 from src/communicator.cpp:8:
/usr/include/libusb-1.0/libusb.h:1300:18: note: declared here
 void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
                  ^~~~~~~~~~~~~~~~
src/communicator.cpp: In member function 'bool Communicator::readFromClient()':
src/communicator.cpp:110:9: warning: comparison of integer expressions of different signedness: 'ssize_t' {aka 'int'} and 'uint32_t' {aka 'unsigned int'} [-Wsign-compare]
   if (r == (packetSize - 4)) {
       ~~^~~~~~~~~~~~~~~~~~~
src/communicator.cpp:114:20: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'ssize_t' {aka 'int'} [-Wformat=]
    syslog(LOG_ERR, "Error reading packet : %ld", r);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~
src/communicator.cpp:119:19: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'ssize_t' {aka 'int'} [-Wformat=]
   syslog(LOG_ERR, "Error reading total packet size: %ld", r);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~
src/communicator.cpp: In member function 'bool Communicator::processUsbPacket(uint8_t*, int)':
src/communicator.cpp:279:16: warning: comparison of integer expressions of different signedness: 'int' and '__uint32_t' {aka 'unsigned int'} [-Wsign-compare]
     if (writen != le32toh(header->packet_len))
                ^
src/communicator.cpp: In member function 'uint8_t* Communicator::readUsbPacket(int&, bool, unsigned int)':
src/communicator.cpp:352:38: warning: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'unsigned in'} [-Wsign-compare]
  while(packetSize1 == 0 || totalRead < packetSize1) {
                            ~~~~~~~~~~^~~~~~~~~~~~~
src/communicator.cpp:366:33: warning: comparison of integer expressions of different signedness: 'uint32_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
                 if (packetSize1 > currentPacketSize - 4) {
                     ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
src/communicator.cpp:382:35: warning: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'unsigned in'} [-Wsign-compare]
             if (currentPacketSize < 4 + packetSize1 + 128) {
                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
src/communicator.cpp:389:49: warning: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'unsigned in'} [-Wsign-compare]
             while(packetSize2 == 0 || totalRead < packetSize2) {
                                       ~~~~~~~~~~^~~~~~~~~~~~~
src/communicator.cpp:347:27: warning: unused variable 'resume' [-Wunused-variable]
  bool isResponse = false, resume = true;
                           ^~~~~~
src/communicator.cpp: In member function 'void Communicator::sendUsbDeviceList(uint32_t)':
src/communicator.cpp:856:20: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'std::vector<ImagingUsbDevice>::size_type' {aka 'unsigned int'} [-Wformat=]
   syslog(LOG_INFO, "Imaging USB devices found: %lu", imgUsbDevices.size());
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~
@hubaiz
Copy link
Owner

hubaiz commented Apr 16, 2021

If you only get warnings then it should compile. Is there a ddserver file in the build folder? What command did you use to compile?

@400lab
Copy link
Author

400lab commented Apr 16, 2021

Thank you for the very fast reply.

The command used to compile is the standard
g++ -Wall src/main.cpp src/communicator.cpp `pkg-config --libs --cflags libusb-1.0` -lpthread -lrt -lstdc++ -o ddserver

The compiling runs with these Warnings for about 10 seconds and then stops.

At the end I get a ddserver file in the folder and then I make it executable with
chmod +x ddserver

But in the end when I launch it nothing happens
./ddserver

Searching online I have seen other Raspberry users with these warning not being able to run the software in the end.

@hubaiz
Copy link
Owner

hubaiz commented Apr 16, 2021

Not sure what you mean with nothing happens. ddserver is only a small proxy application that will forward the PTP USB messages over the network between qDslrDashboard and the connected USB camera.

@400lab
Copy link
Author

400lab commented Apr 16, 2021

It does not give a feedback in terminal interface for the server running in the Raspberry?

Having hit return after ./ddserver it just "hangs" and it does not return to bash prompt.

@hubaiz
Copy link
Owner

hubaiz commented Apr 16, 2021

Why would return bash prompt when it is running? It purpose is to run. You can add it to your startup script.

@400lab
Copy link
Author

400lab commented Apr 16, 2021

Thank you again for your patience. I went ahead despite the warnings and from a subsequent check it seems that the service is active.

pi@raspberrypi:~ $ systemctl status ddserver.service
● ddserver.service - ddserver for qdslrDashboard
   Loaded: loaded (/etc/systemd/system/ddserver.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-04-16 17:09:41 CEST; 2min 16s ago
 Main PID: 325 (ddserver)
    Tasks: 2 (limit: 877)
   CGroup: /system.slice/ddserver.service
           └─325 /usr/local/bin/ddserver &

Apr 16 17:09:41 raspberrypi systemd[1]: Started ddserver for qdslrDashboard.
Apr 16 17:09:42 raspberrypi ddserver[325]: DslrDashboardServer starting
Apr 16 17:09:42 raspberrypi ddserver[325]: Starting socket server on port 4757
Apr 16 17:09:42 raspberrypi ddserver[325]: Awaiting client connection
Apr 16 17:09:42 raspberrypi ddserver[325]: Starting UDP listener
Apr 16 17:09:42 raspberrypi ddserver[325]: join multicast group: 224.1.2.3
Apr 16 17:09:42 raspberrypi ddserver[325]: error in joining multicast group -1
pi@raspberrypi:~ $ systemctl status ddserver.service
● ddserver.service - ddserver for qdslrDashboard
   Loaded: loaded (/etc/systemd/system/ddserver.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-04-16 17:09:41 CEST; 3min 5s ago
 Main PID: 325 (ddserver)
    Tasks: 2 (limit: 877)
   CGroup: /system.slice/ddserver.service
           └─325 /usr/local/bin/ddserver &

Apr 16 17:12:31 raspberrypi ddserver[325]: Incoming client connection
Apr 16 17:12:31 raspberrypi ddserver[325]: Awaiting client connection
Apr 16 17:12:31 raspberrypi ddserver[325]: USB Devices in
Apr 16 17:12:31 raspberrypi ddserver[325]: Number of possible configurations: 1 Device Class: 9 VendorID: 7531, ProductID: 2
Apr 16 17:12:31 raspberrypi ddserver[325]: Number of alternate settings:
Apr 16 17:12:31 raspberrypi ddserver[325]: Interface class: 9 Interface number: 0 Number of endpoints: 1
Apr 16 17:12:31 raspberrypi ddserver[325]: Imaging USB devices found: 0
Apr 16 17:12:31 raspberrypi ddserver[325]: Error reading total packet size: 0
Apr 16 17:12:31 raspberrypi ddserver[325]: Stoping client
Apr 16 17:12:33 raspberrypi ddserver[325]: Closing USB device

I am still not able to connect the camera even if I use the same cable that works on another system with qDslrDashboard, but I think this is another issue I will try to solve.

@hubaiz
Copy link
Owner

hubaiz commented Apr 16, 2021

Check that your OS isn't automatically mounting the camera SD card, as then it will be not available for ddserver.

@websocketing
Copy link

@hubaiz What's your email address? In addition, I want to know whether the client can be open source?

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