Subject: Re: Incompatibilities between <=3.0 & current: USB_DEVICEINFO ioctl
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Stephan Thesing <thesing@cs.uni-sb.de>
List: current-users
Date: 03/21/2006 22:04:02
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-2111587957-1142975042=:14032
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

hello,

On Mon, 20 Mar 2006, Manuel Bouyer wrote:

> Date: Mon, 20 Mar 2006 21:44:47 +0100
> From: Manuel Bouyer <bouyer@antioche.eu.org>
> To: Stephan Thesing <thesing@cs.uni-sb.de>
> Cc: current-users@NetBSD.org
> Subject: Re: Incompatibilities between <=3.0 & current: USB_DEVICEINFO ioctl
> 
> On Sun, Mar 19, 2006 at 09:21:31PM +0100, Stephan Thesing wrote:
>> Hello,
>>
[...]
>> Is this accepted behavior and I should just live with having to compile a
>> libusb under -current (which fixed my problem for digikam) or should a
>> compat ioctl be added to -current in order to mimic the old behavior?
>> (It will be difficult to mimic the right behavior for reads of events...)
>
> Ideally a compat ioctl should be added, especially as there may be
> binary-only statically linked drivers around.

attached is a try for a patch which
  - adds compat ioctls with the right numbers from <=3.0 for
      USB_GET_DEVICEINFO and USB_DEVICEINFO named
       USB_GET_DEVICEINFO_OLD and USB_DEVICEINFO_OLD
  - adds structs usb_device_info_old and usb_event_old, which are
      compatible with the usb_device_info and usb_event structs form <=3.0
  - adds code to restore the old string handling for the compat ioctls (which is
      quite ugly)
  - adds compat code in `usbread' that transforms results into the usb_event_old
     struct if the read size was for that struct (to handle event reads from
     /dev/usb)

This seems to work (digikam now works both with a -current compile libusb and a
  3.0 one, reads from /dev/usb seem to work as well).

As this patch is the result of hacking after a long day of work, it's probably 
not as nice at it could be.  One thing that should probably be changed is 
making the compat code dependend on COMPAT_{16,20,30} being defined...

Best regards....
 	Stephan

-- 
=  Tel.: +49-681-302-5571      = Universitaet des Saarlandes =
=  Fax.: +49-681-302-3065      = Postfach 15 11 50           =
=  Compiler Research Group     = 66041 Saarbruecken          =
=  FR 6.2 - Informatik         = GERMANY                     =

--0-2111587957-1142975042=:14032
Content-Type: TEXT/PLAIN; charset=US-ASCII; name=usbdiff
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.NEB.4.64.0603212204020.14032@gargoyle.cs.uni-sb.de>
Content-Description: USB compat diff
Content-Disposition: attachment; filename=usbdiff

SW5kZXg6IHN5cy9kZXYvdXNiL3VnZW4uYw0KPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PQ0KUkNTIGZpbGU6IC9jdnNyb290L3NyYy9zeXMvZGV2L3VzYi91Z2Vu
LmMsdg0KcmV0cmlldmluZyByZXZpc2lvbiAxLjc5DQpkaWZmIC11IC1yMS43
OSB1Z2VuLmMNCi0tLSBzeXMvZGV2L3VzYi91Z2VuLmMJMSBNYXIgMjAwNiAx
MjozODoxMyAtMDAwMAkxLjc5DQorKysgc3lzL2Rldi91c2IvdWdlbi5jCTIx
IE1hciAyMDA2IDIwOjQ5OjM3IC0wMDAwDQpAQCAtMTMwMCwxMCArMTMwMCwx
NiBAQA0KIAkJCWZyZWUocHRyLCBNX1RFTVApOw0KIAkJcmV0dXJuIChlcnJv
cik7DQogCX0NCisNCiAJY2FzZSBVU0JfR0VUX0RFVklDRUlORk86DQogCQl1
c2JkX2ZpbGxfZGV2aWNlaW5mbyhzYy0+c2NfdWRldiwNCiAJCQkJICAgICAo
c3RydWN0IHVzYl9kZXZpY2VfaW5mbyAqKWFkZHIsIDEpOw0KIAkJYnJlYWs7
DQorCWNhc2UgVVNCX0dFVF9ERVZJQ0VJTkZPX09MRDoNCisJCXVzYmRfZmls
bF9kZXZpY2VpbmZvX29sZChzYy0+c2NfdWRldiwNCisJCQkJCSAoc3RydWN0
IHVzYl9kZXZpY2VfaW5mb19vbGQgKilhZGRyLCAxKTsNCisNCisJCWJyZWFr
Ow0KIAlkZWZhdWx0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