Re: Working with secondary addresses
dave penkler <[email protected]> Tue, 24 Mar 2026 17:11:23 +0100
| Newsgroups | gmane.linux.hardware.gpib.general |
|---|---|
| Message-ID | <CAL=kjP3YjqLnq9xCj6GHSAVHAQaNymeg+f18G7fh+0WDjHgjjw@mail.gmail.com> |
--===============3933953796330876807== Content-Type: multipart/alternative; boundary="000000000000b9b9ff064dc76796" --000000000000b9b9ff064dc76796 Content-Type: text/plain; charset="UTF-8" Hi John, ibsad() does not send the secondary address but does configure it on the device descriptor for use in subsequent ibrd() ibwrt() calls. Your code looks good BTW. I'm not familiar with Perl but you might try the following to avoid potential issues with gpib.conf: use LinuxGpib; $result = ""; # setup write descriptor minor 0, pad 5, sad 27, timeout 3 secs, assert eoi, no eos my $devw = LinuxGpib::ibdev(0, 5, hex(0x7B), 12, 1, 0); # setup read descriptor minor 0, pad 5, sad 13, timeout 3 secs, assert eoi, eos = cr my $devr = LinuxGpib::ibdev(0, 5, hex(0x6D), 12, 1, 13); LinuxGpib::ibwrt($devw,"1\r",2); sleep 1; LinuxGpib::ibrd($devr,$result,100); print $result; print "\n"; cheers, -Dave ... On Tue, 24 Mar 2026 at 16:02, John <[email protected]> wrote: > I am trying to work with secondary addresses on a storage device using > linux-gpib. For example, I would like to read a file. The device > emulates a Tektronix 4924 tape drive and is on primary GPIB address 5. > Normally, on a Tektronix 4051 computer I would run a find command > followed by an input command, for example: > > FIND@5:1 > > INPUT@5:A$ > > This would send a '1' to SAD 0x7B followed by SAD 0x6E to prompt the > device to send data. > > For a text file, this should read the first line of data up to a CR > terminator. > > I initially tried doing this with Python, but quickly found that the ib* > commands in the reference do not correlate to the Python gpib module, > and that the pythin gpib module does not have methods for writing to or > reading from secondary addresses. > > I then looked at Perl. This was far more promising, as the ib* commands > in the reference do have a direct correlation to LinuxGpib::ib* > functions, but I could still get no output. > > This is my current Perl script. What is not clear to me is whether > ibsad() actually sends the secondary address? > > Perhaps someone can tell me whether I am going the right way about this? > > > #!/usr/bin/perl > # Before `make install' is performed this script should be runnable with > # `make test'. After `make install' it should work as `perl test.pl' > > ######################### > > # change 'tests => 1' to 'tests => last_test_to_print'; > > use Test; > use Time::HiRes qw(usleep time gettimeofday); > use LinuxGpib; > > BEGIN { plan tests => 1 }; > use LinuxGpib; > ok(1); # If we made it this far, we're ok. > > ######################### > > # Insert your test code below, the Test module is use()ed here so read > # its man page ( perldoc Test ) for help writing this test script. > > $device = "Tektronix 4924"; > $cmd = ""; > $idn = ""; > $result = ""; > > my $dev = LinuxGpib::ibfind($device) || > die "Can't open device $device!\n"; > > print "FIND file .....\n"; > LinuxGpib::ibsad($dev, hex(0x7B)); > LinuxGpib::ibwrt($dev,"1\r",2); > sleep 1; > > print "INPUT first line from file .....\n"; > LinuxGpib::ibsad($dev, hex(0x6D)); > LinuxGpib::ibrd($dev,$result,100); > print $result; > print "\n"; > > print "Done.\n"; > > > # clear > LinuxGpib::ibclr($dev); > exit 0; > > > > > _______________________________________________ > Linux-gpib-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/linux-gpib-general > --000000000000b9b9ff064dc76796 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hi John,<div>ibsad() does not send the secondary address b= ut does configure it on the device descriptor for</div><div>use in subseque= nt ibrd()=C2=A0 ibwrt() calls.</div><div>Your code looks good BTW.<br><div>= I'm not familiar with Perl but you might try the following to avoid pot= ential issues with gpib.conf:</div></div><div><font face=3D"monospace">use = LinuxGpib;</font></div><div><font face=3D"monospace">$result =3D "&quo= t;;</font></div><div><font face=3D"monospace"># setup write descriptor mino= r 0, pad 5, sad 27, timeout 3 secs, assert eoi, no eos=C2=A0</font></div><d= iv><font face=3D"monospace">my $devw =3D=C2=A0LinuxGpib::ibdev(0, 5, hex(0x= 7B), 12, 1, 0);</font></div><div><font face=3D"monospace"># setup read desc= riptor minor 0, pad 5, sad 13, timeout 3 secs, assert eoi, eos =3D cr=C2=A0= </font></div><div><font face=3D"monospace">my $devr =3D LinuxGpib::ibdev(0,= 5, hex(0x6D), 12, 1, 13);</font></div><div><font face=3D"monospace">LinuxG= pib::ibwrt($devw,"1\r",2);</font></div><div><font face=3D"monospa= ce">sleep 1;</font></div><div><font face=3D"monospace">LinuxGpib::ibrd($dev= r,$result,100);</font></div><div><font face=3D"monospace">print $result;<br= >print "\n";<br></font></div><div><br></div><div>cheers,</div><di= v>-Dave</div><div>...</div></div><br><div class=3D"gmail_quote gmail_quote_= container"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, 24 Mar 2026 at 16:= 02, John <<a href=3D"mailto:[email protected]">[email protected]= us.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"m= argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left= :1ex">I am trying to work with secondary addresses on a storage device usin= g <br> linux-gpib. For example, I would like to read a file. The device <br> emulates a Tektronix 4924 tape drive and is on primary GPIB address 5. <br> Normally, on a Tektronix 4051 computer I would run a find command <br> followed by an input command, for example:<br> <br> FIND@5:1<br> <br> INPUT@5:A$<br> <br> This would send a '1' to SAD 0x7B followed by SAD 0x6E to prompt th= e <br> device to send data.<br> <br> For a text file, this should read the first line of data up to a CR <br> terminator.<br> <br> I initially tried doing this with Python, but quickly found that the ib* <b= r> commands in the reference do not correlate to the Python gpib module, <br> and that the pythin gpib module does not have methods for writing to or <br= > reading from secondary addresses.<br> <br> I then looked at Perl. This was far more promising, as the ib* commands <br= > in the reference do have a direct correlation to LinuxGpib::ib* <br> functions, but I could still get no output.<br> <br> This is my current Perl script. What is not clear to me is whether <br> ibsad() actually sends the secondary address?<br> <br> Perhaps someone can tell me whether I am going the right way about this?<br= > <br> <br> #!/usr/bin/perl<br> # Before `make install' is performed this script should be runnable wit= h<br> # `make test'. After `make install' it should work as `perl <a href= =3D"http://test.pl" rel=3D"noreferrer" target=3D"_blank">test.pl</a>'<b= r> <br> #########################<br> <br> # change 'tests =3D> 1' to 'tests =3D> last_test_to_print= ';<br> <br> use Test;<br> use Time::HiRes qw(usleep time gettimeofday);<br> use LinuxGpib;<br> <br> BEGIN { plan tests =3D> 1 };<br> use LinuxGpib;<br> ok(1); # If we made it this far, we're ok.<br> <br> #########################<br> <br> # Insert your test code below, the Test module is use()ed here so read<br> # its man page ( perldoc Test ) for help writing this test script.<br> <br> $device =3D "Tektronix 4924";<br> $cmd =3D "";<br> $idn =3D "";<br> $result =3D "";<br> <br> my $dev =3D LinuxGpib::ibfind($device) ||<br> =C2=A0=C2=A0 =C2=A0 die "Can't open device $device!\n";<br> <br> print "FIND file .....\n";<br> LinuxGpib::ibsad($dev, hex(0x7B));<br> LinuxGpib::ibwrt($dev,"1\r",2);<br> sleep 1;<br> <br> print "INPUT first line from file .....\n";<br> LinuxGpib::ibsad($dev, hex(0x6D));<br> LinuxGpib::ibrd($dev,$result,100);<br> print $result;<br> print "\n";<br> <br> print "Done.\n";<br> <br> <br> # clear<br> LinuxGpib::ibclr($dev);<br> exit 0;<br> <br> <br> <br> <br> _______________________________________________<br> Linux-gpib-general mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blan= k">[email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/linux-gpib-general"= rel=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/l= istinfo/linux-gpib-general</a><br> </blockquote></div> --000000000000b9b9ff064dc76796-- --===============3933953796330876807== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============3933953796330876807== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Linux-gpib-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-gpib-general --===============3933953796330876807==--