X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=session_driver.c;h=fa1b9065dac8c381744a97cff728b0127bd8fcef;hb=120b259ea8f17b74deca3ba4b71e78771539bde8;hp=bbd5a61572bfa3da3b25df3af52360988d2fccfd;hpb=7d6588743503514c9de5c4fc8a511e9b0bdad7e6;p=libsigrok.git diff --git a/session_driver.c b/session_driver.c index bbd5a615..fa1b9065 100644 --- a/session_driver.c +++ b/session_driver.c @@ -90,7 +90,7 @@ static int feed_chunk(int fd, int revents, void *user_data) packet.length = ret; packet.unitsize = vdevice->unitsize; packet.payload = buf; - session_bus(user_data, &packet); + sr_session_bus(user_data, &packet); } else { /* done with this capture file */ zip_fclose(vdevice->capfile); @@ -103,7 +103,7 @@ static int feed_chunk(int fd, int revents, void *user_data) if (!got_data) { packet.type = SR_DF_END; packet.length = 0; - session_bus(user_data, &packet); + sr_session_bus(user_data, &packet); } return TRUE; @@ -111,7 +111,7 @@ static int feed_chunk(int fd, int revents, void *user_data) /* driver callbacks */ -static int hw_init(char *deviceinfo) +static int hw_init(const char *deviceinfo) { sessionfile = g_strdup(deviceinfo); @@ -146,19 +146,14 @@ static int hw_opendev(int device_index) return SR_OK; } -static void hw_closedev(int device_index) -{ - - /* avoid compiler warning */ - device_index = device_index; - -} - static void *hw_get_device_info(int device_index, int device_info_id) { struct session_vdevice *vdevice; void *info; + if (device_info_id != SR_DI_CUR_SAMPLERATE) + return NULL; + if (!(vdevice = get_vdevice_by_index(device_index))) return NULL; @@ -252,7 +247,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) } /* freewheeling source */ - session_source_add(-1, 0, 0, feed_chunk, session_device_id); + sr_session_source_add(-1, 0, 0, feed_chunk, session_device_id); /* Send header packet to the session bus. */ packet = g_malloc(sizeof(struct sr_datafeed_packet)); @@ -268,26 +263,13 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) header->protocol_id = SR_PROTO_RAW; header->num_logic_probes = vdevice->num_probes; header->num_analog_probes = 0; - session_bus(session_device_id, packet); + sr_session_bus(session_device_id, packet); g_free(header); g_free(packet); return SR_OK; } -static void hw_stop_acquisition(int device_index, gpointer session_device_id) -{ - struct session_vdevice *vdevice; - - /* avoid compiler warning */ - session_device_id = session_device_id; - -// vdevice = get_vdevice_by_index(device_index); -// zip_fclose(vdevice->capfile); -// zip_close(vdevice->archive); - -} - struct sr_device_plugin session_driver = { "session", @@ -296,11 +278,11 @@ struct sr_device_plugin session_driver = { hw_init, hw_cleanup, hw_opendev, - hw_closedev, + NULL, hw_get_device_info, hw_get_status, hw_get_capabilities, hw_set_configuration, hw_start_acquisition, - hw_stop_acquisition, + NULL, };