Stephane Fillod | 5 Jan 2011 23:24
Picon
Favicon

Re: Which model is most similar to the IC-E92D?

Hi Hans,

Happy new year to you and all the Hamlib community!

> I am about to start some development work for hamlib.
> 
> I have the sources, hamlib builds without problems (on
> FreeBSD 8.1-RELEASE). I also have a virtual machine that
> runs Windows 2000 with the RS-92 (software to control
> the IC-E92D) and I can see all the bytes going thru the
> serial port. So, I'm all set to build the hamlib stuff for
> model IC-E92D...
> First point were I'm stuck:
> (from the README.developer)
> "3.3 Clone the most similar model in the backend"
>
> Which existing model is most similar to the IC-E92D?
> TIA for any help.

Well, the IC-E92D looks like a grand cousin to the other icom backends.
It looks like the framing is somewhat the same as CI-V, but looking
at the cx91 perl sources and provided they share the same protocol,
there are some subtle changes.
The TXD and RXD serial signals are not tied together (-> no need of read-back
of command sent), the controler ID is not 0xe0 but 0x80, and the
remote ID is not fixed: it looks like it is replaced by the target VFO
(0x01 or 0x02) for the command sent.

In order to ease the "3.3" step of README.developer, I've just checked
into the SVN repo a skeleton backend for the IC-E92D.
(Continue reading)

Nate Bargmann | 10 Jan 2011 20:44
Picon
Favicon
Gravatar

Git hosting enabled--experimental only!

Just for my own experimentation I enabled the Git repository for Hamlib.
At the moment it is empty.  ;-)

This is experimental for me (or anyone else) to learn more about Git.
It's likely that I will experiment with cloning changes from SVN to Git,
but not the other way.  Make no mistake, SVN remains the official
repository, so updates will not be made to Git expecting them to be
applied to the SVN repository.  

Access to the repository can be at:

http://sourceforge.net/projects/hamlib/develop

73, de Nate >>

--

-- 

"The optimist proclaims that we live in the best of all possible worlds.
The pessimist fears this is true."

Ham radio, Linux, bikes, and more: http://n0nb.us/index.html

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
Nate Bargmann | 11 Jan 2011 22:38
Picon
Favicon
Gravatar

Re: Git hosting enabled--experimental only!

As a follow-on, I have pushed a clone of the Hamlib SVN to:

http://hamlib.git.sourceforge.net/git/gitweb-index.cgi

or via Git anonymous access:

git clone git://hamlib.git.sourceforge.net/gitroot/hamlib/hamlib

will create a Git based local working directory.

It is current as of SVN 3019.

As it takes a fair number of steps to convert from SVN to Git and since
I have not figured out a lot of other things, the current Git repository
is simply a snapshot for the moment.  Right now Git write access is
limited to Stephane and myself.

Personally, the more I play with Git the more I like it.  It is speedy
and saves a bit of disk space--15M vs. 20M for SVN here.  There are many
Git resources available.  A couple of good ones I have found are:

Pro Git: http://progit.org/book/
Git Ref: http://gitref.org/

I encourage checking out these resources and playing a bit.

73, de Nate >>

--

-- 

(Continue reading)

Nate Bargmann | 17 Jan 2011 20:15
Picon
Favicon
Gravatar

Stuck with C structures, HELP!

In implementing some code in the K2 backend to populate a set of
structures for the K2 filters, I have come to an impass and request the
help of better C experts than I.

Here are the structures:

/* K2 Filter list, four per mode */
struct k2_filt_s {
    char width[8];      /* Filter width in Hz */
    char fslot[4];      /* Crystal filter slot number--1-4 */
    char afslot[4];     /* AF filter slot number--0-2 */
};

/* K2 Filter List
 * 
 * This struct will be populated as modes are queried or in response to
 * a request to set a given mode.  This way a cache can be maintained of
 * the installed filters and an appropriate filter can be selected for a
 * requested bandwidth.  Each mode has up to four filter slots
 * available.
*/

struct k2_filt_lst_s {
    struct k2_filt_s filt_1;
    struct k2_filt_s filt_2;
    struct k2_filt_s filt_3;
    struct k2_filt_s filt_4;
};

