* Implemented setting an alternate interface through the USBKit library based

on a patch by Salvatore Benedetto, adapted to the usb_raw interface by me
* Added two convenience functions IsStalled() and ClearStall() to USBEndpoint

Both changes are actually untested, so if you have a use for them and encounter
problems please shout.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24837 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2008-04-06 16:22:59 +00:00
parent c2234e0598
commit a43222b925
3 changed files with 101 additions and 17 deletions
+19 -4
View File
@@ -1,9 +1,6 @@
/*
* Copyright 2007, Haiku Inc. All rights reserved.
* Copyright 2007-2008, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Michael Lotz <[email protected]>
*/
#ifndef _USBKIT_H
@@ -240,12 +237,25 @@ public:
uint32 CountEndpoints() const;
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
// counts as an alternate so an alternate count of one really means
// that you are currently using the sole interface present.
// 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.
uint32 CountAlternates() const;
status_t SetAlternate(uint32 alternateIndex);
private:
friend class BUSBConfiguration;
BUSBInterface(BUSBConfiguration *config,
uint32 index, int rawFD);
~BUSBInterface();
void _UpdateDescriptorAndEndpoints();
BUSBConfiguration *fConfiguration;
uint32 fIndex;
int fRawFD;
@@ -305,6 +315,11 @@ public:
usb_iso_packet_descriptor *packetDescriptors,
uint32 packetCount) const;
// These are convenience methods for getting and clearing the halt
// state of an endpoint. They use the control pipe of the device to
// send the corresponding requests.
bool IsStalled() const;
status_t ClearStall() const;
private:
friend class BUSBInterface;
BUSBEndpoint(BUSBInterface *interface,