27 #ifndef __SB_USB_DEVICE_UTILS_H__
28 #define __SB_USB_DEVICE_UTILS_H__
50 #include <nsAutoPtr.h>
75 #define SB_USB_DESCRIPTOR_TYPE_DEVICE 1
76 #define SB_USB_DESCRIPTOR_TYPE_CONFIGURATION 2
77 #define SB_USB_DESCRIPTOR_TYPE_STRING 3
78 #define SB_USB_DESCRIPTOR_TYPE_INTERFACE 4
79 #define SB_USB_DESCRIPTOR_TYPE_ENDPOINT 5
84 #define SB_USB_APPLE_VENDOR_ID 0x05ac
218 PRUnichar bString[1];
258 PRUint16 aDescriptorLength) {
259 mDescriptor = NS_Alloc(aDescriptorLength);
261 mTotalLength = aDescriptorLength;
262 memcpy(mDescriptor, aDescriptor, mTotalLength);
270 if (aDescriptor && (aDescriptor->
bLength > 0))
271 mDescriptor = NS_Alloc(aDescriptor->
bLength);
273 mDescriptor = nsnull;
275 mTotalLength = aDescriptor->
bLength;
276 memcpy(mDescriptor, aDescriptor, mTotalLength);
285 NS_Free(mDescriptor);
331 PRUint16 mTotalLength;
347 PRBool* aImplementsClass);
350 PRUint8 aDescriptorType,
351 PRUint8 aDescriptorIndex,
352 PRUint16 aDescriptorIndex2,
356 PRUint8 aDescriptorIndex,
357 PRUint16 aDescriptorIndex2,
361 nsTArray<PRUint16>& aLanguageList);
365 PRUint8 aConfigurationIndex,
376 PRUint8 aDescriptorType,
377 PRUint8 aDescriptorIndex,
378 PRUint16 aDescriptorIndex2,
379 PRUint16 aDescriptorLength,
383 #endif // __SB_USB_DEVICE_UTILS_H__
sbUSBDescriptor(sbUSBDescriptorHeader *aDescriptor)
nsTArray< nsRefPtr< sbUSBDescriptor > > sbUSBDescriptorList
sbUSBDeviceDescriptor * GetDevice()
nsresult sbUSBDeviceAddConfigurationDescriptors(sbUSBDeviceRef *aDeviceRef, PRUint8 aConfigurationIndex, sbUSBDescriptorList &aDescriptorList)
NS_DECL_ISUPPORTS sbUSBDescriptor(void *aDescriptor, PRUint16 aDescriptorLength)
PRUint8 bNumConfigurations
sbUSBConfigurationDescriptor * GetConfiguration()
sbUSBDescriptorHeader * GetHeader()
nsresult sbUSBDeviceImplementsClass(sbUSBDescriptorList &aDescriptorList, PRUint8 aUSBClass, PRBool *aImplementsClass)
PRUint8 bInterfaceProtocol
PRUint8 bInterfaceSubClass
PRUint16 GetTotalLength()
sbUSBStringDescriptor * GetString()
nsresult sbUSBDeviceGetStringDescriptor(sbUSBDeviceRef *aDeviceRef, PRUint8 aDescriptorIndex, PRUint16 aDescriptorIndex2, nsAString &aString)
virtual ~sbUSBDescriptor()
nsresult sbUSBDeviceGetDescriptor(sbUSBDeviceRef *aDeviceRef, PRUint8 aDescriptorType, PRUint8 aDescriptorIndex, PRUint16 aDescriptorIndex2, sbUSBDescriptor **aDescriptor)
nsresult sbUSBDeviceGetLanguageList(sbUSBDeviceRef *aDeviceRef, nsTArray< PRUint16 > &aLanguageList)
PRUint8 bConfigurationValue
PRUint8 bAlternateSetting