Discussion:
gphoto2 (PTP mode camera) no more working in -current
Alessandro DE LAURENZIS
2015-08-27 05:49:34 UTC
Permalink
Dear misc@ readers,

I have an old Canon camera (model "Digital IXUS 40"); it was perfectly
working in 5.7 through gphoto2 in PTP mode.

It doesn't work anymore in -current (5.8 GENERIC.MP#1267 amd64).

gphoto2 (well, I use gtkam actually) correctly detects it, but the
connection cannot be established. This is an excerpt of the debug
messages:

[....................snip....................]
ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG MESSAGES TO THE MAILING LIST:
gtkam 0.2.0
gtkam has been compiled with the following options:
+ cc (C compiler used)
+ no bonobo (for FIXME)
+ no gnome (for FIXME)
+ no gimp (plugin for The Gimp)
+ exif (for displaying exif information)
libgphoto2 2.5.8
libgphoto2 has been compiled with the following options:
+ all camlibs
+ cc (C compiler used)
+ ltdl (for portable loading of camlibs)
+ EXIF (for special handling of EXIF files)
libgphoto2_port 0.12.0
libgphoto2_port has been compiled with the following options:
+ cc (C compiler used)
+ ltdl (for portable loading of camlibs)
+ USB (libusb1, for USB cameras)
+ no serial (for serial cameras)
+ no resmgr (serial port access and locking)
+ no ttylock (serial port locking)
+ no lockdev (serial port locking)
Using ltdl to load camera libraries from '/usr/local/lib/libgphoto2/2.5.8'...
Found '/usr/local/lib/libgphoto2/2.5.8/adc65'.
Found '/usr/local/lib/libgphoto2/2.5.8/agfa_cl20'.
Found '/usr/local/lib/libgphoto2/2.5.8/aox'.
Found '/usr/local/lib/libgphoto2/2.5.8/ax203'.
Found '/usr/local/lib/libgphoto2/2.5.8/barbie'.
Found '/usr/local/lib/libgphoto2/2.5.8/canon'.
Found '/usr/local/lib/libgphoto2/2.5.8/casio_qv'.
Found '/usr/local/lib/libgphoto2/2.5.8/clicksmart310'.
Found '/usr/local/lib/libgphoto2/2.5.8/digigr8'.
Found '/usr/local/lib/libgphoto2/2.5.8/digita'.
Found '/usr/local/lib/libgphoto2/2.5.8/dimagev'.
Found '/usr/local/lib/libgphoto2/2.5.8/dimera3500'.
Found '/usr/local/lib/libgphoto2/2.5.8/directory'.
Found '/usr/local/lib/libgphoto2/2.5.8/enigma13'.
Found '/usr/local/lib/libgphoto2/2.5.8/fuji'.
Found '/usr/local/lib/libgphoto2/2.5.8/gsmart300'.
Found '/usr/local/lib/libgphoto2/2.5.8/hp215'.
Found '/usr/local/lib/libgphoto2/2.5.8/iclick'.
Found '/usr/local/lib/libgphoto2/2.5.8/jamcam'.
Found '/usr/local/lib/libgphoto2/2.5.8/jd11'.
Found '/usr/local/lib/libgphoto2/2.5.8/jl2005a'.
Found '/usr/local/lib/libgphoto2/2.5.8/jl2005c'.
Found '/usr/local/lib/libgphoto2/2.5.8/kodak_dc120'.
Found '/usr/local/lib/libgphoto2/2.5.8/kodak_dc210'.
Found '/usr/local/lib/libgphoto2/2.5.8/kodak_dc240'.
Found '/usr/local/lib/libgphoto2/2.5.8/kodak_dc3200'.
Found '/usr/local/lib/libgphoto2/2.5.8/kodak_ez200'.
Found '/usr/local/lib/libgphoto2/2.5.8/konica'.
Found '/usr/local/lib/libgphoto2/2.5.8/konica_qm150'.
Found '/usr/local/lib/libgphoto2/2.5.8/largan'.
Found '/usr/local/lib/libgphoto2/2.5.8/lg_gsm'.
Found '/usr/local/lib/libgphoto2/2.5.8/mars'.
Found '/usr/local/lib/libgphoto2/2.5.8/mustek'.
Found '/usr/local/lib/libgphoto2/2.5.8/panasonic_coolshot'.
Found '/usr/local/lib/libgphoto2/2.5.8/panasonic_dc1000'.
Found '/usr/local/lib/libgphoto2/2.5.8/panasonic_dc1580'.
Found '/usr/local/lib/libgphoto2/2.5.8/panasonic_l859'.
Found '/usr/local/lib/libgphoto2/2.5.8/pccam300'.
Found '/usr/local/lib/libgphoto2/2.5.8/pccam600'.
Found '/usr/local/lib/libgphoto2/2.5.8/pentax'.
Found '/usr/local/lib/libgphoto2/2.5.8/polaroid_pdc320'.
Found '/usr/local/lib/libgphoto2/2.5.8/polaroid_pdc640'.
Found '/usr/local/lib/libgphoto2/2.5.8/polaroid_pdc700'.
Found '/usr/local/lib/libgphoto2/2.5.8/ptp2'.
Found '/usr/local/lib/libgphoto2/2.5.8/ricoh'.
Found '/usr/local/lib/libgphoto2/2.5.8/ricoh_g3'.
Found '/usr/local/lib/libgphoto2/2.5.8/samsung'.
Found '/usr/local/lib/libgphoto2/2.5.8/sierra'.
Found '/usr/local/lib/libgphoto2/2.5.8/sipix_blink2'.
Found '/usr/local/lib/libgphoto2/2.5.8/sipix_web2'.
Found '/usr/local/lib/libgphoto2/2.5.8/smal'.
Found '/usr/local/lib/libgphoto2/2.5.8/sonix'.
Found '/usr/local/lib/libgphoto2/2.5.8/sony_dscf1'.
Found '/usr/local/lib/libgphoto2/2.5.8/sony_dscf55'.
Found '/usr/local/lib/libgphoto2/2.5.8/soundvision'.
Found '/usr/local/lib/libgphoto2/2.5.8/spca50x'.
Found '/usr/local/lib/libgphoto2/2.5.8/sq905'.
Found '/usr/local/lib/libgphoto2/2.5.8/st2205'.
Found '/usr/local/lib/libgphoto2/2.5.8/stv0674'.
Found '/usr/local/lib/libgphoto2/2.5.8/stv0680'.
Found '/usr/local/lib/libgphoto2/2.5.8/sx330z'.
Found '/usr/local/lib/libgphoto2/2.5.8/topfield'.
Found '/usr/local/lib/libgphoto2/2.5.8/toshiba_pdrm11'.
Found '/usr/local/lib/libgphoto2/2.5.8/tp6801'.
Found 64 camera drivers.
Using ltdl to load io-drivers from '/usr/local/lib/libgphoto2_port/0.12.0'...
Called for filename '/usr/local/lib/libgphoto2_port/0.12.0/disk'.
Error during assembling of port list: 'Unspecified error' (-1).
Loaded '' ('^disk:') from '/usr/local/lib/libgphoto2_port/0.12.0/disk'.
Called for filename '/usr/local/lib/libgphoto2_port/0.12.0/ptpip'.
Loaded 'PTP/IP Connection' ('ptpip:') from '/usr/local/lib/libgphoto2_port/0.12.0/ptpip'.
Loaded '' ('^ptpip:') from '/usr/local/lib/libgphoto2_port/0.12.0/ptpip'.
Called for filename '/usr/local/lib/libgphoto2_port/0.12.0/usb1'.
Loaded '' ('^usb:') from '/usr/local/lib/libgphoto2_port/0.12.0/usb1'.
Loaded 'Universal Serial Bus' ('usb:002,002') from '/usr/local/lib/libgphoto2_port/0.12.0/usb1'.
Loaded 'Universal Serial Bus' ('usb:004,003') from '/usr/local/lib/libgphoto2_port/0.12.0/usb1'.
Called for filename '/usr/local/lib/libgphoto2_port/0.12.0/usbdiskdirect'.
Called for filename '/usr/local/lib/libgphoto2_port/0.12.0/usbscsi'.
Counting entries (6 available)...
3 regular entries available.
Getting info of entry 0 (6 available)...
Getting info of entry 1 (6 available)...
Getting info of entry 2 (6 available)...
Counting entries (6 available)...
3 regular entries available.
Creating new device...
Getting info of entry 0 (6 available)...
Setting settings...
Getting info of entry 1 (6 available)...
Setting port timeout to 5000 milliseconds.
Setting settings...
(old int=0, conf=-1, alt=-1) port usb:002,002, (new int=0, conf=-1, alt=-1) port usb:002,002
lowlevel libusb1 port not yet opened, no need for libusb changes
Auto-detecting USB cameras...
Looking for USB device (class 0x29a, subclass, 0xffffffff, protocol 0xffffffff)...
Looking for USB device (class 0x6, subclass, 0x1, protocol 0x1)...
Getting info of entry 2 (6 available)...
Setting port timeout to 5000 milliseconds.
Setting settings...
(old int=0, conf=-1, alt=-1) port usb:004,003, (new int=0, conf=-1, alt=-1) port usb:004,003
lowlevel libusb1 port not yet opened, no need for libusb changes
Auto-detecting USB cameras...
Looking for USB device (vendor 0x4a9, product 0x30bf)... found.
Detected defaults: config 1, interface 0, altsetting 0, inep 82, outep 01, intep 83, class 06, subclass 01
Found 'Canon Digital IXUS 40 (PTP mode)' (0x4a9,0x30bf)
Freeing port...
Closing port...
Counting entries (6 available)...
3 regular entries available.
Getting info of entry 0 (6 available)...
Getting info of entry 1 (6 available)...
Getting info of entry 2 (6 available)...
Creating new device...
Setting abilities ('Canon Digital IXUS 40 (PTP mode)')...
Looking for path 'usb:' (6 entries available)...
Starting regex search for 'usb:'...
Trying '^disk:'...
regexec failed
Trying '^ptpip:'...
regexec failed
Trying '^usb:'...
Getting info of entry 3 (7 available)...
Setting port info for port 'Generic Port' at 'usb:'...
Setting port timeout to 5000 milliseconds.
Setting settings...
(old int=0, conf=-1, alt=-1) port usb:, (new int=0, conf=-1, alt=-1) port usb:
lowlevel libusb1 port not yet opened, no need for libusb changes
Initializing camera...
Looking for USB device (vendor 0x4a9, product 0x30bf)... found.
Detected defaults: config 1, interface 0, altsetting 0, inep 82, outep 01, intep 83, class 06, subclass 01
Loading '/usr/local/lib/libgphoto2/2.5.8/ptp2'...
Opening USB port...
()
Could not query kernel driver of device.
claiming interface 0
'libusb_submit_transfer (port->pl->transfers[i])' failed: Input/Output error (-1)
'libusb_submit_transfer (port->pl->transfers[i])' failed: Other error (-99)
'libusb_submit_transfer (port->pl->transfers[i])' failed: Other error (-99)
'libusb_submit_transfer (port->pl->transfers[i])' failed: Other error (-99)
'libusb_submit_transfer (port->pl->transfers[i])' failed: Other error (-99)
'libusb_submit_transfer (port->pl->transfers[i])' failed: Other error (-99)
'libusb_submit_transfer (port->pl->transfers[i])' failed: Other error (-99)
'libusb_submit_transfer (port->pl->transfers[i])' failed: Other error (-99)
'libusb_submit_transfer (port->pl->transfers[i])' failed: Other error (-99)
'libusb_submit_transfer (port->pl->transfers[i])' failed: Other error (-99)
maxpacketsize 64
Setting port timeout to 1500 milliseconds.
PTP: Opening session
Sending PTP_OC 0x1002 / Open session request...
'libusb_bulk_transfer (port->pl->dh, port->settings.usb.outep, (unsigned char*)bytes, size, &curwritten, port->timeout)' failed: Other error (-99)
Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
Clearing halt on OUT EP and retrying once.
Clear USB halt...
'libusb_clear_halt(port->pl->dh, internal_ep)' failed: Other error (-99)
'libusb_bulk_transfer (port->pl->dh, port->settings.usb.outep, (unsigned char*)bytes, size, &curwritten, port->timeout)' failed: Other error (-99)
Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
'ptp_opensession (params, sessionid)' failed: PTP I/O Error (0x02ff)
Sending usb device reset request.
'handled = libusb_control_transfer (port->pl->dh, flags, request, value, index, (unsigned char*)bytes, size, port->timeout)' failed: Other error (-99)
PTP: Opening session
Sending PTP_OC 0x1002 / Open session request...
'libusb_bulk_transfer (port->pl->dh, port->settings.usb.outep, (unsigned char*)bytes, size, &curwritten, port->timeout)' failed: Other error (-99)
Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
Clearing halt on OUT EP and retrying once.
Clear USB halt...
'libusb_clear_halt(port->pl->dh, internal_ep)' failed: Other error (-99)
'libusb_bulk_transfer (port->pl->dh, port->settings.usb.outep, (unsigned char*)bytes, size, &curwritten, port->timeout)' failed: Other error (-99)
Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
'ptp_opensession (params, sessionid)' failed: PTP I/O Error (0x02ff)
Sending usb device reset request.
'handled = libusb_control_transfer (port->pl->dh, flags, request, value, index, (unsigned char*)bytes, size, port->timeout)' failed: Other error (-99)
PTP: Opening session
Sending PTP_OC 0x1002 / Open session request...
'libusb_bulk_transfer (port->pl->dh, port->settings.usb.outep, (unsigned char*)bytes, size, &curwritten, port->timeout)' failed: Other error (-99)
Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
Clearing halt on OUT EP and retrying once.
Clear USB halt...
'libusb_clear_halt(port->pl->dh, internal_ep)' failed: Other error (-99)
'libusb_bulk_transfer (port->pl->dh, port->settings.usb.outep, (unsigned char*)bytes, size, &curwritten, port->timeout)' failed: Other error (-99)
Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
'ptp_opensession (params, sessionid)' failed: PTP I/O Error (0x02ff)
'ret' failed: 'PTP I/O Error' (0x02ff)
PTP I/O Error
Closing port...
canceling transfer 0:0x1d9a03209438 (status 0)
'libusb_cancel_transfer(port->pl->transfers[i])' failed: Operation not supported or unimplemented on this platform (-12)
canceling transfer 1:0x1d9a9e32f5b8 (status 0)
'libusb_cancel_transfer(port->pl->transfers[i])' failed: Operation not supported or unimplemented on this platform (-12)
canceling transfer 2:0x1d9a962dc738 (status 0)
'libusb_cancel_transfer(port->pl->transfers[i])' failed: Operation not supported or unimplemented on this platform (-12)
canceling transfer 3:0x1d9a9e32f538 (status 0)
'libusb_cancel_transfer(port->pl->transfers[i])' failed: Operation not supported or unimplemented on this platform (-12)
canceling transfer 4:0x1d9a95663fb8 (status 0)
'libusb_cancel_transfer(port->pl->transfers[i])' failed: Operation not supported or unimplemented on this platform (-12)
canceling transfer 5:0x1d9a956631b8 (status 0)
'libusb_cancel_transfer(port->pl->transfers[i])' failed: Operation not supported or unimplemented on this platform (-12)
canceling transfer 6:0x1d9a03209938 (status 0)
'libusb_cancel_transfer(port->pl->transfers[i])' failed: Operation not supported or unimplemented on this platform (-12)
canceling transfer 7:0x1d9a962dc6b8 (status 0)
'libusb_cancel_transfer(port->pl->transfers[i])' failed: Operation not supported or unimplemented on this platform (-12)
canceling transfer 8:0x1d9a03209a38 (status 0)
'libusb_cancel_transfer(port->pl->transfers[i])' failed: Operation not supported or unimplemented on this platform (-12)
canceling transfer 9:0x1d9a956632b8 (status 0)
'libusb_cancel_transfer(port->pl->transfers[i])' failed: Operation not supported or unimplemented on this platform (-12)
Freeing camera...
Freeing port...
Closing port...
resetting filesystem
Clearing fscache LRU list...
fscache LRU list already empty
Internally deleting all folders from '/'...
Lookup folder '/'...
Found! / is 0x1d9a80f59880
Recurse delete folder 0x1d9a80f59880//
Invalid parameters: 'camera' is NULL/FALSE.
Invalid parameters: 'camera' is NULL/FALSE.
[....................snip....................]

