Changes in / [eb1a2f4:3b5d1535] in mainline


Ignore:
Location:
uspace
Files:
3 added
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/pipes.h

    reb1a2f4 r3b5d1535  
    137137int usb_endpoint_pipe_start_session(usb_endpoint_pipe_t *);
    138138int usb_endpoint_pipe_end_session(usb_endpoint_pipe_t *);
     139bool usb_endpoint_pipe_is_session_started(usb_endpoint_pipe_t *);
    139140
    140141int usb_endpoint_pipe_read(usb_endpoint_pipe_t *, void *, size_t, size_t *);
  • uspace/lib/usb/src/pipes.c

    reb1a2f4 r3b5d1535  
    200200        assert(pipe);
    201201
    202         if (pipe->hc_phone >= 0) {
     202        if (usb_endpoint_pipe_is_session_started(pipe)) {
    203203                return EBUSY;
    204204        }
     
    226226        assert(pipe);
    227227
    228         if (pipe->hc_phone < 0) {
     228        if (!usb_endpoint_pipe_is_session_started(pipe)) {
    229229                return ENOENT;
    230230        }
     
    238238
    239239        return EOK;
     240}
     241
     242/** Tell whether a session is started (open) on the endpoint pipe.
     243 *
     244 * The expected usage of this function is in assertions for some
     245 * nested functions.
     246 *
     247 * @param pipe Endpoint pipe in question.
     248 * @return Whether @p pipe has opened a session.
     249 */
     250bool usb_endpoint_pipe_is_session_started(usb_endpoint_pipe_t *pipe)
     251{
     252        return (pipe->hc_phone >= 0);
    240253}
    241254
  • uspace/lib/usb/src/pipesio.c

    reb1a2f4 r3b5d1535  
    148148        }
    149149
    150         if (pipe->hc_phone < 0) {
     150        if (!usb_endpoint_pipe_is_session_started(pipe)) {
    151151                return EBADF;
    152152        }
     
    255255        }
    256256
    257         if (pipe->hc_phone < 0) {
     257        if (!usb_endpoint_pipe_is_session_started(pipe)) {
    258258                return EBADF;
    259259        }
     
    369369        }
    370370
    371         if (pipe->hc_phone < 0) {
     371        if (!usb_endpoint_pipe_is_session_started(pipe)) {
    372372                return EBADF;
    373373        }
     
    481481        }
    482482
    483         if (pipe->hc_phone < 0) {
     483        if (!usb_endpoint_pipe_is_session_started(pipe)) {
    484484                return EBADF;
    485485        }
Note: See TracChangeset for help on using the changeset viewer.