|
| 1 | +/* |
| 2 | + * pcsensor.c by Michitaka Ohno (c) 2011 ([email protected]) |
| 3 | + * based oc pcsensor.c by Juan Carlos Perez (c) 2011 ([email protected]) |
| 4 | + * based on Temper.c by Robert Kavaler (c) 2009 (relavak.com) |
| 5 | + * All rights reserved. |
| 6 | + * |
| 7 | + * Redistribution and use in source and binary forms, with or without |
| 8 | + * modification, are permitted provided that the following conditions are met: |
| 9 | + * * Redistributions of source code must retain the above copyright |
| 10 | + * notice, this list of conditions and the following disclaimer. |
| 11 | + * |
| 12 | + * THIS SOFTWARE IS PROVIDED BY Juan Carlos Perez ''AS IS'' AND ANY |
| 13 | + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 14 | + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 15 | + * DISCLAIMED. IN NO EVENT SHALL Robert kavaler BE LIABLE FOR ANY |
| 16 | + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 17 | + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 18 | + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 19 | + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 20 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 21 | + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 22 | + * |
| 23 | + */ |
| 24 | + |
| 25 | +#include <usb.h> |
| 26 | +#include <stdio.h> |
| 27 | + |
| 28 | +#include <string.h> |
| 29 | +#include <errno.h> |
| 30 | +#include <float.h> |
| 31 | + |
| 32 | +static int device_type(usb_dev_handle *lvr_winusb); |
| 33 | + |
| 34 | +static int usb_detach(usb_dev_handle *lvr_winusb, int iInterface); |
| 35 | + |
| 36 | +static usb_dev_handle *find_lvr_winusb(); |
| 37 | + |
| 38 | +static usb_dev_handle* setup_libusb_access(); |
| 39 | + |
| 40 | +static int ini_control_transfer(usb_dev_handle *dev); |
| 41 | + |
| 42 | +static int control_transfer(usb_dev_handle *dev, const char *pquestion); |
| 43 | + |
| 44 | +static int interrupt_read(usb_dev_handle *dev); |
| 45 | + |
| 46 | +static int interrupt_read_temperatura(usb_dev_handle *dev, float *tempC); |
| 47 | + |
| 48 | +static int get_data(usb_dev_handle *dev, char *buf, int len); |
| 49 | + |
| 50 | +static int get_temperature(usb_dev_handle *dev, float *tempC); |
| 51 | + |
| 52 | +usb_dev_handle* pcsensor_open(); |
| 53 | + |
| 54 | +void pcsensor_close(usb_dev_handle* lvr_winusb); |
| 55 | + |
| 56 | +float pcsensor_get_temperature(usb_dev_handle* lvr_winusb); |
| 57 | + |
0 commit comments