All those libusb errors look suspicious, but I need directions for
further debug...

Please note that concerned port versions (gtkam 0.2.0, libgphoto2 2.5.8,
libgphoto2_port 0.12.0) didn't change b/w 5.7 and snapshots, so the
problem must be somewhere else.

I also tried disabling the XHCI support in the kernel, but the behavior
is the same.

Thanks in advance for any hints.

All the best
--
Alessandro DE LAURENZIS
[mailto:***@gmail.com]
LinkedIn: http://it.linkedin.com/in/delaurenzis
Alessandro DE LAURENZIS
2015-08-28 07:45:24 UTC
Permalink
Hello,
Post by Alessandro DE LAURENZIS
I have an old Canon camera (model "Digital IXUS 40"); it was perfectly
working in 5.7 through gphoto2 in PTP mode.
It doesn't work anymore in -current (5.8 GENERIC.MP#1267 amd64).
gphoto2 (well, I use gtkam actually) correctly detects it, but the
connection cannot be established. This is an excerpt of the debug
[...]
Post by Alessandro DE LAURENZIS
All those libusb errors look suspicious, but I need directions for
further debug...
Please note that concerned port versions (gtkam 0.2.0, libgphoto2 2.5.8,
libgphoto2_port 0.12.0) didn't change b/w 5.7 and snapshots, so the
problem must be somewhere else.
I partially tracked it down; actually, I reported a wrong info: recently
in snapshots libgphoto2 has been updated from 2.5.7 to 2.5.8; my camera
still properly works downgrading to 2.5.7

