From: Pawel Szewczyk Date: Mon, 28 Sep 2015 11:33:35 +0000 (+0200) Subject: include: Add libhusb_internal.h X-Git-Tag: submit/tizen_common/20160317.155115~33 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f88231fecc84869b5d69a95758b1e157d86a42ea;p=platform%2Fcore%2Fapi%2Fusb-host.git include: Add libhusb_internal.h For convenience of testing, internal data structures are moved to separate header. They are still used only internally, but can be included in tests as well. Change-Id: I419f155cd5c5251a716f3b8e430074309664a2e5 Signed-off-by: Pawel Szewczyk --- diff --git a/include/libhusb_internal.h b/include/libhusb_internal.h new file mode 100644 index 0000000..92cfb5f --- /dev/null +++ b/include/libhusb_internal.h @@ -0,0 +1,41 @@ +/* + * libhusb_internal.h + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "libhusb.h" +#include "uref.h" +#include "common.h" +#include "log.h" +#include + +#define MAX_NMB_OF_CONFIGS 255 + +struct libhusb_context { + libusb_context *lusb_ctx; +}; + +struct libhusb_device { + struct uref ref; + libusb_device *lusb_dev; + int refcnt; +}; + +struct libhusb_device_handle { + struct libhusb_device *device; + struct libusb_device_handle *lusb_dev_handle; + /* TODO: replace with bit fields */ + unsigned char driver_detached[MAX_NMB_OF_CONFIGS]; +}; diff --git a/src/libhusb.c b/src/libhusb.c index 51b075c..06443c1 100644 --- a/src/libhusb.c +++ b/src/libhusb.c @@ -28,30 +28,13 @@ #include "common.h" #include "log.h" -#define MAX_NMB_OF_CONFIGS 255 - -struct libhusb_context { - libusb_context *lusb_ctx; -}; - -struct libhusb_device { - struct uref ref; - libusb_device *lusb_dev; - int refcnt; -}; +#include "libhusb_internal.h" static inline struct libhusb_device *to_libhusb_device(struct uref *_uref) { return container_of(_uref, struct libhusb_device, ref); } -struct libhusb_device_handle { - struct libhusb_device *device; - struct libusb_device_handle *lusb_dev_handle; - /* TODO: replace with bit fields */ - unsigned char driver_detached[MAX_NMB_OF_CONFIGS]; -}; - static int translate_error(int error_code) { switch (error_code) {