Merge tag 'v1.0.25' into tizen 42/281242/1 accepted/tizen/unified/20230105.154718
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Wed, 14 Sep 2022 22:52:14 +0000 (00:52 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Wed, 14 Sep 2022 22:52:14 +0000 (00:52 +0200)
Change-Id: I3d3326f530535ae89b190a0911f4f1a1bd3df7ef

1  2 
configure.ac
libusb/Makefile.am
libusb/os/linux_usbfs.c
packaging/libusb.spec

diff --cc configure.ac
Simple merge
@@@ -82,11 -82,7 +82,11 @@@ endi
  
  libusb_1_0_la_LDFLAGS = $(LT_LDFLAGS)
  libusb_1_0_la_SOURCES = libusbi.h version.h version_nano.h \
-       core.c descriptor.c hotplug.h hotplug.c io.c strerror.c sync.c \
+       core.c descriptor.c hotplug.c io.c strerror.c sync.c \
        $(PLATFORM_SRC) $(OS_SRC)
  
 +if USE_USBHOST_API
 +libusb_1_0_la_CFLAGS = $(USBHOST_API_CFLAGS)
 +libusb_1_0_la_LIBADD = $(USBHOST_API_LIBS)
 +endif
  pkginclude_HEADERS = libusb.h
@@@ -174,11 -165,34 +170,26 @@@ struct linux_transfer_priv 
        int iso_packet_offset;
  };
  
 -static int get_usbfs_fd(struct libusb_device *dev, mode_t mode, int silent)
+ static int dev_has_config0(struct libusb_device *dev)
+ {
+       struct linux_device_priv *priv = usbi_get_device_priv(dev);
+       struct config_descriptor *config;
+       uint8_t idx;
+       for (idx = 0; idx < dev->device_descriptor.bNumConfigurations; idx++) {
+               config = &priv->config_descriptors[idx];
+               if (config->desc->bConfigurationValue == 0)
+                       return 1;
+       }
+       return 0;
+ }
 +static int _direct_open_device(struct libusb_context *ctx, const char *path,
 +                             mode_t mode, int silent)
  {
 -      struct libusb_context *ctx = DEVICE_CTX(dev);
 -      char path[24];
        int fd;
  
 -      if (usbdev_names)
 -              sprintf(path, USBDEV_PATH "/usbdev%u.%u",
 -                      dev->bus_number, dev->device_address);
 -      else
 -              sprintf(path, USB_DEVTMPFS_PATH "/%03u/%03u",
 -                      dev->bus_number, dev->device_address);
 -
        fd = open(path, mode | O_CLOEXEC);
        if (fd != -1)
                return fd; /* Success */
index dc2e6bc,0000000..bf2b9fa
mode 100755,000000..100755
--- /dev/null
@@@ -1,70 -1,0 +1,70 @@@
- Version:        1.0.24
 +%define TIZEN_FEATURE_USBHOST_API on
 +
 +Name:           libusb
++Version:        1.0.25
 +Release:        0
 +License:        LGPL-2.1+, MIT
 +Summary:        USB Library
 +Url:            http://www.libusb.org/
 +Group:          Base/Device Management
 +Source:         %{name}-%{version}.tar.bz2
 +Source1:        baselibs.conf
 +Source1001:   libusb.manifest
 +BuildRequires:  pkg-config
 +BuildRequires:  systemd-devel
 +%if %{?TIZEN_FEATURE_USBHOST_API} == on
 +BuildRequires:  pkgconfig(dbus-1)
 +%endif
 +
 +%description
 +Libusb is a library that allows userspace access to USB devices.
 +
 +%package devel
 +Summary:        USB Library
 +Group:          Development/Libraries
 +Requires:       glibc-devel
 +Requires:       libusb = %{version}
 +
 +%description devel
 +Libusb is a library that allows userspace access to USB devices.
 +
 +%prep
 +%setup -q
 +cp %{SOURCE1001} .
 +
 +%build
 +%reconfigure\
 +      --with-pic\
 +%if %{?TIZEN_FEATURE_USBHOST_API} == on
 +      --enable-usbhost-api \
 +%endif
 +      --disable-static
 +make %{?_smp_mflags}
 +
 +%install
 +%make_install
 +# usbhost_module
 +mkdir -p %{buildroot}%{_prefix}/lib/udev/rules.d
 +install -m 644 udev/99-usbhost.rules %{buildroot}%{_prefix}/lib/udev/rules.d/99-usbhost.rules
 +
 +%post  -p /sbin/ldconfig
 +
 +%postun  -p /sbin/ldconfig
 +
 +%files
 +%manifest %{name}.manifest
 +%defattr(-,root,root)
 +%license LICENSE.LGPL-2.1+ LICENSE.MIT
 +%{_libdir}/*.so.*
 +# usbhost_module
 +%{_prefix}/lib/udev/rules.d/99-usbhost.rules
 +
 +%files devel
 +%manifest %{name}.manifest
 +%defattr(-,root,root)
 +%license LICENSE.LGPL-2.1+ LICENSE.MIT
 +%{_includedir}/libusb-1.0
 +%{_libdir}/*.so
 +%{_libdir}/pkgconfig/*.pc
 +
 +%changelog