Maybe something to do with the libusb-compat/libusb1 change?

Anyone can comment on this? Antoine?

All the best
--
Alessandro DE LAURENZIS
[mailto:***@gmail.com]
LinkedIn: http://it.linkedin.com/in/delaurenzis
Antoine Jacoutot
2015-08-28 07:57:16 UTC
Permalink
Long shot but does it help using libusb-compat?
(note that I did not bump the port, it's just for testing)


Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/libgphoto2/Makefile,v
retrieving revision 1.40
diff -u -p -u -p -r1.40 Makefile
--- Makefile 7 Jul 2015 10:29:05 -0000 1.40
+++ Makefile 28 Aug 2015 07:56:14 -0000
@@ -24,7 +24,7 @@ MAINTAINER= Antoine Jacoutot <ajacoutot
PERMIT_PACKAGE_CDROM= Yes

WANTLIB += c exif expat fontconfig freetype gd jpeg ltdl lzma
-WANTLIB += m png pthread pthread-stubs tiff usb-1.0 vpx xml2 z
+WANTLIB += m png pthread pthread-stubs tiff usb usb-1.0 vpx xml2 z

MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=gphoto/}

@@ -32,7 +32,7 @@ MODULES= devel/gettext

LIB_DEPENDS= graphics/gd \
graphics/libexif \
- devel/libusb1 \
+ devel/libusb-compat \
devel/libtool,-ltdl \
textproc/libxml

