* Add a AlternateAt() method to the BUSBInterface class that can retrieve the

usb_interface_descriptor of an alternate interface without having to switch
  to it.
* Add some reserve bytes to all classes and add some reserved virtual slots
  where the objects are publically constructable.
* Remove the source compatibilty defines that were briding the old USB* with
  the new BUSB* class names.
* Implement the usb_raw side of getting an alternate interface descriptor.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24842 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2008-04-06 19:59:24 +00:00
parent d7aa5bb89c
commit 5aa70ae110
4 changed files with 89 additions and 12 deletions
+37 -12
View File
@@ -11,14 +11,6 @@
#include <USB_spec.h>
// Keep compatibility with original USBKit classes
#define USBRoster BUSBRoster
#define USBDevice BUSBDevice
#define USBConfiguration BUSBConfiguration
#define USBInterface BUSBInterface
#define USBEndpoint BUSBEndpoint
class BUSBRoster;
class BUSBDevice;
class BUSBConfiguration;
@@ -54,7 +46,14 @@ virtual void DeviceRemoved(BUSBDevice *device) = 0;
void Stop();
private:
virtual void _ReservedUSBRoster1();
virtual void _ReservedUSBRoster2();
virtual void _ReservedUSBRoster3();
virtual void _ReservedUSBRoster4();
virtual void _ReservedUSBRoster5();
void *fLooper;
uint32 fReserved[10];
};
@@ -138,6 +137,12 @@ virtual status_t InitCheck();
void *data) const;
private:
virtual void _ReservedUSBDevice1();
virtual void _ReservedUSBDevice2();
virtual void _ReservedUSBDevice3();
virtual void _ReservedUSBDevice4();
virtual void _ReservedUSBDevice5();
char *fPath;
int fRawFD;
@@ -148,6 +153,8 @@ private:
mutable char *fManufacturerString;
mutable char *fProductString;
mutable char *fSerialNumberString;
uint32 fReserved[10];
};
@@ -195,6 +202,8 @@ friend class BUSBDevice;
BUSBInterface **fInterfaces;
mutable char *fConfigurationString;
uint32 fReserved[10];
};
@@ -238,14 +247,26 @@ public:
const BUSBEndpoint *EndpointAt(uint32 index) const;
// Using CountAlternates() you can retrieve the number of alternate
// interfaces at this interface index. Note that this interface itself
// interfaces for this interface. Note that this interface itself
// counts as an alternate so an alternate count of one really means
// that you are currently using the sole interface present.
// AlternateAt() returns the interface descriptor of the alternate
// interface with the specified index. Using that you can peek at the
// information contained in the descriptor without having to switch
// to this alternate interface. Note that the alternate index set in
// the interface descriptor returned is not necessarily the same index
// you used to get the descriptor. Always use the zero based index you
// used to get the information with and not the values of the returned
// descriptor as the stack will handle that translation internally.
// The interface descriptor returned was allocated by new and is yours.
// You need to delete it when you're done with it.
// With SetAlternate() you can switch this BUSBInterface object to the
// alternate at the specified index. Note that all endpoints retrieved
// through EndpointAt() will become invalid and be deleted as soon as
// you set an alternate.
// alternate interface at the specified index. Note that all endpoints
// retrieved through EndpointAt() will become invalid and will be
// deleted as soon as you set an alternate interface (even if the
// resulting interface is the same you were using before).
uint32 CountAlternates() const;
usb_interface_descriptor *AlternateAt(uint32 alternateIndex);
status_t SetAlternate(uint32 alternateIndex);
private:
@@ -264,6 +285,8 @@ friend class BUSBConfiguration;
BUSBEndpoint **fEndpoints;
mutable char *fInterfaceString;
uint32 fReserved[10];
};
@@ -331,6 +354,8 @@ friend class BUSBInterface;
int fRawFD;
usb_endpoint_descriptor fDescriptor;
uint32 fReserved[10];
};
#endif