am7xxx: track the context in am7xxx_device
authorAntonio Ospite <ospite@studenti.unina.it>
Tue, 28 Feb 2012 21:37:06 +0000 (22:37 +0100)
committerAntonio Ospite <ospite@studenti.unina.it>
Wed, 29 Feb 2012 22:45:18 +0000 (23:45 +0100)
This will be used to retrieve the context in functions operating on
devices, in order to use the log calls which are going to be added.

src/am7xxx.c

index 1ece881..20b0ddf 100644 (file)
@@ -55,6 +55,7 @@ static struct am7xxx_usb_device_descriptor supported_devices[] = {
 struct _am7xxx_device {
        libusb_device_handle *usb_device;
        uint8_t buffer[AM7XXX_HEADER_WIRE_SIZE];
 struct _am7xxx_device {
        libusb_device_handle *usb_device;
        uint8_t buffer[AM7XXX_HEADER_WIRE_SIZE];
+       am7xxx_context *ctx;
        am7xxx_device *next;
 };
 
        am7xxx_device *next;
 };
 
@@ -340,6 +341,8 @@ static am7xxx_device *add_new_device(am7xxx_context *ctx)
        }
        memset(new_device, 0, sizeof(*new_device));
 
        }
        memset(new_device, 0, sizeof(*new_device));
 
+       new_device->ctx = ctx;
+
        if (*devices_list == NULL) {
                *devices_list = new_device;
        } else {
        if (*devices_list == NULL) {
                *devices_list = new_device;
        } else {