/* save a pointer to our private instance data */
sdi->priv = mso;
- sdi->serial = serial_device_instance_new(path, -1);
+ sdi->serial = sr_serial_device_instance_new(path, -1);
if (!sdi->serial)
goto err_device_instance_free;
0,
};
-/* List of struct serial_device_instance */
+/* List of struct sr_serial_device_instance */
static GSList *device_instances = NULL;
/* Current state of the flag register */
(final_devcnt, ST_INACTIVE,
"Openbench", "Logic Sniffer",
"v1.0");
- sdi->serial = serial_device_instance_new
+ sdi->serial = sr_serial_device_instance_new
(device_names[i], -1);
device_instances =
g_slist_append(device_instances, sdi);
g_warning("firmware upload failed for "
"device %d", devcnt);
- sdi->usb = usb_device_instance_new
+ sdi->usb = sr_usb_device_instance_new
(libusb_get_bus_number(devlist[i]), 0, NULL);
} else {
/* Already has the firmware, so fix the new address. */
- sdi->usb = usb_device_instance_new
+ sdi->usb = sr_usb_device_instance_new
(libusb_get_bus_number(devlist[i]),
libusb_get_device_address(devlist[i]), NULL);
}
return 0;
device_instances =
g_slist_append(device_instances, sdi);
- sdi->usb = usb_device_instance_new(
+ sdi->usb = sr_usb_device_instance_new(
libusb_get_bus_number(devlist[i]),
libusb_get_device_address(devlist[i]), NULL);
devcnt++;
{
switch (sdi->instance_type) {
case USB_INSTANCE:
- usb_device_instance_free(sdi->usb);
+ sr_usb_device_instance_free(sdi->usb);
break;
case SERIAL_INSTANCE:
- serial_device_instance_free(sdi->serial);
+ sr_serial_device_instance_free(sdi->serial);
break;
default:
/* No specific type, nothing extra to free. */
free(sdi);
}
-struct usb_device_instance *usb_device_instance_new(uint8_t bus,
+struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
uint8_t address, struct libusb_device_handle *hdl)
{
- struct usb_device_instance *udi;
+ struct sr_usb_device_instance *udi;
- if (!(udi = malloc(sizeof(struct usb_device_instance))))
+ if (!(udi = malloc(sizeof(struct sr_usb_device_instance))))
return NULL;
udi->bus = bus;
return udi;
}
-void usb_device_instance_free(struct usb_device_instance *usb)
+void sr_usb_device_instance_free(struct sr_usb_device_instance *usb)
{
/* Avoid compiler warnings. */
usb = usb;
/* Nothing to do for this device instance type. */
}
-struct serial_device_instance *serial_device_instance_new(
+struct sr_serial_device_instance *sr_serial_device_instance_new(
const char *port, int fd)
{
- struct serial_device_instance *serial;
+ struct sr_serial_device_instance *serial;
- if (!(serial = malloc(sizeof(struct serial_device_instance))))
+ if (!(serial = malloc(sizeof(struct sr_serial_device_instance))))
return NULL;
serial->port = strdup(port);
return serial;
}
-void serial_device_instance_free(struct serial_device_instance *serial)
+void sr_serial_device_instance_free(struct sr_serial_device_instance *serial)
{
free(serial->port);
}
void sr_device_instance_free(struct sr_device_instance *sdi);
/* USB-specific instances */
-struct usb_device_instance *usb_device_instance_new(uint8_t bus,
+struct sr_usb_device_instance *sr_usb_device_instance_new(uint8_t bus,
uint8_t address, struct libusb_device_handle *hdl);
-void usb_device_instance_free(struct usb_device_instance *usb);
+void sr_usb_device_instance_free(struct sr_usb_device_instance *usb);
/* Serial-specific instances */
-struct serial_device_instance *serial_device_instance_new(
+struct sr_serial_device_instance *sr_serial_device_instance_new(
const char *port, int fd);
-void serial_device_instance_free(struct serial_device_instance *serial);
+void sr_serial_device_instance_free(struct sr_serial_device_instance *serial);
int find_hwcap(int *capabilities, int hwcap);
struct hwcap_option *find_hwcap_option(int hwcap);
char *version;
void *priv;
union {
- struct usb_device_instance *usb;
- struct serial_device_instance *serial;
+ struct sr_usb_device_instance *usb;
+ struct sr_serial_device_instance *serial;
};
};
SERIAL_INSTANCE,
};
-struct usb_device_instance {
+struct sr_usb_device_instance {
uint8_t bus;
uint8_t address;
struct libusb_device_handle *devhdl;
};
-struct serial_device_instance {
+struct sr_serial_device_instance {
char *port;
int fd;
};