]>
Commit | Line | Data |
---|---|---|
6e8d31d4 UH |
1 | /* |
2 | * This file is part of the libsigrok project. | |
3 | * | |
4 | * Copyright (C) 2015 Uwe Hermann <uwe@hermann-uwe.de> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
21 | #include <config.h> | |
22 | #include "protocol.h" | |
23 | ||
24 | SR_PRIV struct sr_dev_driver arachnid_labs_re_load_pro_driver_info; | |
25 | ||
26 | static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx) | |
27 | { | |
28 | return std_init(sr_ctx, di, LOG_PREFIX); | |
29 | } | |
30 | ||
31 | static GSList *scan(struct sr_dev_driver *di, GSList *options) | |
32 | { | |
33 | struct drv_context *drvc; | |
34 | GSList *devices; | |
35 | ||
36 | (void)options; | |
37 | ||
38 | devices = NULL; | |
39 | drvc = di->context; | |
40 | drvc->instances = NULL; | |
41 | ||
42 | return devices; | |
43 | } | |
44 | ||
45 | static GSList *dev_list(const struct sr_dev_driver *di) | |
46 | { | |
47 | return ((struct drv_context *)(di->context))->instances; | |
48 | } | |
49 | ||
50 | static int dev_clear(const struct sr_dev_driver *di) | |
51 | { | |
52 | return std_dev_clear(di, NULL); | |
53 | } | |
54 | ||
55 | static int dev_open(struct sr_dev_inst *sdi) | |
56 | { | |
57 | (void)sdi; | |
58 | ||
59 | sdi->status = SR_ST_ACTIVE; | |
60 | ||
61 | return SR_OK; | |
62 | } | |
63 | ||
64 | static int dev_close(struct sr_dev_inst *sdi) | |
65 | { | |
66 | (void)sdi; | |
67 | ||
68 | sdi->status = SR_ST_INACTIVE; | |
69 | ||
70 | return SR_OK; | |
71 | } | |
72 | ||
73 | static int cleanup(const struct sr_dev_driver *di) | |
74 | { | |
75 | return dev_clear(di); | |
76 | } | |
77 | ||
78 | static int config_get(uint32_t key, GVariant **data, | |
79 | const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) | |
80 | { | |
81 | int ret; | |
82 | ||
83 | (void)sdi; | |
84 | (void)data; | |
85 | (void)cg; | |
86 | ||
87 | ret = SR_OK; | |
88 | switch (key) { | |
89 | default: | |
90 | return SR_ERR_NA; | |
91 | } | |
92 | ||
93 | return ret; | |
94 | } | |
95 | ||
96 | static int config_set(uint32_t key, GVariant *data, | |
97 | const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) | |
98 | { | |
99 | int ret; | |
100 | ||
101 | (void)data; | |
102 | (void)cg; | |
103 | ||
104 | if (sdi->status != SR_ST_ACTIVE) | |
105 | return SR_ERR_DEV_CLOSED; | |
106 | ||
107 | ret = SR_OK; | |
108 | switch (key) { | |
109 | default: | |
110 | ret = SR_ERR_NA; | |
111 | } | |
112 | ||
113 | return ret; | |
114 | } | |
115 | ||
116 | static int config_list(uint32_t key, GVariant **data, | |
117 | const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) | |
118 | { | |
119 | int ret; | |
120 | ||
121 | (void)sdi; | |
122 | (void)data; | |
123 | (void)cg; | |
124 | ||
125 | ret = SR_OK; | |
126 | switch (key) { | |
127 | default: | |
128 | return SR_ERR_NA; | |
129 | } | |
130 | ||
131 | return ret; | |
132 | } | |
133 | ||
134 | static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) | |
135 | { | |
136 | (void)sdi; | |
137 | (void)cb_data; | |
138 | ||
139 | if (sdi->status != SR_ST_ACTIVE) | |
140 | return SR_ERR_DEV_CLOSED; | |
141 | ||
142 | return SR_OK; | |
143 | } | |
144 | ||
145 | static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) | |
146 | { | |
147 | (void)cb_data; | |
148 | ||
149 | if (sdi->status != SR_ST_ACTIVE) | |
150 | return SR_ERR_DEV_CLOSED; | |
151 | ||
152 | return SR_OK; | |
153 | } | |
154 | ||
155 | SR_PRIV struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = { | |
156 | .name = "arachnid-labs-re-load-pro", | |
157 | .longname = "Arachnid Labs Re:load Pro", | |
158 | .api_version = 1, | |
159 | .init = init, | |
160 | .cleanup = cleanup, | |
161 | .scan = scan, | |
162 | .dev_list = dev_list, | |
163 | .dev_clear = dev_clear, | |
164 | .config_get = config_get, | |
165 | .config_set = config_set, | |
166 | .config_list = config_list, | |
167 | .dev_open = dev_open, | |
168 | .dev_close = dev_close, | |
169 | .dev_acquisition_start = dev_acquisition_start, | |
170 | .dev_acquisition_stop = dev_acquisition_stop, | |
171 | .context = NULL, | |
172 | }; |