struct k2_filt_lst_s k2_fwmd_ssb;
(Continue reading)

Bert Put | 17 Jan 2011 20:46

Re: Stuck with C structures, HELP!

Hi Nate,

It would be useful to see a snippet of code that is misbehaving for you,
but hopefully I can offer some assistance.

To use your example of k2_fwmd_ssb, I think I understand that you're
having trouble cycling through the width, fslot, and afslot members in
order to populate them, presumably with strcpy(), strncpy() or memove().

Getting to the width member of filt_1 of k2_fwmd_ssb with strncpy should
be a matter of strncpy(k2_fwmd_ssb.filt_1.width, "srcdata", 8);  This is
because neither k2_fwmd_ssb or filt_1 are pointers but width is an array
of char, so it's also a pointer (to the first character in the array,
i.e. &width[0]).  strncpy requires a pointer, so this ought to work.

I used strncpy above because I don't want to overrun any string
boundaries when copying data to them.  I can't verify this until I get
home tonight, but I think this will work.

73 de Bert KG4BEC

On 1/17/2011 1:15 PM Nate Bargmann wrote:
> In implementing some code in the K2 backend to populate a set of
> structures for the K2 filters, I have come to an impass and request the
> help of better C experts than I.
> 
> Here are the structures:
> 
> /* K2 Filter list, four per mode */
> struct k2_filt_s {
(Continue reading)

Nate Bargmann | 17 Jan 2011 22:44
Picon
Favicon
Gravatar

Re: Stuck with C structures, HELP!

* On 2011 17 Jan 15:32 -0600, Bert Put wrote:
> Hi Nate,
> 
> It would be useful to see a snippet of code that is misbehaving for you,
> but hopefully I can offer some assistance.
> 
> To use your example of k2_fwmd_ssb, I think I understand that you're
> having trouble cycling through the width, fslot, and afslot members in
> order to populate them, presumably with strcpy(), strncpy() or memove().
> 
> Getting to the width member of filt_1 of k2_fwmd_ssb with strncpy should
> be a matter of strncpy(k2_fwmd_ssb.filt_1.width, "srcdata", 8);  This is
> because neither k2_fwmd_ssb or filt_1 are pointers but width is an array
> of char, so it's also a pointer (to the first character in the array,
> i.e. &width[0]).  strncpy requires a pointer, so this ought to work.
> 
> I used strncpy above because I don't want to overrun any string
> boundaries when copying data to them.  I can't verify this until I get
> home tonight, but I think this will work.

Hi Bert, thanks for the note.

I am using strncpy but the reall issue seems to be figuring out how to
loop through the second structure which has names like filt_1, filt_2,
etc.

I've attached the function as a file since pasting into Vim leaves it a
mess.  A lot of the loop is commented out since I was trying to get just
one assignment working.  Yes, it's sad.

(Continue reading)

Robert Steinhäußer | 17 Jan 2011 22:30

Re: Stuck with C structures, HELP!

Hi Nate,

have a look at "Pointer Fun with Binky" at
http://cslibrary.stanford.edu/104/ . And don't forget your magic wand of
dereferencing ;-)

> Where I'm stuck is picking one of the structure names, say k2_fwmd_ssb,
> and populating it through a loop that polls the rig and then puts values
> in the members of the k2_filt_s structure declaration.  I'm gettting
> lost in where to use pointers and such.

> struct k2_filt_lst_s k2_fwmd_ssb;
> struct k2_filt_lst_s k2_fwmd_cw;
> struct k2_filt_lst_s k2_fwmd_rtty;

These three structs are instances. When using their varible's name,
you can access their content directly, e.g. k2_fwmd_ssb.filt_1.

> struct k2_filt_lst_s *flt;

Now this is something different. Read it from right to left: flt is a
pointer (*) to a "struct k2_filt_lst_s". When flt is assigned to a real
instance of this struct type, the struct's content is available by
following the pointer to the instance, like this: flt->filt_1.

