diff options
author | Richard Hughes <richard@hughsie.com> | 2015-01-05 15:59:36 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-01-05 15:59:36 +0000 |
commit | 97842d0d8955e5e3e6179683b04dfd212d671bd6 (patch) | |
tree | c8cac78c954a76621de4f7c3a4f13578bdfc3923 /gusb/gusb-device.c | |
parent | c82ad302b129c50c60df633e7a9c6909d11b2d1c (diff) | |
download | gusb-97842d0d8955e5e3e6179683b04dfd212d671bd6.tar.gz |
device: Add g_usb_device_get_vid_as_str()
Diffstat (limited to 'gusb/gusb-device.c')
-rw-r--r-- | gusb/gusb-device.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gusb/gusb-device.c b/gusb/gusb-device.c index 62d48b0..3814b14 100644 --- a/gusb/gusb-device.c +++ b/gusb/gusb-device.c @@ -34,6 +34,7 @@ #include <libusb-1.0/libusb.h> #include "gusb-context.h" +#include "gusb-context-private.h" #include "gusb-util.h" #include "gusb-device.h" #include "gusb-device-private.h" @@ -1440,6 +1441,45 @@ g_usb_device_get_pid (GUsbDevice *device) } /** + * g_usb_device_get_vid_as_str: + * @device: a #GUsbDevice + * + * Gets the vendor ID for the device as a string. + * + * Return value: an string ID, or %NULL if not available. + * + * Since: 0.2.4 + **/ +const gchar * +g_usb_device_get_vid_as_str (GUsbDevice *device) +{ + g_return_val_if_fail (G_USB_IS_DEVICE (device), NULL); + return _g_usb_context_lookup_vendor (device->priv->context, + device->priv->desc.idVendor, + NULL); +} + +/** + * g_usb_device_get_pid_as_str: + * @device: a #GUsbDevice + * + * Gets the product ID for the device as a string. + * + * Return value: an string ID, or %NULL if not available. + * + * Since: 0.2.4 + **/ +const gchar * +g_usb_device_get_pid_as_str (GUsbDevice *device) +{ + g_return_val_if_fail (G_USB_IS_DEVICE (device), NULL); + return _g_usb_context_lookup_product (device->priv->context, + device->priv->desc.idVendor, + device->priv->desc.idProduct, + NULL); +} + +/** * g_usb_device_get_manufacturer_index: * @device: a #GUsbDevice * |