NetBSD Problem Report #37053

From martin@duskware.de  Tue Oct  2 09:49:15 2007
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 7767C63B97E
	for <gnats-bugs@gnats.netbsd.org>; Tue,  2 Oct 2007 09:49:15 +0000 (UTC)
Message-Id: <20071002074438.8DA4763B8C2@narn.NetBSD.org>
Date: Tue,  2 Oct 2007 07:44:38 +0000 (UTC)
From: cyber@netbsd.org
Reply-To: cyber@netbsd.org
To: netbsd-bugs-owner@NetBSD.org
Subject: libusb has wrong return size for usb_control_msg
X-Send-Pr-Version: www-1.0

>Number:         37053
>Category:       pkg
>Synopsis:       libusb has wrong return size for usb_control_msg
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    drochner
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 02 09:50:00 +0000 2007
>Closed-Date:    Thu Oct 11 18:29:57 +0000 2007
>Last-Modified:  Thu Oct 11 18:29:57 +0000 2007
>Originator:     Erik Berls
>Release:        4.99.16
>Organization:
TNF
>Environment:
NetBSD dev0 4.99.16 NetBSD 4.99.16 (GENERIC.MP) #0: Fri Apr  6 12:32:19 PDT 2007  cyber@jonestown.local:/image/NetBSD/src/sys/arch/amd64/compile/obj/GENERIC.MP amd64

>Description:
Trying to build a program that uses libusb, usbtenki (www.ralphnet.net/en).

The program executes its own xor checksum of the returned data based on the specified return length.

It was failing the checksums, traced down to return the wrong length.
>How-To-Repeat:
1 Install libusb
2 Build usbtenki
Try to run usbtenkiget -l and notice it errors out with a checksum error.

The issue manifested itself both on a 4.99.16 amd64 box, and a 4.0_beta2 i386 box.

>Fix:
diff -r1.1 patch-ad
147a148,156
> @@ -477,7 +482,7 @@ int usb_control_msg(usb_dev_handle *dev,
>      USB_ERROR_STR(-errno, "error sending control message: %s",
>                    strerror(errno));
> 
> -  return UGETW(req.ucr_request.wLength);
> +  return req.ucr_actlen;
>  }
> 
>  int usb_os_find_busses(struct usb_bus **busses)

This fix has been tested on an amd64 box running 4.99.16.


This is the only installed use of libusb that I've attempted to use.  This needs confirmation from another user.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->drochner
Responsible-Changed-By: reed@netbsd.org
Responsible-Changed-When: Tue, 02 Oct 2007 12:43:17 +0000
Responsible-Changed-Why:
Assigned to maintainer.


From: Matthias Drochner <drochner@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/37053 CVS commit: pkgsrc/devel/libusb
Date: Thu, 11 Oct 2007 18:25:19 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	drochner
 Date:		Thu Oct 11 18:25:19 UTC 2007

 Modified Files:
 	pkgsrc/devel/libusb: Makefile distinfo
 	pkgsrc/devel/libusb/patches: patch-ad

 Log Message:
 Make usb_control_msg() return the number of bytes actually transferred
 rather than the requested transfer length (USBD_SHORT_XFER_OK is
 set, so this may happen). This is the documented behaviour, and it is
 appearently what the Linux version does. Bump PKGREVISION. From
 Erik Berls per PR pkg/37053.


 To generate a diff of this commit:
 cvs rdiff -r1.27 -r1.28 pkgsrc/devel/libusb/Makefile
 cvs rdiff -r1.18 -r1.19 pkgsrc/devel/libusb/distinfo
 cvs rdiff -r1.8 -r1.9 pkgsrc/devel/libusb/patches/patch-ad

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: drochner@netbsd.org
State-Changed-When: Thu, 11 Oct 2007 18:29:57 +0000
State-Changed-Why:
Applied the patch. I did only verify that an EOS300D can be read out
as good as before (which is not much, unfortunately) with gphoto
and s10sh. The change makes sense in any case since it makes the code
match documented behaviour.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.