> 	if (!strcmp(cmd, "MD1;"))
> 		flt = &k2_fwmd_ssb;
> 	else if (!strcmp(cmd, "MD3;"))
> 		flt = &k2_fwmd_cw;
> 	else if (!strcmp(cmd, "MD6;"))
(Continue reading)

Nate Bargmann | 18 Jan 2011 00:19
Picon
Favicon
Gravatar

Re: Stuck with C structures, HELP!

* On 2011 17 Jan 16:06 -0600, Robert Steinhäußer wrote:
> Hi Nate,
> 
> have a look at "Pointer Fun with Binky" at
> http://cslibrary.stanford.edu/104/ . And don't forget your magic wand of
> dereferencing ;-)

I'll take a look, Robert, thanks.

> > Where I'm stuck is picking one of the structure names, say k2_fwmd_ssb,
> > and populating it through a loop that polls the rig and then puts values
> > in the members of the k2_filt_s structure declaration.  I'm gettting
> > lost in where to use pointers and such.
> 
> > struct k2_filt_lst_s k2_fwmd_ssb;
> > struct k2_filt_lst_s k2_fwmd_cw;
> > struct k2_filt_lst_s k2_fwmd_rtty;
> 
> These three structs are instances. When using their varible's name,
> you can access their content directly, e.g. k2_fwmd_ssb.filt_1.

Got that.

> > struct k2_filt_lst_s *flt;
> 
> Now this is something different. Read it from right to left: flt is a
> pointer (*) to a "struct k2_filt_lst_s". When flt is assigned to a real
> instance of this struct type, the struct's content is available by
> following the pointer to the instance, like this: flt->filt_1.
> 
(Continue reading)

Diane Bruce | 18 Jan 2011 00:32

Re: Stuck with C structures, HELP!

On Mon, Jan 17, 2011 at 05:19:42PM -0600, Nate Bargmann wrote:
> * On 2011 17 Jan 16:06 -0600, Robert Steinh?u?er wrote:
> > Hi Nate,
...
> That's where I made my mistake.  Diane Bruce sent me a bit of
> modification on the function I sent to the list that also sets up the
> k2_flt_s as in an array.  I don't know why that didn't dawn on me!  :-)
> 
> > > for (int i = 0; i < 4; ++i) {
> > >     strncpy(k2_filt_lst[i].width, "250", 8);
> > > }
> > 
> > Or something similar to this. Does this list always contain 4 elements?
> > If not, you'll soon find out about dynamic allocation and other fun
> > stuff ;-)

That's why you have something like this 

#define NUMBER_K2_FILTERS 4

Then that should become something like:

for (i = 0; i < NUMBER_K2_FILTERS; i++) {
...

> 
> For this rig, yes as there are four filter slots and all will be probed
> in the rig_open phase.  The K3 has five, but does not provide useful
> information about the filters so far as I know (which still isn't much,

(Continue reading)

Nate Bargmann | 18 Jan 2011 01:10
Picon
Favicon
Gravatar

Re: Stuck with C structures, HELP!

Even though things *look* right, I'm still getting a seg fault.  I get
the last output from this rig_debug:

        rig_debug(RIG_DEBUG_TRACE, "%s: buf is %s\n", __func__, buf);

   		/* buf should contain a string "FWxxxxfa;" which corresponds to:
		 * xxxx = filter width in Hz
		 * f = crystal filter slot number--1-4
		 * a = audio filter slot number--0-2
		 */
		strncpy(flt->filt_list[f-1].width, &buf[2], 4);
		flt->filt_list[f-1].width[4] = '\0';

		rig_debug(RIG_DEBUG_TRACE, "%s: Width: %s\n", __func__, flt->filt_list[f-1].width);

and then a segmentation fault.  The second rig_debug is not reached, or
doesn't put anything on the screen.

I don't know if strncpy is where the segfault occurs.  I guess I'll need
to fire up gdb next.  Ughhh.

73, de Nate >>

--

-- 

"The optimist proclaims that we live in the best of all
possible worlds.  The pessimist fears this is true."

Ham radio, Linux, bikes, and more: http://n0nb.us/index.html

(Continue reading)


Gmane