]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/kern-scale/api.c
std: Add and use std_dev_clear() where possible.
[libsigrok.git] / src / hardware / kern-scale / api.c
index 1af8362aeb9ebd1673cfe2eebcdcbf10a89ce6f7..7b65a4d67c2f9e0b835c3413cc24fc2c7f736019 100644 (file)
@@ -14,8 +14,7 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <config.h>
@@ -118,9 +117,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->limits, key, data);
@@ -153,9 +149,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        serial = sdi->conn;
 
@@ -174,12 +167,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static int dev_acquisition_stop(struct sr_dev_inst *sdi)
-{
-       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
-                       sdi->conn);
-}
-
 #define SCALE(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, \
                        VALID, PARSE) \
        &((struct scale_info) { \
@@ -191,13 +178,14 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
                        .cleanup = std_cleanup, \
                        .scan = scan, \
                        .dev_list = std_dev_list, \
+                       .dev_clear = std_dev_clear, \
                        .config_get = NULL, \
                        .config_set = config_set, \
                        .config_list = config_list, \
                        .dev_open = std_serial_dev_open, \
                        .dev_close = std_serial_dev_close, \
                        .dev_acquisition_start = dev_acquisition_start, \
-                       .dev_acquisition_stop = dev_acquisition_stop, \
+                       .dev_acquisition_stop = std_serial_dev_acquisition_stop, \
                        .context = NULL, \
                }, \
                VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, \