FICS / atcmd

Android AT command scripts and firmware extraction
https://atcommands.org
336 stars 90 forks source link

Unable to compile #4

Closed CreativeWolf closed 6 years ago

CreativeWolf commented 6 years ago

Heya,

While trying to compile these are the error message I'm getting

gcc usbswitcher.c -o usbswitcher -lusb

usbswitcher.c: In function ‘find_device’: usbswitcher.c:64:12: error: ‘usb_busses’ undeclared (first use in this function) for (bus=usb_busses; bus != NULL; bus=bus->next) { ^ usbswitcher.c:64:12: note: each undeclared identifier is reported only once for each function it appears in usbswitcher.c:64:44: error: dereferencing pointer to incomplete type ‘struct usb_bus’ for (bus=usb_busses; bus != NULL; bus=bus->next) { ^ usbswitcher.c:65:40: error: dereferencing pointer to incomplete type ‘struct usb_device’ for (dev=bus->devices; dev; dev=dev->next) { ^ usbswitcher.c: In function ‘main’: usbswitcher.c:82:3: error: unknown type name ‘usb_dev_handle’ usb_dev_handle *udev; ^ usbswitcher.c:113:3: warning: implicit declaration of function ‘usb_init’ [-Wimplicit-function-declaration] usb_init(); ^ usbswitcher.c:114:3: warning: implicit declaration of function ‘usb_find_busses’ [-Wimplicit-function-declaration] usb_find_busses(); ^ usbswitcher.c:115:3: warning: implicit declaration of function ‘usb_find_devices’ [-Wimplicit-function-declaration] usb_find_devices(); ^ usbswitcher.c:129:10: warning: implicit declaration of function ‘usb_open’ [-Wimplicit-function-declaration] udev = usb_open(dev); ^ usbswitcher.c:129:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion] udev = usb_open(dev); ^ usbswitcher.c:136:3: warning: implicit declaration of function ‘usb_reset’ [-Wimplicit-function-declaration] usb_reset(udev); ^ usbswitcher.c:138:7: warning: implicit declaration of function ‘usb_set_configuration’ [-Wimplicit-function-declaration] r = usb_set_configuration(udev, 2); ^ usbswitcher.c:144:5: warning: implicit declaration of function ‘usb_close’ [-Wimplicit-function-declaration] usb_close(udev); ^

dpkg -L libusb-1.0-0-dev | grep .h$

returns

/usr/include/libusb-1.0/libusb.h

So had to change the from #include "usb.h" to #include "libusb-1.0/libusb.h"

Please let me know if there's a workaround for this.

Thanks

grant-h commented 6 years ago

That'd be because it's relying on the super old, depreciated libusb version (pre 1.0). On Debian systems this can be fixed with apt-get install libusb-dev.

CreativeWolf commented 6 years ago

That worked, thanks! :smiley: