Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

get usb device descriptor through ioctl?


I don't know if I'm on the right ML, if not please tell me.
My problem: I'm on the NetBSD-daily of 2 feb (I upgrade every month)
and I'm trying to make a fork of dfu-util because this application
can't find dfu device on -current (and maybe on earlier version) but I
have a little problem:
I try to get the device descriptor wih ioctl just like in the man
ugen(4) but I only get an "Invalid Argument" error. the only think
which work is the USB_DEVICEINFO from man usb(4) but I don't know how
to get device descriptor from it (trying to open udi_devnames[0] lead
to another error: "File not found") and doing an sh MAKEDEV with the
value of udi_devnames[0] throw the error "unknow device"
So this is my question: how to access udi_devnames[0] with open() to
get the file descriptor to give to ioctl?

this is the faulty code:

devicefd = open(file.c_str(), O_RDWR);
if (devicefd != -1)
 device_info.udi_addr = 2;
 if (ioctl(devicefd, USB_DEVICEINFO, &device_info) != -1)
ÂÂÂ usb_info.push_back(device_info);
 if (ioctl(devicefd, USB_GET_DEVICE_DESC, &device_desc) != -1)
ÂÂÂ dev.push_back(device_desc);

Home | Main Index | Thread Index | Old Index