diff --git a/tools/Makefile.common b/tools/Makefile.common index 5ee770c..20552e9 100644 --- a/tools/Makefile.common +++ b/tools/Makefile.common @@ -27,5 +27,6 @@ LDLIBS_ben = MACROS_host = -DHAVE_USB MACROS_ben = -DHAVE_USD +CC = $(CC_$(TARGET)) CFLAGS += -I../../atrf/fw/include -I../include $(MACROS_$(TARGET)) LDLIBS = $(LDLIBS_$(TARGET)) -L../lib -latspi diff --git a/tools/atspi-id/atspi-id.c b/tools/atspi-id/atspi-id.c index d7397d0..e7e9520 100644 --- a/tools/atspi-id/atspi-id.c +++ b/tools/atspi-id/atspi-id.c @@ -13,19 +13,23 @@ #include #include + +#ifdef HAVE_USB #include +#endif #include "at86rf230.h" #include "atspi/ep0.h" #include "atspi.h" +#ifdef HAVE_USB + #define FROM_DEV ATSPI_FROM_DEV(0) #define BUF_SIZE 256 - static int get_id(usb_dev_handle *dev, void *data, int size) { int res; @@ -67,13 +71,19 @@ static int get_build(usb_dev_handle *dev, char *buf, size_t size) } -static void show_usb_info(usb_dev_handle *dev) +static void show_usb_info(struct atspi_dsc *dsc) { - const struct usb_device *device = usb_device(dev); + usb_dev_handle *dev; + const struct usb_device *device; uint8_t major, minor, target; char buf[BUF_SIZE+1]; /* +1 for terminating \0 */ int len; + dev = atspi_usb_handle(dsc); + if (!dev) + return; + device = usb_device(dev); + printf("%04x:%04x ", device->descriptor.idVendor, device->descriptor.idProduct); @@ -89,14 +99,22 @@ static void show_usb_info(usb_dev_handle *dev) } +#else /* HAVE_USB */ + + +static void show_usb_info(struct atspi_dsc *dsc) +{ +} + + +#endif /* !HAVE_USB */ + + static void show_info(struct atspi_dsc *dsc) { - usb_dev_handle *dev; uint8_t part, version, man_id_0, man_id_1; - dev = atspi_usb_handle(dsc); - if (dev) - show_usb_info(dev); + show_usb_info(dsc); part = atspi_reg_read(dsc, REG_PART_NUM); version = atspi_reg_read(dsc, REG_VERSION_NUM); diff --git a/tools/lib/Makefile b/tools/lib/Makefile index 33849e1..a39d44b 100644 --- a/tools/lib/Makefile +++ b/tools/lib/Makefile @@ -16,9 +16,9 @@ LIB = libatspi.a include ../Makefile.common CFLAGS += -Wall -I$(F32XBASE)/include -OBJS_host = atusb.o +OBJS_host = atusb.o $(F32XBASE)/lib/usb.o OBJS_ben = atusd.o -OBJS = $(F32XBASE)/lib/usb.o atspi.o $(OBJS_$(TARGET)) +OBJS = atspi.o $(OBJS_$(TARGET)) .PHONY: all clean spotless @@ -28,7 +28,7 @@ $(LIB): $(OBJS) $(AR) cr $@ $^ clean: - rm -f $(OBJS) + rm -f $(OBJS) $(OBJS_ben) $(OBJS_host) spotless: clean rm -f $(LIB)