* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "protocol.h"
-
+#include <config.h>
#include <string.h>
#include <math.h>
+#include "protocol.h"
extern struct sr_dev_driver uni_t_ut32x_driver_info;
-static struct sr_dev_driver *di = &uni_t_ut32x_driver_info;
static float parse_temperature(unsigned char *buf)
{
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
- struct sr_datafeed_analog analog;
+ struct sr_datafeed_analog_old analog;
GString *spew;
float temp;
int i;
is_valid = FALSE;
if (is_valid) {
- memset(&analog, 0, sizeof(struct sr_datafeed_analog));
+ memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.mq = SR_MQ_TEMPERATURE;
analog.mqflags = 0;
switch (devc->packet[5] - 0x30) {
if (is_valid) {
analog.num_samples = 1;
analog.data = &temp;
- packet.type = SR_DF_ANALOG;
+ packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
g_slist_free(analog.channels);
}
-SR_PRIV void uni_t_ut32x_receive_transfer(struct libusb_transfer *transfer)
+SR_PRIV void LIBUSB_CALL uni_t_ut32x_receive_transfer(struct libusb_transfer *transfer)
{
struct dev_context *devc;
struct sr_dev_inst *sdi;
{
struct drv_context *drvc;
struct dev_context *devc;
+ struct sr_dev_driver *di;
struct sr_dev_inst *sdi;
- struct sr_datafeed_packet packet;
struct sr_usb_dev_inst *usb;
struct timeval tv;
int len, ret;
(void)fd;
(void)revents;
- drvc = di->priv;
-
if (!(sdi = cb_data))
return TRUE;
+ di = sdi->driver;
+ drvc = di->context;
+
if (!(devc = sdi->priv))
return TRUE;
if (sdi->status == SR_ST_STOPPING) {
usb_source_remove(sdi->session, drvc->sr_ctx);
- packet.type = SR_DF_END;
- sr_session_send(cb_data, &packet);
+ std_session_send_df_header(cb_data, LOG_PREFIX);
/* Tell the device to stop sending USB packets. */
usb = sdi->conn;
return TRUE;
}
-