/* **************************************************************************** * stream/open_usb.c -- open a USB stream. * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey * * 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 . * ************************************************************************* */ #include "stream.h" /** * casio_open_native_usb_stream: * 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. * @return the error code (0 if ok). */ int CASIO_EXPORT casio_open_native_usb_stream(tio_stream_t **streamp, int bus, int address) { if (bus < -1 || bus > 255 || address < -1 || address > 255) return (casio_error_op); if (!open_native_usb_stream_func) return (casio_error_op); return ((*open_native_usb_stream_func)(streamp, bus, address)); }