Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Sep 2009 17:40:48 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-usb@freebsd.org
Subject:   Re: libusb20 api
Message-ID:  <200909221740.49279.hselasky@c2i.net>
In-Reply-To: <2C0D6269-1296-4D34-8029-828A0FE281CB@tlb.org>
References:  <2C0D6269-1296-4D34-8029-828A0FE281CB@tlb.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 22 September 2009 00:38:46 Trevor Blackwell wrote:
> This always fails:
>
>        char devname[256];
>        if (libusb20_dev_get_iface_desc(pdev, n, devname,
> sizeof(devname))) break;
>
> while this works:
>
>        char devname[128];
>        if (libusb20_dev_get_iface_desc(pdev, n, devname,
> sizeof(devname))) break;
>
> Because this function takes a uint8_t for length:
>
> <libusb20_ugen20.c:851>:
> static int
> ugen20_dev_get_iface_desc(struct libusb20_device *pdev,
>      uint8_t iface_index, char *buf, uint8_t len)
>
> even though the kernel ioctl structure has a 16-bit length.
>
> Hans, why not just use size_t for such arguments?

Your point is valid. Currently USB string descriptors are always limited to 
255 bytes. Setting up a larger buffer does not make sense.

I will see what I can do.

--HPS




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909221740.49279.hselasky>