cake
/
libcasio
Archived
1
1
Fork 0
This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
libcasio/lib/stream/open_usb.c

43 lines
1.6 KiB
C
Raw Normal View History

2017-06-12 01:06:23 +02:00
/* ****************************************************************************
* stream/open_usb.c -- open a USB stream.
2017-06-12 01:06:23 +02:00
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libcasio.
* libcasio is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libcasio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libcasio; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************* */
#include "stream.h"
2017-06-12 01:06:23 +02:00
/**
2019-04-10 08:08:38 +02:00
* casio_open_native_usb_stream:
2017-06-12 01:06:23 +02:00
* Open the USB stream.
*
* @arg stream the stream to make.
* @arg bus the USB bus on which to find the device.
* -1 if any device on any bus (and address is not read).
* @arg address the address on the bus of the device.
* -1 if any device on the bus.
2017-06-12 01:06:23 +02:00
* @return the error code (0 if ok).
*/
2019-04-10 08:08:38 +02:00
int CASIO_EXPORT casio_open_native_usb_stream(tio_stream_t **streamp,
int bus, int address)
2017-06-12 01:06:23 +02:00
{
if (bus < -1 || bus > 255 || address < -1 || address > 255)
return (casio_error_op);
2019-04-10 08:08:38 +02:00
if (!open_native_usb_stream_func)
2017-06-12 01:06:23 +02:00
return (casio_error_op);
2019-04-10 08:08:38 +02:00
return ((*open_native_usb_stream_func)(streamp, bus, address));
2017-06-12 01:06:23 +02:00
}