1 /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 /* 3 Copyright (C) 2012 Red Hat, Inc. 4 5 Red Hat Authors: 6 Arnon Gilboa <agilboa@redhat.com> 7 Uri Lublin <uril@redhat.com> 8 9 This library is free software; you can redistribute it and/or 10 modify it under the terms of the GNU Lesser General Public 11 License as published by the Free Software Foundation; either 12 version 2.1 of the License, or (at your option) any later version. 13 14 This library is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 Lesser General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public 20 License along with this library; if not, see <http://www.gnu.org/licenses/>. 21 */ 22 #ifndef __WIN_USB_DEV_H__ 23 #define __WIN_USB_DEV_H__ 24 25 #include <gio/gio.h> 26 27 G_BEGIN_DECLS 28 29 /* GUdevClient */ 30 31 #define G_UDEV_TYPE_CLIENT (g_udev_client_get_type()) 32 #define G_UDEV_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), G_UDEV_TYPE_CLIENT, GUdevClient)) 33 #define G_UDEV_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_CLIENT, GUdevClientClass)) 34 #define G_UDEV_IS_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), G_UDEV_TYPE_CLIENT)) 35 #define G_UDEV_IS_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), G_UDEV_TYPE_CLIENT)) 36 #define G_UDEV_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), G_UDEV_TYPE_CLIENT, GUdevClientClass)) 37 38 typedef struct _GUdevClient GUdevClient; 39 typedef struct _GUdevClientClass GUdevClientClass; 40 typedef struct _GUdevClientPrivate GUdevClientPrivate; 41 42 struct _GUdevClient 43 { 44 GObject parent; 45 46 GUdevClientPrivate *priv; 47 }; 48 49 struct _GUdevClientClass 50 { 51 GObjectClass parent_class; 52 53 /* signals */ 54 void (*uevent)(GUdevClient *client, libusb_device *device, gboolean add); 55 }; 56 57 GType g_udev_client_get_type(void) G_GNUC_CONST; 58 GUdevClient *g_udev_client_new(void); 59 libusb_context *g_udev_client_get_context(GUdevClient *client); 60 void g_udev_client_report_devices(GUdevClient *client); 61 62 GQuark g_udev_client_error_quark(void); 63 #define G_UDEV_CLIENT_ERROR g_udev_client_error_quark() 64 65 /** 66 * GUdevClientError: 67 * @G_UDEV_CLIENT_ERROR_FAILED: generic error code 68 * @G_UDEV_CLIENT_LIBUSB_FAILED: a libusb call failed 69 * @G_UDEV_CLIENT_WINAPI_FAILED: a winapi call failed 70 * 71 * Error codes returned by spice-client API. 72 */ 73 typedef enum 74 { 75 G_UDEV_CLIENT_ERROR_FAILED = 1, 76 G_UDEV_CLIENT_LIBUSB_FAILED, 77 G_UDEV_CLIENT_WINAPI_FAILED 78 } GUdevClientError; 79 80 81 G_END_DECLS 82 83 #endif /* __WIN_USB_DEV_H__ */ 84