[libvirt] [PATCH v2 1/3] usb: create functions to search usb device accurately

Guannan Ren gren at redhat.com
Thu May 3 08:31:04 UTC 2012


On 05/03/2012 01:17 AM, Osier Yang wrote:
> On 2012年05月01日 16:16, Guannan Ren wrote:
>> usbFindDevice():get usb device according to
>>                  idVendor, idProduct, bus, device
>>                  it is the most strict search
>>
>> usbFindDevByBus():get usb device according to bus, device
>
> Should we name it as usbFindDevByAddress? Given that both 'bus'
> and 'device' are used to find the device actually.


     the term 'address' for usb device is used by kernel
     maybe not a good name.

     The codes has been changed according to the following comments


>
>>   {
>>       DIR *dir = NULL;
>> -    int ret = -1, found = 0;
>> +    int found = 0;
>>       char *ignore = NULL;
>>       struct dirent *de;
>> +    usbDeviceList *list = NULL, *ret = NULL;
>> +    usbDevice *usb;
>> +
>> +    if (!(list = usbDeviceListNew()))
>
> virReportOOMError();


          usbDeviceListNew has raised OOM Error in that case.

          Guannan Ren




More information about the libvir-list mailing list