@@ -39,7 +39,7 @@ static const char *hameg_scpi_dialect[] = {
3939 [SCPI_CMD_SET_COUPLING ] = ":CHAN%d:COUP %s" ,
4040 [SCPI_CMD_GET_SAMPLE_RATE ] = ":ACQ:SRAT?" ,
4141 [SCPI_CMD_GET_ANALOG_DATA ] = ":FORM:BORD %s;" \
42- ":FORM REAL,32;:CHAN%d:DATA?" ,
42+ ":FORM REAL,32;:CHAN%d:DATA:POIN MAX;:CHAN%d:DATA ?" ,
4343 [SCPI_CMD_GET_VERTICAL_SCALE ] = ":CHAN%d:SCAL?" ,
4444 [SCPI_CMD_SET_VERTICAL_SCALE ] = ":CHAN%d:SCAL %s" ,
4545 [SCPI_CMD_GET_DIG_POD_STATE ] = ":POD%d:STAT?" ,
@@ -81,7 +81,7 @@ static const char *rohde_schwarz_log_not_pod_scpi_dialect[] = {
8181 [SCPI_CMD_SET_COUPLING ] = ":CHAN%d:COUP %s" ,
8282 [SCPI_CMD_GET_SAMPLE_RATE ] = ":ACQ:SRAT?" ,
8383 [SCPI_CMD_GET_ANALOG_DATA ] = ":FORM:BORD %s;" \
84- ":FORM REAL,32;:CHAN%d:DATA?" ,
84+ ":FORM REAL,32;:CHAN%d:DATA:POIN MAX;:CHAN%d:DATA ?" ,
8585 [SCPI_CMD_GET_VERTICAL_SCALE ] = ":CHAN%d:SCAL?" ,
8686 [SCPI_CMD_SET_VERTICAL_SCALE ] = ":CHAN%d:SCAL %s" ,
8787 [SCPI_CMD_GET_DIG_POD_STATE ] = ":LOG%d:STAT?" ,
@@ -612,6 +612,9 @@ static struct scope_config scope_models[] = {
612612 .num_ydivs = 8 ,
613613
614614 .scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
615+
616+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
617+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT ,
615618 },
616619 {
617620 .name = {"RTB2004" , NULL },
@@ -652,6 +655,9 @@ static struct scope_config scope_models[] = {
652655 .num_ydivs = 8 ,
653656
654657 .scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
658+
659+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
660+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT ,
655661 },
656662 {
657663 .name = {"RTM3002" , NULL },
@@ -692,6 +698,9 @@ static struct scope_config scope_models[] = {
692698 .num_ydivs = 8 ,
693699
694700 .scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
701+
702+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
703+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT ,
695704 },
696705 {
697706 .name = {"RTM3004" , NULL },
@@ -732,6 +741,9 @@ static struct scope_config scope_models[] = {
732741 .num_ydivs = 8 ,
733742
734743 .scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
744+
745+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
746+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT ,
735747 },
736748 {
737749 .name = {"RTA4004" , NULL },
@@ -772,6 +784,9 @@ static struct scope_config scope_models[] = {
772784 .num_ydivs = 8 ,
773785
774786 .scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
787+
788+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
789+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT ,
775790 },
776791 {
777792 .name = {"RTH1002" , NULL },
@@ -812,6 +827,10 @@ static struct scope_config scope_models[] = {
812827 .num_ydivs = 8 ,
813828
814829 .scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
830+
831+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
832+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT
833+ | INTERN_NO_POD_STATE_SET_SUPPORT ,
815834 },
816835 {
817836 .name = {"RTH1004" , NULL },
@@ -852,6 +871,10 @@ static struct scope_config scope_models[] = {
852871 .num_ydivs = 8 ,
853872
854873 .scpi_dialect = & rohde_schwarz_log_not_pod_scpi_dialect ,
874+
875+ .internal_flags = INTERN_NO_LOGIC_STATE_GET_SUPPORT
876+ | INTERN_NO_LOGIC_STATE_SET_SUPPORT
877+ | INTERN_NO_POD_STATE_SET_SUPPORT ,
855878 },
856879};
857880
@@ -871,8 +894,19 @@ static void scope_state_dump(const struct scope_config *config,
871894 }
872895
873896 for (i = 0 ; i < config -> digital_channels ; i ++ ) {
874- sr_info ("State of digital channel %d -> %s" , i ,
875- state -> digital_channels [i ] ? "On" : "Off" );
897+ if (!(config -> internal_flags & INTERN_NO_LOGIC_STATE_GET_SUPPORT ))
898+ {
899+ sr_info ("State of digital channel %d -> %s" , i ,
900+ state -> digital_channels [i ] ? "On" : "Off" );
901+ }
902+ else if (!(config -> internal_flags & INTERN_NO_POD_STATE_GET_SUPPORT ))
903+ {
904+ sr_info ("State of digital channel %d -> %s" , i ,
905+ state -> digital_pods [i / DIGITAL_CHANNELS_PER_POD ].state ? "On" : "Off" );
906+ }
907+ else {
908+ sr_info ("State of digital channel %d -> On" , i );
909+ }
876910 }
877911
878912 for (i = 0 ; i < config -> digital_pods ; i ++ ) {
@@ -1058,13 +1092,27 @@ static int digital_channel_state_get(struct sr_dev_inst *sdi,
10581092 struct sr_scpi_dev_inst * scpi = sdi -> conn ;
10591093
10601094 for (i = 0 ; i < config -> digital_channels ; i ++ ) {
1061- g_snprintf (command , sizeof (command ),
1062- (* config -> scpi_dialect )[SCPI_CMD_GET_DIG_CHAN_STATE ],
1063- i );
1095+ if (!(config -> internal_flags & INTERN_NO_LOGIC_STATE_GET_SUPPORT )) {
1096+ g_snprintf (command , sizeof (command ),
1097+ (* config -> scpi_dialect )[SCPI_CMD_GET_DIG_CHAN_STATE ],
1098+ i );
10641099
1065- if (sr_scpi_get_bool (scpi , command ,
1066- & state -> digital_channels [i ]) != SR_OK )
1067- return SR_ERR ;
1100+ if (sr_scpi_get_bool (scpi , command ,
1101+ & state -> digital_channels [i ]) != SR_OK )
1102+ return SR_ERR ;
1103+ }
1104+ else if (!(config -> internal_flags & INTERN_NO_POD_STATE_GET_SUPPORT )) {
1105+ g_snprintf (command , sizeof (command ),
1106+ (* config -> scpi_dialect )[SCPI_CMD_GET_DIG_POD_STATE ],
1107+ i / DIGITAL_CHANNELS_PER_POD );
1108+
1109+ if (sr_scpi_get_bool (scpi , command ,
1110+ & state -> digital_channels [i ]) != SR_OK )
1111+ return SR_ERR ;
1112+ }
1113+ else {
1114+ state -> digital_channels [i ] = TRUE;
1115+ }
10681116
10691117 ch = get_channel_by_index_and_type (sdi -> channels , i , SR_CHANNEL_LOGIC );
10701118 if (ch )
@@ -1518,13 +1566,13 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
15181566
15191567 packet .type = SR_DF_ANALOG ;
15201568
1569+ sr_analog_init (& analog , & encoding , & meaning , & spec , 2 );
15211570 analog .data = data -> data ;
15221571 analog .num_samples = data -> len / sizeof (float );
15231572 /* Truncate acquisition if a smaller number of samples has been requested. */
15241573 if (devc -> samples_limit > 0 && analog .num_samples > devc -> samples_limit )
15251574 analog .num_samples = devc -> samples_limit ;
15261575 /* TODO: Use proper 'digits' value for this device (and its modes). */
1527- sr_analog_init (& analog , & encoding , & meaning , & spec , 2 );
15281576 encoding .is_signed = TRUE;
15291577 if (state -> analog_channels [ch -> index ].probe_unit == 'V' ) {
15301578 meaning .mq = SR_MQ_VOLTAGE ;
@@ -1536,7 +1584,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
15361584 meaning .channels = g_slist_append (NULL , ch );
15371585 packet .payload = & analog ;
15381586 sr_session_send (sdi , & packet );
1539- devc -> num_samples = data -> len / sizeof ( float ) ;
1587+ devc -> num_samples += analog . num_samples ;
15401588 g_slist_free (meaning .channels );
15411589 g_byte_array_free (data , TRUE);
15421590 data = NULL ;
@@ -1613,7 +1661,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
16131661 * number of frames or after the specified number of samples, or
16141662 * continue reception by starting over at the first enabled channel.
16151663 */
1616- if (++ devc -> num_frames >= devc -> frame_limit || devc -> num_samples >= devc -> samples_limit ) {
1664+ if (( devc -> frame_limit && ++ devc -> num_frames >= devc -> frame_limit ) || devc -> num_samples >= devc -> samples_limit ) {
16171665 sr_dev_acquisition_stop (sdi );
16181666 hmo_cleanup_logic_data (devc );
16191667 } else {
0 commit comments