[Nut-upsdev] usb_device_id_t structure

Arjen de Korte nut+devel at de-korte.org
Wed Nov 19 08:16:02 UTC 2008


Arnaud,

I have a question regarding the below structure you've added:

> typedef struct usb_device_id_t {
> 	int vendorID;
> 	int productID;
> 	void*(*fun)();		/* handler for specific processing */
> } usb_device_id;

I don't understand the last element in this structure. While there can  
be plenty of reasons for functions returning (void *), I can't figure  
out what use this could possibly have here.

Since this structure is supposed to be used as input to  
is_usb_device_supported() and that function returns an (int), what can  
we possibly do with the return value of (void *)(*fun)()? Using that,  
would require casting the (void *) pointer to something useful, but  
how would we tell this to is_usb_device_supported()? Could it be you  
actually meant (void)(*fun)(), ie a function that doesn't take  
parameters and returns nothing?

Best regards, Arjen
-- 
Please keep list traffic on the list



More information about the Nut-upsdev mailing list