From b60d9cc10a3b4cfd6daaea9c035e247e8d3ae7e4 Mon Sep 17 00:00:00 2001 From: Chris Frey Date: Mon, 19 Jul 2010 23:11:19 -0400 Subject: [PATCH] lib: added ability to do a USB ClearHalt() from socket level --- ChangeLog | 2 ++ src/socket.cc | 24 ++++++++++++++++++++++++ src/socket.h | 6 ++++++ 3 files changed, 32 insertions(+) diff --git a/ChangeLog b/ChangeLog index bb9093fd..ced49134 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ Release: version 0.17 - 2010/01/?? ------------------------------------------------------------------------------ +2010/07/19 + - lib: added ability to do a USB ClearHalt() from socket level 2010/07/17 - lib: added tm_to_iso() to tzwrapper functions - lib: vbase now has default implementation of vTimeConverter (was diff --git a/src/socket.cc b/src/socket.cc index f0b91b82..a0390de5 100644 --- a/src/socket.cc +++ b/src/socket.cc @@ -595,6 +595,25 @@ void SocketZero::Close(Socket &socket) socket.ForceClosed(); } +// +// ClearHalt +// +/// Clears the USB Halt bit on both the read and write endpoints +/// +void SocketZero::ClearHalt() +{ + // clear the read endpoint + if( m_queue ) { + m_dev->ClearHalt(m_queue->GetReadEp()); + } + else { + m_dev->ClearHalt(m_readEp); + } + + // clear the write endpoint + m_dev->ClearHalt(m_writeEp); +} + @@ -716,6 +735,11 @@ void Socket::ReceiveData(Data &receive, int timeout) HideSequencePacket(true); } +void Socket::ClearHalt() +{ + m_zero->ClearHalt(); +} + // FIXME - find a better way to do this? void Socket::InitSequence(int timeout) diff --git a/src/socket.h b/src/socket.h index b1e4fd02..4977698a 100644 --- a/src/socket.h +++ b/src/socket.h @@ -108,6 +108,9 @@ public: // Opens a new socket and returns a Socket object to manage it SocketHandle Open(uint16_t socket, const char *password = 0); void Close(Socket &socket); + + // Lower level USB operations + void ClearHalt(); }; @@ -160,6 +163,9 @@ public: void Receive(Data &receive, int timeout = -1); void ReceiveData(Data &receive, int timeout = -1); + // Lower level USB operations + void ClearHalt(); + // sends the send packet down to the device, fragmenting if // necessary, and returns the response in receive, defragmenting // if needed -- 2.11.4.GIT