From: Paul Kasemir Date: Sat, 14 Nov 2020 06:23:13 +0000 (-0700) Subject: link-mso19: Update files to match new driver templates better X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=71cd1938f9815f9eed41d80dd1d2eb0fef099a5a;p=libsigrok.git link-mso19: Update files to match new driver templates better --- diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index dd3ff3c8..1209c64f 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -4,6 +4,7 @@ * Copyright (C) 2011 Daniel Ribeiro * Copyright (C) 2012 Renato Caldas * Copyright (C) 2013 Lior Elazary + * Copyright (C) 2022 Paul Kasemir * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -206,7 +207,7 @@ static int dev_open(struct sr_dev_inst *sdi) return SR_OK; } -static int config_get(int key, GVariant **data, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -229,7 +230,7 @@ static int config_get(int key, GVariant **data, return SR_OK; } -static int config_set(int key, GVariant *data, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; @@ -279,7 +280,7 @@ static int config_set(int key, GVariant *data, return SR_OK; } -static int config_list(int key, GVariant **data, +static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { switch (key) { diff --git a/src/hardware/link-mso19/protocol.c b/src/hardware/link-mso19/protocol.c index 8721ec2b..f3e624eb 100644 --- a/src/hardware/link-mso19/protocol.c +++ b/src/hardware/link-mso19/protocol.c @@ -4,6 +4,7 @@ * Copyright (C) 2011 Daniel Ribeiro * Copyright (C) 2012 Renato Caldas * Copyright (C) 2013 Lior Elazary + * Copyright (C) 2022 Paul Kasemir * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -349,15 +350,25 @@ SR_PRIV int mso_receive_data(int fd, int revents, void *cb_data) { struct sr_datafeed_packet packet; struct sr_datafeed_logic logic; - struct sr_dev_inst *sdi = cb_data; - struct dev_context *devc = sdi->priv; + struct sr_dev_inst *sdi; + struct dev_context *devc; int i; + uint8_t in[1024]; + size_t s; + + (void)fd; (void)revents; - uint8_t in[1024]; - size_t s = serial_read(devc->serial, in, sizeof(in)); + sdi = cb_data; + if (!sdi) + return TRUE; + + devc = sdi->priv; + if (!devc) + return TRUE; + s = serial_read(devc->serial, in, sizeof(in)); if (s <= 0) return FALSE; diff --git a/src/hardware/link-mso19/protocol.h b/src/hardware/link-mso19/protocol.h index d6eb872b..f3e7b285 100644 --- a/src/hardware/link-mso19/protocol.h +++ b/src/hardware/link-mso19/protocol.h @@ -4,6 +4,7 @@ * Copyright (C) 2011 Daniel Ribeiro * Copyright (C) 2012 Renato Caldas * Copyright (C) 2013 Lior Elazary + * Copyright (C) 2022 Paul Kasemir * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by