@@ -44,7 +44,8 @@ CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}
CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
--enable-static \
--without-hal \
- --without-bonjour
+ --without-bonjour \
+ --without-libusb-1.0

# /usr/local/lib/libiconv.a(localcharset.o)(.text+0x0): In function `locale_charset':
# : multiple definition of `locale_charset'
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/graphics/libgphoto2/pkg/PLIST,v
retrieving revision 1.19
diff -u -p -u -p -r1.19 PLIST
--- pkg/PLIST 7 Jul 2015 10:29:05 -0000 1.19
+++ pkg/PLIST 28 Aug 2015 07:56:14 -0000
@@ -98,7 +98,7 @@ lib/libgphoto2_port.la
lib/libgphoto2_port/${GPHOTO2_PORT_API}/
lib/libgphoto2_port/${GPHOTO2_PORT_API}/disk.so
lib/libgphoto2_port/${GPHOTO2_PORT_API}/ptpip.so
-lib/libgphoto2_port/${GPHOTO2_PORT_API}/usb1.so
+lib/libgphoto2_port/${GPHOTO2_PORT_API}/usb.so
lib/libgphoto2_port/${GPHOTO2_PORT_API}/usbdiskdirect.so
lib/libgphoto2_port/${GPHOTO2_PORT_API}/usbscsi.so
lib/pkgconfig/libgphoto2.pc
--
Antoine
Alessandro DE LAURENZIS
2015-08-28 11:20:26 UTC
Permalink
Hi Antoine,
Post by Antoine Jacoutot
Long shot but does it help using libusb-compat?
(note that I did not bump the port, it's just for testing)
[...]

Applying the patch, it works flawlessly again! So we should revert to
libusb-compact for this port...

Many thanks for your prompt feedback.

Cheers
--
Alessandro DE LAURENZIS
[mailto:***@gmail.com]
LinkedIn: http://it.linkedin.com/in/delaurenzis
Antoine Jacoutot
2015-08-28 11:34:43 UTC
Permalink
Post by Alessandro DE LAURENZIS
Hi Antoine,
Post by Antoine Jacoutot
Long shot but does it help using libusb-compat?
(note that I did not bump the port, it's just for testing)
[...]
Applying the patch, it works flawlessly again! So we should revert to
libusb-compact for this port...
I'd rather see with Martin what is going on instead of blindly reverting to libusb-compat.
Martin ?
--
Antoine
Martin Pieuchot
2015-08-28 11:59:41 UTC
Permalink
Post by Antoine Jacoutot
Post by Alessandro DE LAURENZIS
Hi Antoine,
Post by Antoine Jacoutot
Long shot but does it help using libusb-compat?
(note that I did not bump the port, it's just for testing)
[...]
Applying the patch, it works flawlessly again! So we should revert to
libusb-compact for this port...
I'd rather see with Martin what is going on instead of blindly reverting to libusb-compat.
Martin ?
I don't know and don't want to dive into this right now.
Antoine Jacoutot
2015-08-28 13:11:11 UTC
Permalink
Sigh. I never said you should look at it right now. It's current after all and
there's a workaround so there is no rush...

-----Original Message-----
From: "Martin Pieuchot" <***@openbsd.org>
Sent: ‎8/‎28/‎2015 13:59
To: "Antoine Jacoutot" <***@bsdfrog.org>
Cc: "Alessandro DE LAURENZIS" <***@gmail.com>; "OpenBSD misc"
<***@openbsd.org>
Subject: Re: gphoto2 (PTP mode camera) no more working in -current
Post by Antoine Jacoutot
Post by Alessandro DE LAURENZIS
Hi Antoine,
Post by Antoine Jacoutot
Long shot but does it help using libusb-compat?
(note that I did not bump the port, it's just for testing)
[...]
Applying the patch, it works flawlessly again! So we should revert to
libusb-compact for this port...
I'd rather see with Martin what is going on instead of blindly reverting to libusb-compat.
Martin ?
I don't know and don't want to dive into this right now.
Martin Pieuchot
2015-08-28 11:42:49 UTC
Permalink
Post by Alessandro DE LAURENZIS
Hi Antoine,
Post by Antoine Jacoutot
Long shot but does it help using libusb-compat?
(note that I did not bump the port, it's just for testing)
[...]
Applying the patch, it works flawlessly again! So we should revert to
libusb-compact for this port...
I'd be interested to know if it works with libusb-1.0.20-rc1 but without
the aja@'s reverted diff.

Could you try the diff below?

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/libusb1/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- Makefile 16 Mar 2015 18:07:43 -0000 1.23
+++ Makefile 14 Aug 2015 11:57:51 -0000
@@ -2,15 +2,15 @@

COMMENT = library for USB device access from userspace

-VERSION = 1.0.9
+VERSION = 1.0.20-rc1
DISTNAME = libusb-${VERSION}
PKGNAME = libusb1-${VERSION}
-REVISION = 9
-SHARED_LIBS += usb-1.0 1.0 # 1.0
+
+SHARED_LIBS += usb-1.0 1.1 # 1.0

CATEGORIES = devel

-HOMEPAGE = http://www.libusb.org
+HOMEPAGE = http://www.libusb.info

MAINTAINER = Martin Pieuchot <***@openbsd.org>

@@ -19,8 +19,26 @@ PERMIT_PACKAGE_CDROM = Yes

WANTLIB = pthread

+.if ${VERSION:S/-rc//} == ${VERSION}
MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=libusb/}
EXTRACT_SUFX = .tar.bz2
+.else
+GH_ACCOUNT = libusb
+GH_PROJECT = libusb
+GH_COMMIT = d73bc723aaeb4e043bb079198b37f5e0b0726168
+
+
+BUILD_DEPENDS= devel/libtool \
+ ${MODGNU_AUTOCONF_DEPENDS} \
+ ${MODGNU_AUTOMAKE_DEPENDS}
+
+AUTOCONF_VERSION= 2.69
+AUTOMAKE_VERSION= 1.11
+
+pre-configure:
+ cd ${WRKSRC} && env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+ AUTOMAKE_VERSION=${AUTOMAKE_VERSION} sh ./bootstrap.sh
+.endif

CONFIGURE_STYLE = gnu
CONFIGURE_ARGS += ${CONFIGURE_SHARED}
Index: distinfo
===================================================================
RCS file: /cvs/ports/devel/libusb1/distinfo,v
retrieving revision 1.3
diff -u -p -r1.3 distinfo
--- distinfo 18 Jan 2015 03:13:17 -0000 1.3
+++ distinfo 14 Aug 2015 11:45:33 -0000
@@ -1,2 +1,2 @@
-SHA256 (libusb-1.0.9.tar.bz2) = 6SDu3C0GsJYGYRyZ7HMEQTxnhMum4zko54JD0yMZX5s=
-SIZE (libusb-1.0.9.tar.bz2) = 421971
+SHA256 (libusb-1.0.20-rc1.tar.gz) = lmlBTmwtinvE5Rg584rKMhD9l3wJP6GQ7HnE5W4eiZ0=
+SIZE (libusb-1.0.20-rc1.tar.gz) = 361819
Index: patches/patch-libusb_core_c
===================================================================
RCS file: /cvs/ports/devel/libusb1/patches/patch-libusb_core_c,v
retrieving revision 1.3
diff -u -p -r1.3 patch-libusb_core_c
--- patches/patch-libusb_core_c 19 Jun 2012 21:10:59 -0000 1.3
+++ patches/patch-libusb_core_c 16 Jun 2015 11:45:17 -0000
@@ -4,9 +4,9 @@ On OpenBSD USB controllers are shown as
itinial limit too small. On a recent machine this value is almost
always exceeded, so bump it.

---- libusb/core.c.orig Fri Apr 20 08:44:27 2012
-+++ libusb/core.c Tue Jun 12 15:48:05 2012
-@@ -468,7 +468,7 @@ libusb_free_device_list(list, 1);
+--- libusb/core.c.orig Sun Jan 26 00:06:33 2014
++++ libusb/core.c Mon Jan 27 10:08:37 2014
+@@ -448,7 +448,7 @@ libusb_free_device_list(list, 1);
* which grows when required. it can be freed once discovery has completed,
* eliminating the need for a list node in the libusb_device structure
* itself. */
Index: patches/patch-libusb_os_openbsd_usb_c
===================================================================
RCS file: /cvs/ports/devel/libusb1/patches/patch-libusb_os_openbsd_usb_c,v
retrieving revision 1.5
diff -u -p -r1.5 patch-libusb_os_openbsd_usb_c
--- patches/patch-libusb_os_openbsd_usb_c 22 Apr 2013 08:37:20 -0000 1.5
+++ patches/patch-libusb_os_openbsd_usb_c 16 Jun 2015 11:45:17 -0000
@@ -1,570 +0,0 @@
-$OpenBSD: patch-libusb_os_openbsd_usb_c,v 1.5 2013/04/22 08:37:20 mpi Exp $
-
-Add support for non ugen(4) attached devices through usb(4) buses.
-
---- libusb/os/openbsd_usb.c.orig Fri Apr 20 08:44:27 2012
-+++ libusb/os/openbsd_usb.c Sun Apr 21 12:39:40 2013
-@@ -1,5 +1,5 @@
- /*
-- * Copyright (c) 2011 Martin Pieuchot <***@openbsd.org>
-+ * Copyright (c) 2011-2013 Martin Pieuchot <***@openbsd.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
-@@ -32,8 +32,8 @@
- #include "libusbi.h"
-
- struct device_priv {
-- char devnode[16];
-- int fd;
-+ char *devname; /* name of the ugen(4) node */
-+ int fd; /* device file descriptor */
-
- unsigned char *cdesc; /* active config descriptor */
- usb_device_descriptor_t ddesc; /* usb device descriptor */
-@@ -82,11 +82,14 @@ static int obsd_clock_gettime(int, struct timespec *);
- * Private functions
- */
- static int _errno_to_libusb(int);
--static int _cache_active_config_descriptor(struct libusb_device *, int);
-+static int _cache_active_config_descriptor(struct libusb_device *);
- static int _sync_control_transfer(struct usbi_transfer *);
- static int _sync_gen_transfer(struct usbi_transfer *);
- static int _access_endpoint(struct libusb_transfer *);
-
-+static int _bus_open(int);
-+
-+
- const struct usbi_os_backend openbsd_backend = {
- "Synchronous OpenBSD backend",
- NULL, /* init() */
-@@ -128,75 +131,105 @@ const struct usbi_os_backend openbsd_backend = {
- 0, /* add_iso_packet_size */
- };
-
-+#define DEVPATH "/dev/"
-+#define USBDEV DEVPATH "usb"
-+
- int
- obsd_get_device_list(struct libusb_context * ctx,
- struct discovered_devs **discdevs)
- {
-+ struct discovered_devs *ddd;
- struct libusb_device *dev;
- struct device_priv *dpriv;
- struct usb_device_info di;
-+ struct usb_device_ddesc dd;
- unsigned long session_id;
-- char devnode[16];
-- int fd, err, i;
-+ char devices[USB_MAX_DEVICES];
-+ char busnode[16];
-+ char *udevname;
-+ int fd, addr, i, j;
-
- usbi_dbg("");
-
-- /* Only ugen(4) is supported */
-- for (i = 0; i < USB_MAX_DEVICES; i++) {
-- /* Control endpoint is always .00 */
-- snprintf(devnode, sizeof(devnode), "/dev/ugen%d.00", i);
-+ for (i = 0; i < 8; i++) {
-+ snprintf(busnode, sizeof(busnode), USBDEV "%d", i);
-
-- if ((fd = open(devnode, O_RDONLY)) < 0) {
-+ if ((fd = open(busnode, O_RDWR)) < 0) {
- if (errno != ENOENT && errno != ENXIO)
-- usbi_err(ctx, "could not open %s", devnode);
-+ usbi_err(ctx, "could not open %s", busnode);
- continue;
- }
-
-- if (ioctl(fd, USB_GET_DEVICEINFO, &di) < 0)
-- continue;
-+ bzero(devices, sizeof(devices));
-+ for (addr = 1; addr < USB_MAX_DEVICES; addr++) {
-+ if (devices[addr])
-+ continue;
-
-- session_id = (di.udi_bus << 8 | di.udi_addr);
-- dev = usbi_get_device_by_session_id(ctx, session_id);
-+ di.udi_addr = addr;
-+ if (ioctl(fd, USB_DEVICEINFO, &di) < 0)
-+ continue;
-
-- if (dev == NULL) {
-- dev = usbi_alloc_device(ctx, session_id);
-- if (dev == NULL)
-- return (LIBUSB_ERROR_NO_MEM);
-+ /*
-+ * XXX If ugen(4) is attached to the USB device
-+ * it will be used.
-+ */
-+ udevname = NULL;
-+ for (j = 0; j < USB_MAX_DEVNAMES; j++)
-+ if (!strncmp("ugen", di.udi_devnames[j], 4)) {
-+ udevname = strdup(di.udi_devnames[j]);
-+ break;
-+ }
-
-- dev->bus_number = di.udi_bus;
-- dev->device_address = di.udi_addr;
-- dev->speed = di.udi_speed;
-+ session_id = (di.udi_bus << 8 | di.udi_addr);
-+ dev = usbi_get_device_by_session_id(ctx, session_id);
-
-- dpriv = (struct device_priv *)dev->os_priv;
-- strlcpy(dpriv->devnode, devnode, sizeof(devnode));
-- dpriv->fd = -1;
-+ if (dev == NULL) {
-+ dev = usbi_alloc_device(ctx, session_id);
-+ if (dev == NULL) {
-+ close(fd);
-+ return (LIBUSB_ERROR_NO_MEM);
-+ }
-
-- if (ioctl(fd, USB_GET_DEVICE_DESC, &dpriv->ddesc) < 0) {
-- err = errno;
-- goto error;
-+ dev->bus_number = di.udi_bus;
-+ dev->device_address = di.udi_addr;
-+ dev->speed = di.udi_speed;
-+
-+ dpriv = (struct device_priv *)dev->os_priv;
-+ dpriv->fd = -1;
-+ dpriv->cdesc = NULL;
-+ dpriv->devname = udevname;
-+
-+ dd.udd_bus = di.udi_bus;
-+ dd.udd_addr = di.udi_addr;
-+ if (ioctl(fd, USB_DEVICE_GET_DDESC, &dd) < 0) {
-+ libusb_unref_device(dev);
-+ continue;
-+ }
-+ dpriv->ddesc = dd.udd_desc;
-+
-+ if (_cache_active_config_descriptor(dev)) {
-+ libusb_unref_device(dev);
-+ continue;
-+ }
-+
-+ if (usbi_sanitize_device(dev))
-+ libusb_unref_device(dev);
- }
-
-- dpriv->cdesc = NULL;
-- if (_cache_active_config_descriptor(dev, fd)) {
-- err = errno;
-- goto error;
-+ ddd = discovered_devs_append(*discdevs, dev);
-+ if (ddd == NULL) {
-+ close(fd);
-+ return (LIBUSB_ERROR_NO_MEM);
- }
-
-- if ((err = usbi_sanitize_device(dev)))
-- goto error;
-+ *discdevs = ddd;
-+ devices[addr] = 1;
- }
-- close(fd);
-
-- if (discovered_devs_append(*discdevs, dev) == NULL)
-- return (LIBUSB_ERROR_NO_MEM);
-+ close(fd);
- }
-
- return (LIBUSB_SUCCESS);
--
--error:
-- close(fd);
-- libusb_unref_device(dev);
-- return _errno_to_libusb(err);
- }
-
- int
-@@ -204,16 +237,22 @@ obsd_open(struct libusb_device_handle *handle)
- {
- struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
-+ char devnode[16];
-
-- dpriv->fd = open(dpriv->devnode, O_RDWR);
-- if (dpriv->fd < 0) {
-- dpriv->fd = open(dpriv->devnode, O_RDONLY);
-+ if (dpriv->devname) {
-+ /*
-+ * Only open ugen(4) attached devices read-write, all
-+ * read-only operations are done through the bus node.
-+ */
-+ snprintf(devnode, sizeof(devnode), DEVPATH "%s.00",
-+ dpriv->devname);
-+ dpriv->fd = open(devnode, O_RDWR);
- if (dpriv->fd < 0)
- return _errno_to_libusb(errno);
-+
-+ usbi_dbg("open %s: fd %d", devnode, dpriv->fd);
- }
-
-- usbi_dbg("open %s: fd %d", dpriv->devnode, dpriv->fd);
--
- if (pipe(hpriv->pipe) < 0)
- return _errno_to_libusb(errno);
-
-@@ -226,10 +265,12 @@ obsd_close(struct libusb_device_handle *handle)
- struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
-
-- usbi_dbg("close: fd %d", dpriv->fd);
-+ if (dpriv->devname) {
-+ usbi_dbg("close: fd %d", dpriv->fd);
-
-- close(dpriv->fd);
-- dpriv->fd = -1;
-+ close(dpriv->fd);
-+ dpriv->fd = -1;
-+ }
-
- usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->pipe[0]);
-
-@@ -257,9 +298,8 @@ obsd_get_active_config_descriptor(struct libusb_device
- unsigned char *buf, size_t len, int *host_endian)
- {
- struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
-- usb_config_descriptor_t *ucd;
-+ usb_config_descriptor_t *ucd = (usb_config_descriptor_t *)dpriv->cdesc;
-
-- ucd = (usb_config_descriptor_t *) dpriv->cdesc;
- len = MIN(len, UGETW(ucd->wTotalLength));
-
- usbi_dbg("len %d", len);
-@@ -275,35 +315,27 @@ int
- obsd_get_config_descriptor(struct libusb_device *dev, uint8_t idx,
- unsigned char *buf, size_t len, int *host_endian)
- {
-- struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
-- struct usb_full_desc ufd;
-+ struct usb_device_fdesc udf;
- int fd, err;
-
-- usbi_dbg("index %d, len %d", idx, len);
-+ if ((fd = _bus_open(dev->bus_number)) < 0)
-+ return _errno_to_libusb(errno);
-
-- /* A config descriptor may be requested before opening the device */
-- if (dpriv->fd >= 0) {
-- fd = dpriv->fd;
-- } else {
-- fd = open(dpriv->devnode, O_RDONLY);
-- if (fd < 0)
-- return _errno_to_libusb(errno);
-- }
-+ udf.udf_bus = dev->bus_number;
-+ udf.udf_addr = dev->device_address;
-+ udf.udf_config_index = idx;
-+ udf.udf_size = len;
-+ udf.udf_data = buf;
-
-- ufd.ufd_config_index = idx;
-- ufd.ufd_size = len;
-- ufd.ufd_data = buf;
-+ usbi_dbg("index %d, len %d", udf.udf_config_index, len);
-
-- if ((ioctl(fd, USB_GET_FULL_DESC, &ufd)) < 0) {
-+ if (ioctl(fd, USB_DEVICE_GET_FDESC, &udf) < 0) {
- err = errno;
-- if (dpriv->fd < 0)
-- close(fd);
-+ close(fd);
- return _errno_to_libusb(err);
- }
-+ close(fd);
-
-- if (dpriv->fd < 0)
-- close(fd);
--
- *host_endian = 0;
-
- return (LIBUSB_SUCCESS);
-@@ -313,14 +345,12 @@ int
- obsd_get_configuration(struct libusb_device_handle *handle, int *config)
- {
- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
-+ usb_config_descriptor_t *ucd = (usb_config_descriptor_t *)dpriv->cdesc;
-
-- usbi_dbg("");
-+ *config = ucd->bConfigurationValue;
-
-- if (ioctl(dpriv->fd, USB_GET_CONFIG, config) < 0)
-- return _errno_to_libusb(errno);
-+ usbi_dbg("bConfigurationValue %d", *config);
-
-- usbi_dbg("configuration %d", *config);
--
- return (LIBUSB_SUCCESS);
- }
-
-@@ -329,12 +359,15 @@ obsd_set_configuration(struct libusb_device_handle *ha
- {
- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
-
-- usbi_dbg("configuration %d", config);
-+ if (dpriv->devname == NULL)
-+ return (LIBUSB_ERROR_NOT_SUPPORTED);
-
-+ usbi_dbg("bConfigurationValue %d", config);
-+
- if (ioctl(dpriv->fd, USB_SET_CONFIG, &config) < 0)
- return _errno_to_libusb(errno);
-
-- return _cache_active_config_descriptor(handle->dev, dpriv->fd);
-+ return _cache_active_config_descriptor(handle->dev);
- }
-
- int
-@@ -369,6 +402,9 @@ obsd_set_interface_altsetting(struct libusb_device_han
- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
- struct usb_alt_interface intf;
-
-+ if (dpriv->devname == NULL)
-+ return (LIBUSB_ERROR_NOT_SUPPORTED);
-+
- usbi_dbg("iface %d, setting %d", iface, altsetting);
-
- memset(&intf, 0, sizeof(intf));
-@@ -385,19 +421,27 @@ obsd_set_interface_altsetting(struct libusb_device_han
- int
- obsd_clear_halt(struct libusb_device_handle *handle, unsigned char endpoint)
- {
-- struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
- struct usb_ctl_request req;
-+ int fd, err;
-
-+ if ((fd = _bus_open(handle->dev->bus_number)) < 0)
-+ return _errno_to_libusb(errno);
-+
- usbi_dbg("");
-
-+ req.ucr_addr = handle->dev->device_address;
- req.ucr_request.bmRequestType = UT_WRITE_ENDPOINT;
- req.ucr_request.bRequest = UR_CLEAR_FEATURE;
- USETW(req.ucr_request.wValue, UF_ENDPOINT_HALT);
- USETW(req.ucr_request.wIndex, endpoint);
- USETW(req.ucr_request.wLength, 0);
-
-- if (ioctl(dpriv->fd, USB_DO_REQUEST, &req) < 0)
-- return _errno_to_libusb(errno);
-+ if (ioctl(fd, USB_REQUEST, &req) < 0) {
-+ err = errno;
-+ close(fd);
-+ return _errno_to_libusb(err);
-+ }
-+ close(fd);
-
- return (LIBUSB_SUCCESS);
- }
-@@ -418,6 +462,7 @@ obsd_destroy_device(struct libusb_device *dev)
- usbi_dbg("");
-
- free(dpriv->cdesc);
-+ free(dpriv->devname);
- }
-
- int
-@@ -557,6 +602,8 @@ obsd_clock_gettime(int clkid, struct timespec *tp)
- int
- _errno_to_libusb(int err)
- {
-+ usbi_dbg("error: %s (%d)", strerror(err), err);
-+
- switch (err) {
- case EIO:
- return (LIBUSB_ERROR_IO);
-@@ -566,52 +613,64 @@ _errno_to_libusb(int err)
- return (LIBUSB_ERROR_NO_DEVICE);
- case ENOMEM:
- return (LIBUSB_ERROR_NO_MEM);
-+ case ETIMEDOUT:
-+ return (LIBUSB_ERROR_TIMEOUT);
- }
-
-- usbi_dbg("error: %s", strerror(err));
--
- return (LIBUSB_ERROR_OTHER);
- }
-
- int
--_cache_active_config_descriptor(struct libusb_device *dev, int fd)
-+_cache_active_config_descriptor(struct libusb_device *dev)
- {
- struct device_priv *dpriv = (struct device_priv *)dev->os_priv;
-- struct usb_config_desc ucd;
-- struct usb_full_desc ufd;
-+ struct usb_device_cdesc udc;
-+ struct usb_device_fdesc udf;
- unsigned char* buf;
-- int len;
-+ int fd, len, err;
-
-- usbi_dbg("fd %d", fd);
-+ if ((fd = _bus_open(dev->bus_number)) < 0)
-+ return _errno_to_libusb(errno);
-
-- ucd.ucd_config_index = USB_CURRENT_CONFIG_INDEX;
-+ usbi_dbg("fd %d, addr %d", fd, dev->device_address);
-
-- if ((ioctl(fd, USB_GET_CONFIG_DESC, &ucd)) < 0)
-+ udc.udc_bus = dev->bus_number;
-+ udc.udc_addr = dev->device_address;
-+ udc.udc_config_index = USB_CURRENT_CONFIG_INDEX;
-+ if (ioctl(fd, USB_DEVICE_GET_CDESC, &udc) < 0) {
-+ err = errno;
-+ close(fd);
- return _errno_to_libusb(errno);
-+ }
-
-- usbi_dbg("active bLength %d", ucd.ucd_desc.bLength);
-+ usbi_dbg("active bLength %d", udc.udc_desc.bLength);
-
-- len = UGETW(ucd.ucd_desc.wTotalLength);
-+ len = UGETW(udc.udc_desc.wTotalLength);
- buf = malloc(len);
- if (buf == NULL)
- return (LIBUSB_ERROR_NO_MEM);
-
-- ufd.ufd_config_index = ucd.ucd_config_index;
-- ufd.ufd_size = len;
-- ufd.ufd_data = buf;
-+ udf.udf_bus = dev->bus_number;
-+ udf.udf_addr = dev->device_address;
-+ udf.udf_config_index = udc.udc_config_index;
-+ udf.udf_size = len;
-+ udf.udf_data = buf;
-
-- usbi_dbg("index %d, len %d", ufd.ufd_config_index, len);
-+ usbi_dbg("index %d, len %d", udf.udf_config_index, len);
-
-- if ((ioctl(fd, USB_GET_FULL_DESC, &ufd)) < 0) {
-+ if (ioctl(fd, USB_DEVICE_GET_FDESC, &udf) < 0) {
-+ err = errno;
-+ close(fd);
- free(buf);
-- return _errno_to_libusb(errno);
-+ return _errno_to_libusb(err);
- }
-+ close(fd);
-
- if (dpriv->cdesc)
- free(dpriv->cdesc);
- dpriv->cdesc = buf;
-
-- return (0);
-+ return (LIBUSB_SUCCESS);
- }
-
- int
-@@ -626,12 +685,13 @@ _sync_control_transfer(struct usbi_transfer *itransfer
- dpriv = (struct device_priv *)transfer->dev_handle->dev->os_priv;
- setup = (struct libusb_control_setup *)transfer->buffer;
-
-- usbi_dbg("type %d request %d value %d index %d length %d timeout %d",
-+ usbi_dbg("type %x request %x value %x index %d length %d timeout %d",
- setup->bmRequestType, setup->bRequest,
- libusb_le16_to_cpu(setup->wValue),
- libusb_le16_to_cpu(setup->wIndex),
- libusb_le16_to_cpu(setup->wLength), transfer->timeout);
-
-+ req.ucr_addr = transfer->dev_handle->dev->device_address;
- req.ucr_request.bmRequestType = setup->bmRequestType;
- req.ucr_request.bRequest = setup->bRequest;
- /* Don't use USETW, libusb already deals with the endianness */
-@@ -643,12 +703,31 @@ _sync_control_transfer(struct usbi_transfer *itransfer
- if ((transfer->flags & LIBUSB_TRANSFER_SHORT_NOT_OK) == 0)
- req.ucr_flags = USBD_SHORT_XFER_OK;
-
-- if ((ioctl(dpriv->fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
-- return _errno_to_libusb(errno);
-+ if (dpriv->devname == NULL) {
-+ /*
-+ * XXX If the device is not attached to ugen(4) it is
-+ * XXX still possible to submit a control transfer but
-+ * XXX with the default timeout only.
-+ */
-+ int fd, err;
-
-- if ((ioctl(dpriv->fd, USB_DO_REQUEST, &req)) < 0)
-- return _errno_to_libusb(errno);
-+ if ((fd = _bus_open(transfer->dev_handle->dev->bus_number)) < 0)
-+ return _errno_to_libusb(errno);
-
-+ if ((ioctl(fd, USB_REQUEST, &req)) < 0) {
-+ err = errno;
-+ close(fd);
-+ return _errno_to_libusb(err);
-+ }
-+ close(fd);
-+ } else {
-+ if ((ioctl(dpriv->fd, USB_SET_TIMEOUT, &transfer->timeout)) < 0)
-+ return _errno_to_libusb(errno);
-+
-+ if ((ioctl(dpriv->fd, USB_DO_REQUEST, &req)) < 0)
-+ return _errno_to_libusb(errno);
-+ }
-+
- itransfer->transferred = req.ucr_actlen;
-
- usbi_dbg("transferred %d", itransfer->transferred);
-@@ -661,7 +740,7 @@ _access_endpoint(struct libusb_transfer *transfer)
- {
- struct handle_priv *hpriv;
- struct device_priv *dpriv;
-- char *s, devnode[16];
-+ char devnode[16];
- int fd, endpt;
- mode_t mode;
-
-@@ -674,10 +753,9 @@ _access_endpoint(struct libusb_transfer *transfer)
- usbi_dbg("endpoint %d mode %d", endpt, mode);
-
- if (hpriv->endpoints[endpt] < 0) {
-- /* Pick the right node given the control one */
-- strlcpy(devnode, dpriv->devnode, sizeof(devnode));
-- s = strchr(devnode, '.');
-- snprintf(s, 4, ".%02d", endpt);
-+ /* Pick the right endpoint node */
-+ snprintf(devnode, sizeof(devnode), DEVPATH "%s.%02d",
-+ dpriv->devname, endpt);
-
- /* We may need to read/write to the same endpoint later. */
- if (((fd = open(devnode, O_RDWR)) < 0) && (errno == ENXIO))
-@@ -694,10 +772,15 @@ int
- _sync_gen_transfer(struct usbi_transfer *itransfer)
- {
- struct libusb_transfer *transfer;
-+ struct device_priv *dpriv;
- int fd, nr = 1;
-
- transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
-+ dpriv = (struct device_priv *)transfer->dev_handle->dev->os_priv;
-
-+ if (dpriv->devname == NULL)
-+ return (LIBUSB_ERROR_NOT_SUPPORTED);
-+
- /*
- * Bulk, Interrupt or Isochronous transfer depends on the
- * endpoint and thus the node to open.
-@@ -724,4 +807,14 @@ _sync_gen_transfer(struct usbi_transfer *itransfer)
- itransfer->transferred = nr;
-
- return (0);
-+}
-+
-+int
-+_bus_open(int number)
-+{
-+ char busnode[16];
-+
-+ snprintf(busnode, sizeof(busnode), USBDEV "%d", number);
-+
-+ return open(busnode, O_RDWR);
- }
Alessandro DE LAURENZIS
2015-08-30 15:34:17 UTC
Permalink
Hi Martin,
Post by Martin Pieuchot
I'd be interested to know if it works with libusb-1.0.20-rc1 but without
Could you try the diff below?
[...]

I need more time to try this... Bear with me, I hope to give you a
feedback early next week.

Thanks for your feedback

All the best
--
Alessandro DE LAURENZIS
[mailto:***@gmail.com]
LinkedIn: http://it.linkedin.com/in/delaurenzis
Loading...