bsd.c

Go to the documentation of this file.
00001 
00004 #define HID_INTERNAL
00005 
00006 #include <hid.h>
00007 #include <os.h>
00008 
00009 #include <debug.h>
00010 #include <assert.h>
00011 
00012 hid_return hid_os_force_claim(HIDInterface* const hidif, int const interface,
00013     HIDInterfaceMatcher const* const matcher, unsigned short retries)
00014 {
00015   retries = retries;
00016   
00017   if (!hidif) {
00018     ERROR("cannot open NULL HIDInterface.");
00019     return HID_RET_INVALID_PARAMETER;
00020   }
00021 
00022   if (!hid_is_opened(hidif)) {
00023     ERROR("cannot force claim interface of unopened HIDInterface.");
00024     return HID_RET_DEVICE_ALREADY_OPENED;
00025   }
00026 
00027   if (!matcher) {
00028     ERROR("cannot match against NULL HIDInterfaceMatcher.");
00029     return HID_RET_INVALID_PARAMETER;
00030   }
00031 
00032   WARNING("code not tested on the BSD platform!");
00033   TRACE("claiming USB device %s...", hidif->id);
00034   if (usb_claim_interface(hidif->dev_handle, interface) < 0) {
00035     WARNING("failed to claim USB device %s...", hidif->id);
00036     return HID_RET_FAIL_CLAIM_IFACE;
00037   }
00038   return HID_RET_SUCCESS;
00039 }
00040 
00041 /* COPYRIGHT --
00042  *
00043  * This file is part of libhid, a user-space HID access library.
00044  * libhid is (c) 2003-2005
00045  *   Martin F. Krafft <libhid@pobox.madduck.net>
00046  *   Charles Lepple <clepple@ghz.cc>
00047  *   Arnaud Quette <arnaud.quette@free.fr> && <arnaud.quette@mgeups.com>
00048  * and distributed under the terms of the GNU General Public License.
00049  * See the file ./COPYING in the source distribution for more information.
00050  *
00051  * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
00052  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES
00053  * OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00054  */

Generated on Sun Mar 30 15:28:24 2008 for libhid by  doxygen 1.5.1