diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,502 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/bindings-hamlib.cabal b/bindings-hamlib.cabal
new file mode 100644
--- /dev/null
+++ b/bindings-hamlib.cabal
@@ -0,0 +1,50 @@
+name:                bindings-hamlib
+version:             0.1.0.0
+synopsis:            Hamlib bindings for Haskell
+description:         Haskell FFI bindings for hamlib
+homepage:            https://github.com/CodeBlock/hamlib-haskell
+license:             LGPL-2.1
+license-file:        LICENSE
+author:              Ricky Elrod
+maintainer:          ricky@elrod.me
+copyright:           (c) 2014 Ricky Elrod
+category:            FFI
+build-type:          Simple
+extra-source-files:  changelog.md
+cabal-version:       >=1.10
+
+library
+  exposed-modules:     
+                       Bindings.Hamlib.Rig
+                     , Bindings.Hamlib.Riglist
+                     --, Bindings.Hamlib.Rotator
+                     --, Bindings.Hamlib.Rotlist
+  -- other-modules:
+  c-sources:
+                       src/Bindings/Hamlib/Riglist.c
+  Include-dirs:        include
+  Includes:            Rig.h
+                     , rig.h
+  Install-includes:    Rig.h
+                     , rig.h
+  default-extensions:  ForeignFunctionInterface
+  build-depends:       base >= 4 && < 5
+                     , bindings-DSL >= 1.0.16 && < 1.1
+                     --, lens >= 4 && < 5
+  Extra-libraries:     hamlib
+  hs-source-dirs:      src
+  default-language:    Haskell2010
+  cc-options:         -fPIC
+
+executable hamlib-hs-demo
+  main-is:             Demo.hs
+  hs-source-dirs:      src
+  build-depends:       base >= 4 && < 5
+                     , bindings-hamlib
+  default-language:    Haskell2010
+  ghc-options:         -Wall -O2
+
+source-repository head
+  type: git
+  location: git://github.com/CodeBlock/bindings-hamlib
+  branch: master
diff --git a/changelog.md b/changelog.md
new file mode 100644
--- /dev/null
+++ b/changelog.md
@@ -0,0 +1,4 @@
+### 0.1.0.0
+- Initial release.
+  - NOTE: Missing channel_cap and a bunch of `#define`s.
+  - Also missing rotator.h
diff --git a/include/Rig.h b/include/Rig.h
new file mode 100644
--- /dev/null
+++ b/include/Rig.h
@@ -0,0 +1,66 @@
+#include <hamlib/rig.h>
+
+typedef union u
+{
+  struct n
+  {
+    float min;
+    float max;
+    float step;
+  } n;
+
+  struct c
+  {
+    const char *combostr[RIG_COMBO_MAX];
+  } c;
+} u;
+
+typedef union type
+{
+  rig_port_t rig;
+  ptt_type_t ptt;
+  dcd_type_t dcd;
+} type;
+
+typedef struct post_write_date
+{
+  int tv_sec, tv_usec;
+} post_write_date;
+
+typedef union parm
+{
+  struct serial
+  {
+    int rate;
+    int data_bits;
+    int stop_bits;
+    enum serial_parity_e parity;
+    enum serial_handshake_e handshake;
+    enum serial_control_state_e rts_state;
+    enum serial_control_state_e dtr_state;
+  } serial;
+  struct parallel
+  {
+    int pin;
+  } parallel;
+  struct cm108
+  {
+    int ptt_bitnum;
+  } cm108;
+  struct usb
+  {
+    int vid;
+    int pid;
+    int conf;
+    int iface;
+    int alt;
+    char *vendor_name;
+    char *product;
+  } usb;
+} parm;
+
+typedef struct table
+{
+  int raw;
+  int val;
+} table[MAX_CAL_LENGTH];
diff --git a/include/rig.h b/include/rig.h
new file mode 100644
--- /dev/null
+++ b/include/rig.h
@@ -0,0 +1,1734 @@
+/*
+ *  Hamlib Interface - API header
+ *  Copyright (c) 2000-2003 by Frank Singleton
+ *  Copyright (c) 2000-2012 by Stephane Fillod
+ *  Copyright (c) 2014      by Ricky Elrod (see note below)
+ *
+ *  ------------------------------
+ *
+ *  This file has been modified for hamlib-haskell, which is released under the
+ *  same license as "hamlib" itself.
+ *
+ *  The inclusion of this file within hamlib-haskell is only until this
+ *  upstream pull-request gets merged: https://github.com/N0NB/hamlib/pull/2
+ *
+ *  ------------------------------
+ *
+ *   This library is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU Lesser General Public
+ *   License as published by the Free Software Foundation; either
+ *   version 2.1 of the License, or (at your option) any later version.
+ *
+ *   This library is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *   Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with this library; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+
+#ifndef _RIG_H
+#define _RIG_H 1
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <hamlib/riglist.h>	/* list in another file to not mess up w/ this one */
+
+/**
+ * \addtogroup rig
+ * @{
+ */
+
+/*! \file rig.h
+ *  \brief Hamlib rig data structures.
+ *
+ *  This file contains the data structures and definitions for the Hamlib rig API.
+ *  see the rig.c file for more details on the rig API.
+ */
+
+
+/* __BEGIN_DECLS should be used at the beginning of your declarations,
+ * so that C++ compilers don't mangle their names.  Use __END_DECLS at
+ * the end of C declarations. */
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS		/* empty */
+# define __END_DECLS		/* empty */
+#endif
+
+/* HAMLIB_PARAMS is a macro used to wrap function prototypes, so that compilers
+ * that don't understand ANSI C prototypes still work, and ANSI C
+ * compilers can issue warnings about type mismatches. */
+#undef HAMLIB_PARAMS
+#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__CYGWIN__) || defined(_WIN32) || defined(__cplusplus)
+# define HAMLIB_PARAMS(protos) protos
+# define rig_ptr_t     void*
+#else
+# define HAMLIB_PARAMS(protos) ()
+# define rig_ptr_t     char*
+#endif
+
+#include <hamlib/rig_dll.h>
+
+
+__BEGIN_DECLS
+
+extern HAMLIB_EXPORT_VAR(const char) hamlib_version[];
+extern HAMLIB_EXPORT_VAR(const char) hamlib_copyright[];
+
+/**
+ * \brief Hamlib error codes
+ * Error code definition that can be returned by the Hamlib functions.
+ * Unless stated otherwise, Hamlib functions return the negative value
+ * of rig_errcode_e definitions in case of error, or 0 when successful.
+ */
+enum rig_errcode_e {
+	RIG_OK=0,		/*!< No error, operation completed successfully */
+	RIG_EINVAL,		/*!< invalid parameter */
+	RIG_ECONF,		/*!< invalid configuration (serial,..) */
+	RIG_ENOMEM,		/*!< memory shortage */
+	RIG_ENIMPL,		/*!< function not implemented, but will be */
+	RIG_ETIMEOUT,		/*!< communication timed out */
+	RIG_EIO,		/*!< IO error, including open failed */
+	RIG_EINTERNAL,		/*!< Internal Hamlib error, huh! */
+	RIG_EPROTO,		/*!< Protocol error */
+	RIG_ERJCTED,		/*!< Command rejected by the rig */
+	RIG_ETRUNC,		/*!< Command performed, but arg truncated */
+	RIG_ENAVAIL,		/*!< function not available */
+	RIG_ENTARGET,		/*!< VFO not targetable */
+	RIG_BUSERROR,		/*!< Error talking on the bus */
+	RIG_BUSBUSY,		/*!< Collision on the bus */
+	RIG_EARG,		/*!< NULL RIG handle or any invalid pointer parameter in get arg */
+	RIG_EVFO,		/*!< Invalid VFO */
+	RIG_EDOM		/*!< Argument out of domain of func */
+};
+
+/** \brief Token in the netrigctl protocol for returning error code */
+#define NETRIGCTL_RET "RPRT "
+
+/**
+ *\brief Hamlib debug levels
+ *
+ * REM: Numeric order matters for debug level
+ *
+ * \sa rig_set_debug
+ */
+enum rig_debug_level_e {
+  RIG_DEBUG_NONE = 0,		/*!< no bug reporting */
+  RIG_DEBUG_BUG,		/*!< serious bug */
+  RIG_DEBUG_ERR,		/*!< error case (e.g. protocol, memory allocation) */
+  RIG_DEBUG_WARN,		/*!< warning */
+  RIG_DEBUG_VERBOSE,		/*!< verbose */
+  RIG_DEBUG_TRACE		/*!< tracing */
+};
+
+/* --------------- Rig capabilities -----------------*/
+
+/* Forward struct references */
+
+struct rig;
+struct rig_state;
+
+/*!
+ * \brief Rig structure definition (see rig for details).
+ */
+typedef struct rig RIG;
+
+#define RIGNAMSIZ 30
+#define RIGVERSIZ 8
+#define FILPATHLEN 100
+#define FRQRANGESIZ 30
+#define MAXCHANDESC 30		/* describe channel eg: "WWV 5Mhz" */
+#define TSLSTSIZ 20		/* max tuning step list size, zero ended */
+#define FLTLSTSIZ 42		/* max mode/filter list size, zero ended */
+#define MAXDBLSTSIZ 8		/* max preamp/att levels supported, zero ended */
+#define CHANLSTSIZ 16		/* max mem_list size, zero ended */
+#define MAX_CAL_LENGTH 32	/* max calibration plots in cal_table_t */
+
+
+/**
+ * \brief CTCSS and DCS type definition.
+ *
+ * Continuous Tone Controlled Squelch System (CTCSS)
+ * sub-audible tone frequency are expressed in \em tenth of Hz.
+ * For example, the subaudible tone of 88.5 Hz is represented within
+ * Hamlib by 885.
+ *
+ * Digitally-Coded Squelch codes are simple direct integers.
+ */
+typedef unsigned int tone_t;
+
+/**
+ * \brief Port type
+ */
+typedef enum rig_port_e {
+  RIG_PORT_NONE = 0,		/*!< No port */
+  RIG_PORT_SERIAL,		/*!< Serial */
+  RIG_PORT_NETWORK,		/*!< Network socket type */
+  RIG_PORT_DEVICE,		/*!< Device driver, like the WiNRADiO */
+  RIG_PORT_PACKET,		/*!< AX.25 network type, e.g. SV8CS protocol */
+  RIG_PORT_DTMF,		/*!< DTMF protocol bridge via another rig, eg. Kenwood Sky Cmd System */
+  RIG_PORT_ULTRA,		/*!< IrDA Ultra protocol! */
+  RIG_PORT_RPC,			/*!< RPC wrapper */
+  RIG_PORT_PARALLEL,		/*!< Parallel port */
+  RIG_PORT_USB,			/*!< USB port */
+  RIG_PORT_UDP_NETWORK,		/*!< UDP Network socket type */
+  RIG_PORT_CM108		/*!< CM108 GPIO */
+} rig_port_t;
+
+/**
+ * \brief Serial parity
+ */
+enum serial_parity_e {
+  RIG_PARITY_NONE = 0,		/*!< No parity */
+  RIG_PARITY_ODD,		/*!< Odd */
+  RIG_PARITY_EVEN,		/*!< Even */
+  RIG_PARITY_MARK,		/*!< Mark */
+  RIG_PARITY_SPACE		/*!< Space */
+};
+
+/**
+ * \brief Serial handshake
+ */
+enum serial_handshake_e {
+  RIG_HANDSHAKE_NONE = 0,	/*!< No handshake */
+  RIG_HANDSHAKE_XONXOFF,	/*!< Software XON/XOFF */
+  RIG_HANDSHAKE_HARDWARE	/*!< Hardware CTS/RTS */
+};
+
+
+/**
+ * \brief Serial control state
+ */
+enum serial_control_state_e {
+  RIG_SIGNAL_UNSET = 0,	/*!< Unset or tri-state */
+  RIG_SIGNAL_ON,	/*!< ON */
+  RIG_SIGNAL_OFF	/*!< OFF */
+};
+
+/** \brief Rig type flags */
+typedef enum {
+	RIG_FLAG_RECEIVER =	(1<<1),		/*!< Receiver */
+	RIG_FLAG_TRANSMITTER =	(1<<2),		/*!< Transmitter */
+	RIG_FLAG_SCANNER =	(1<<3),		/*!< Scanner */
+
+	RIG_FLAG_MOBILE =	(1<<4),		/*!< mobile sized */
+	RIG_FLAG_HANDHELD =	(1<<5),		/*!< handheld sized */
+	RIG_FLAG_COMPUTER =	(1<<6),		/*!< "Computer" rig */
+	RIG_FLAG_TRUNKING =	(1<<7),		/*!< has trunking */
+	RIG_FLAG_APRS =		(1<<8),		/*!< has APRS */
+	RIG_FLAG_TNC =		(1<<9),		/*!< has TNC */
+	RIG_FLAG_DXCLUSTER =	(1<<10),	/*!< has DXCluster */
+	RIG_FLAG_TUNER =	(1<<11) 	/*!< dumb tuner */
+} rig_type_t;
+
+#define RIG_FLAG_TRANSCEIVER (RIG_FLAG_RECEIVER|RIG_FLAG_TRANSMITTER)
+#define RIG_TYPE_MASK (RIG_FLAG_TRANSCEIVER|RIG_FLAG_SCANNER|RIG_FLAG_MOBILE|RIG_FLAG_HANDHELD|RIG_FLAG_COMPUTER|RIG_FLAG_TRUNKING|RIG_FLAG_TUNER)
+
+#define RIG_TYPE_OTHER		0
+#define RIG_TYPE_TRANSCEIVER	RIG_FLAG_TRANSCEIVER
+#define RIG_TYPE_HANDHELD	(RIG_FLAG_TRANSCEIVER|RIG_FLAG_HANDHELD)
+#define RIG_TYPE_MOBILE		(RIG_FLAG_TRANSCEIVER|RIG_FLAG_MOBILE)
+#define RIG_TYPE_RECEIVER	RIG_FLAG_RECEIVER
+#define RIG_TYPE_PCRECEIVER	(RIG_FLAG_COMPUTER|RIG_FLAG_RECEIVER)
+#define RIG_TYPE_SCANNER	(RIG_FLAG_SCANNER|RIG_FLAG_RECEIVER)
+#define RIG_TYPE_TRUNKSCANNER	(RIG_TYPE_SCANNER|RIG_FLAG_TRUNKING)
+#define RIG_TYPE_COMPUTER	(RIG_FLAG_TRANSCEIVER|RIG_FLAG_COMPUTER)
+#define RIG_TYPE_TUNER		RIG_FLAG_TUNER
+
+
+/**
+ * \brief Development status of the backend
+ */
+enum rig_status_e {
+  RIG_STATUS_ALPHA = 0,		/*!< Alpha quality, i.e. development */
+  RIG_STATUS_UNTESTED,		/*!< Written from available specs, rig unavailable for test, feedback wanted! */
+  RIG_STATUS_BETA,		/*!< Beta quality */
+  RIG_STATUS_STABLE,		/*!< Stable */
+  RIG_STATUS_BUGGY		/*!< Was stable, but something broke it! */
+/*  RIG_STATUS_NEW	*	*!< Initial release of code
+ *  				!! Use of RIG_STATUS_NEW is deprecated. Do not use it anymore */
+};
+
+/** \brief Map all deprecated RIG_STATUS_NEW references to RIG_STATUS_UNTESTED for backward compatibility */
+#define RIG_STATUS_NEW RIG_STATUS_UNTESTED
+
+/**
+ * \brief Repeater shift type
+ */
+typedef enum {
+  RIG_RPT_SHIFT_NONE = 0,	/*!< No repeater shift */
+  RIG_RPT_SHIFT_MINUS,		/*!< "-" shift */
+  RIG_RPT_SHIFT_PLUS		/*!< "+" shift */
+} rptr_shift_t;
+
+/**
+ * \brief Split mode
+ */
+typedef enum {
+  RIG_SPLIT_OFF = 0,		/*!< Split mode disabled */
+  RIG_SPLIT_ON			/*!< Split mode enabled */
+} split_t;
+
+/**
+ * \brief Frequency type,
+ * Frequency type unit in Hz, able to hold SHF frequencies.
+ */
+typedef double freq_t;
+/** \brief printf(3) format to be used for freq_t type */
+#define PRIfreq "f"
+/** \brief scanf(3) format to be used for freq_t type */
+#define SCNfreq "lf"
+#define FREQFMT SCNfreq
+
+/**
+ * \brief Short frequency type
+ * Frequency in Hz restricted to 31bits, suitable for offsets, shifts, etc..
+ */
+typedef signed long shortfreq_t;
+
+#define Hz(f)	((freq_t)(f))
+#define kHz(f)	((freq_t)((f)*(freq_t)1000))
+#define MHz(f)	((freq_t)((f)*(freq_t)1000000))
+#define GHz(f)	((freq_t)((f)*(freq_t)1000000000))
+
+#define s_Hz(f) 	((shortfreq_t)(f))
+#define s_kHz(f)	((shortfreq_t)((f)*(shortfreq_t)1000))
+#define s_MHz(f)	((shortfreq_t)((f)*(shortfreq_t)1000000))
+#define s_GHz(f)	((shortfreq_t)((f)*(shortfreq_t)1000000000))
+
+#define RIG_FREQ_NONE Hz(0)
+
+
+/**
+ * \brief VFO definition
+ *
+ * There are several ways of using a vfo_t. For most cases, using RIG_VFO_A,
+ * RIG_VFO_B, RIG_VFO_CURR, etc., as opaque macros should suffice.
+ *
+ * Strictly speaking a VFO is Variable Frequency Oscillator.
+ * Here, it is referred as a tunable channel, from the radio operator's
+ * point of view. The channel can be designated individually by its real
+ * number, or by using an alias.
+ *
+ * Aliases may or may not be honored by a backend and are defined using
+ * high significant bits, i.e. RIG_VFO_MEM, RIG_VFO_MAIN, etc.
+ *
+ */
+typedef int vfo_t;
+
+/** \brief '' -- used in caps */
+#define RIG_VFO_NONE    0
+
+#define RIG_VFO_TX_FLAG    (1<<30)
+
+/** \brief \c currVFO -- current "tunable channel"/VFO */
+#define RIG_VFO_CURR    (1<<29)
+
+/** \brief \c MEM -- means Memory mode, to be used with set_vfo */
+#define RIG_VFO_MEM	(1<<28)
+
+/** \brief \c VFO -- means (last or any)VFO mode, with set_vfo */
+#define RIG_VFO_VFO	(1<<27)
+
+#define RIG_VFO_TX_VFO(v)	((v)|RIG_VFO_TX_FLAG)
+
+/** \brief \c TX -- alias for split tx or uplink, of VFO_CURR  */
+#define RIG_VFO_TX	RIG_VFO_TX_VFO(RIG_VFO_CURR)
+
+/** \brief \c RX -- alias for split rx or downlink */
+#define RIG_VFO_RX	RIG_VFO_CURR
+
+/** \brief \c Main -- alias for MAIN */
+#define RIG_VFO_MAIN	(1<<26)
+/** \brief \c Sub -- alias for SUB */
+#define RIG_VFO_SUB	(1<<25)
+
+#define RIG_VFO_N(n) (1<<(n))
+
+/** \brief \c VFOA -- VFO A */
+#define RIG_VFO_A RIG_VFO_N(0)
+/** \brief \c VFOB -- VFO B */
+#define RIG_VFO_B RIG_VFO_N(1)
+/** \brief \c VFOC -- VFO C */
+#define RIG_VFO_C RIG_VFO_N(2)
+
+
+/*
+ * targetable bitfields, for internal use.
+ * RIG_TARGETABLE_PURE means a pure targetable radio on every command
+ */
+#define RIG_TARGETABLE_NONE 0
+#define RIG_TARGETABLE_FREQ (1<<0)
+#define RIG_TARGETABLE_MODE (1<<1)
+#define RIG_TARGETABLE_PURE (1<<2)
+#define RIG_TARGETABLE_TONE (1<<3)
+#define RIG_TARGETABLE_FUNC (1<<4)
+#define RIG_TARGETABLE_ALL  0x7fffffff
+
+
+#define RIG_PASSBAND_NORMAL s_Hz(0)
+/**
+ * \brief Passband width, in Hz
+ * \sa rig_passband_normal, rig_passband_narrow, rig_passband_wide
+ */
+typedef shortfreq_t pbwidth_t;
+
+
+/**
+ * \brief DCD status
+ */
+typedef enum dcd_e {
+  RIG_DCD_OFF = 0,		/*!< Squelch closed */
+  RIG_DCD_ON			/*!< Squelch open */
+} dcd_t;
+
+/**
+ * \brief DCD type
+ * \sa rig_get_dcd
+ */
+typedef enum {
+  RIG_DCD_NONE = 0,		/*!< No DCD available */
+  RIG_DCD_RIG,			/*!< Rig has DCD status support, i.e. rig has get_dcd cap */
+  RIG_DCD_SERIAL_DSR,		/*!< DCD status from serial DSR signal */
+  RIG_DCD_SERIAL_CTS,		/*!< DCD status from serial CTS signal */
+  RIG_DCD_SERIAL_CAR,		/*!< DCD status from serial CD signal */
+  RIG_DCD_PARALLEL,		/*!< DCD status from parallel port pin */
+  RIG_DCD_CM108			/*!< DCD status from CM108 vol dn pin */
+} dcd_type_t;
+
+
+/**
+ * \brief PTT status
+ */
+typedef enum {
+  RIG_PTT_OFF = 0,		/*!< PTT desactivated */
+  RIG_PTT_ON,			/*!< PTT activated */
+  RIG_PTT_ON_MIC,		/*!< PTT Mic only, fallbacks on RIG_PTT_ON if unavailable */
+  RIG_PTT_ON_DATA		/*!< PTT Data (Mic-muted), fallbacks on RIG_PTT_ON if unavailable */
+} ptt_t;
+
+/**
+ * \brief PTT type
+ * \sa rig_get_ptt
+ */
+typedef enum {
+  RIG_PTT_NONE = 0,		/*!< No PTT available */
+  RIG_PTT_RIG,			/*!< Legacy PTT */
+  RIG_PTT_SERIAL_DTR,		/*!< PTT control through serial DTR signal */
+  RIG_PTT_SERIAL_RTS,		/*!< PTT control through serial RTS signal */
+  RIG_PTT_PARALLEL,		/*!< PTT control through parallel port */
+  RIG_PTT_RIG_MICDATA,		/*!< Legacy PTT, supports RIG_PTT_ON_MIC/RIG_PTT_ON_DATA */
+  RIG_PTT_CM108			/*!< PTT control through CM108 GPIO pin */
+} ptt_type_t;
+
+/**
+ * \brief Radio power state
+ */
+typedef enum {
+  RIG_POWER_OFF =	0,		/*!< Power off */
+  RIG_POWER_ON =	(1<<0),		/*!< Power on */
+  RIG_POWER_STANDBY =	(1<<1)		/*!< Standby */
+} powerstat_t;
+
+/**
+ * \brief Reset operation
+ */
+typedef enum {
+  RIG_RESET_NONE =	 0,		/*!< No reset */
+  RIG_RESET_SOFT =	(1<<0),		/*!< Software reset */
+  RIG_RESET_VFO =	(1<<1),		/*!< VFO reset */
+  RIG_RESET_MCALL =	(1<<2),		/*!< Memory clear */
+  RIG_RESET_MASTER =	(1<<3)		/*!< Master reset */
+} reset_t;
+
+
+/**
+ * \brief VFO operation
+ *
+ * A VFO operation is an action on a VFO (or tunable memory).
+ * The difference with a function is that an action has no on/off
+ * status, it is performed at once.
+ *
+ * Note: the vfo argument for some vfo operation may be irrelevant,
+ * and thus will be ignored.
+ *
+ * The VFO/MEM "mode" is set by rig_set_vfo.\n
+ * \c STRING used in rigctl
+ *
+ * \sa rig_parse_vfo_op() rig_strvfop()
+ */
+typedef enum {
+	RIG_OP_NONE =		0,  /*!< '' No VFO_OP */
+	RIG_OP_CPY =		(1<<0),	/*!< \c CPY -- VFO A = VFO B */
+	RIG_OP_XCHG =		(1<<1),	/*!< \c XCHG -- Exchange VFO A/B */
+	RIG_OP_FROM_VFO =	(1<<2),	/*!< \c FROM_VFO -- VFO->MEM */
+	RIG_OP_TO_VFO =		(1<<3),	/*!< \c TO_VFO -- MEM->VFO */
+	RIG_OP_MCL =		(1<<4),	/*!< \c MCL -- Memory clear */
+	RIG_OP_UP =		(1<<5),	/*!< \c UP -- UP increment VFO freq by tuning step*/
+	RIG_OP_DOWN =		(1<<6),	/*!< \c DOWN -- DOWN decrement VFO freq by tuning step*/
+	RIG_OP_BAND_UP =	(1<<7),	/*!< \c BAND_UP -- Band UP */
+	RIG_OP_BAND_DOWN =	(1<<8),	/*!< \c BAND_DOWN -- Band DOWN */
+	RIG_OP_LEFT =		(1<<9),	/*!< \c LEFT -- LEFT */
+	RIG_OP_RIGHT =		(1<<10),/*!< \c RIGHT -- RIGHT */
+	RIG_OP_TUNE =		(1<<11),/*!< \c TUNE -- Start tune */
+	RIG_OP_TOGGLE =		(1<<12) /*!< \c TOGGLE -- Toggle VFOA and VFOB */
+} vfo_op_t;
+
+
+/**
+ * \brief Rig Scan operation
+ *
+ * Various scan operations supported by a rig.\n
+ * \c STRING used in rigctl
+ *
+ * \sa rig_parse_scan() rig_strscan()
+ */
+typedef enum {
+	RIG_SCAN_NONE =		0,  /*!< '' No Scan */
+	RIG_SCAN_STOP =		RIG_SCAN_NONE, /*!< \c STOP -- Stop scanning */
+	RIG_SCAN_MEM =		(1<<0),	/*!< \c MEM -- Scan all memory channels */
+	RIG_SCAN_SLCT =		(1<<1),	/*!< \c SLCT -- Scan all selected memory channels */
+	RIG_SCAN_PRIO =		(1<<2),	/*!< \c PRIO -- Priority watch (mem or call channel) */
+	RIG_SCAN_PROG =		(1<<3),	/*!< \c PROG -- Programmed(edge) scan */
+	RIG_SCAN_DELTA =	(1<<4),	/*!< \c DELTA -- delta-f scan */
+	RIG_SCAN_VFO =		(1<<5),	/*!< \c VFO -- most basic scan */
+	RIG_SCAN_PLT =		(1<<6)  /*!< \c PLT -- Scan using pipelined tuning */
+} scan_t;
+
+/**
+ * \brief configuration token
+ */
+typedef long token_t;
+
+#define RIG_CONF_END 0
+
+/**
+ * \brief parameter types
+ *
+ *   Used with configuration, parameter and extra-parm tables.
+ *
+ *   Current internal implementation
+ *   NUMERIC: val.f or val.i
+ *   COMBO: val.i, starting from 0.  Points to a table of strings or asci stored values.
+ *   STRING: val.s or val.cs
+ *   CHECKBUTTON: val.i 0/1
+ */
+
+/* strongly inspired from soundmodem. Thanks Thomas! */
+
+enum rig_conf_e {
+	RIG_CONF_STRING,	/*!<	String type */
+	RIG_CONF_COMBO,		/*!<	Combo type */
+	RIG_CONF_NUMERIC,	/*!<	Numeric type integer or real */
+	RIG_CONF_CHECKBUTTON,	/*!<	on/off type */
+	RIG_CONF_BUTTON		/*!<    Button type */
+};
+
+#define RIG_COMBO_MAX	8
+
+/**
+ * \brief Configuration parameter structure.
+ */
+struct confparams {
+  token_t token;		/*!< Conf param token ID */
+  const char *name;		/*!< Param name, no spaces allowed */
+  const char *label;		/*!< Human readable label */
+  const char *tooltip;		/*!< Hint on the parameter */
+  const char *dflt;		/*!< Default value */
+  enum rig_conf_e type;		/*!< Type of the parameter */
+  union {			/*!< */
+	struct {		/*!< */
+		float min;	/*!< Minimum value */
+		float max;	/*!< Maximum value */
+		float step;	/*!< Step */
+	} n;			/*!< Numeric type */
+	struct {		/*!< */
+		const char *combostr[RIG_COMBO_MAX];	/*!< Combo list */
+	} c;			/*!< Combo type */
+  } u;				/*!< Type union */
+};
+
+/** \brief Announce
+ *
+ * Designate optional speech synthesizer.
+ */
+typedef enum {
+	RIG_ANN_NONE =	0,		/*!< None */
+	RIG_ANN_OFF = 	RIG_ANN_NONE,	/*!< disable announces */
+	RIG_ANN_FREQ =	(1<<0),		/*!< Announce frequency */
+	RIG_ANN_RXMODE = (1<<1),	/*!< Announce receive mode */
+	RIG_ANN_CW = (1<<2),		/*!< CW */
+	RIG_ANN_ENG = (1<<3),		/*!< English */
+	RIG_ANN_JAP = (1<<4)		/*!< Japan */
+} ann_t;
+
+
+/**
+ * \brief Antenna number
+ */
+typedef int ant_t;
+
+#define RIG_ANT_NONE	0
+#define RIG_ANT_N(n)	((ant_t)1<<(n))
+#define RIG_ANT_1	RIG_ANT_N(0)
+#define RIG_ANT_2	RIG_ANT_N(1)
+#define RIG_ANT_3	RIG_ANT_N(2)
+#define RIG_ANT_4	RIG_ANT_N(3)
+#define RIG_ANT_5	RIG_ANT_N(4)
+
+/**
+ * \brief AGC delay settings
+ */
+/* TODO: kill me, and replace by real AGC delay */
+enum agc_level_e {
+	RIG_AGC_OFF = 0,
+	RIG_AGC_SUPERFAST,
+	RIG_AGC_FAST,
+	RIG_AGC_SLOW,
+	RIG_AGC_USER,		/*!< user selectable */
+	RIG_AGC_MEDIUM,
+	RIG_AGC_AUTO
+};
+
+/**
+ * \brief Level display meters
+ */
+enum meter_level_e {
+  RIG_METER_NONE =	0,		/*< No display meter */
+  RIG_METER_SWR =	(1<<0),		/*< Stationary Wave Ratio */
+  RIG_METER_COMP =	(1<<1),		/*< Compression level */
+  RIG_METER_ALC =	(1<<2),		/*< ALC */
+  RIG_METER_IC =	(1<<3),		/*< IC */
+  RIG_METER_DB =	(1<<4),		/*< DB */
+  RIG_METER_PO =	(1<<5),		/*< Power Out */
+  RIG_METER_VDD =	(1<<6)		/*< Final Amp Voltage */
+};
+
+/**
+ * \brief Universal approach for passing values
+ * \sa rig_set_level, rig_get_level, rig_set_parm, rig_get_parm
+ */
+typedef union {
+  signed int i;			/*!< Signed integer */
+  float f;			/*!< Single precision float */
+  char *s;			/*!< Pointer to char string */
+  const char *cs;		/*!< Pointer to constant char string */
+} value_t;
+
+/** \brief Rig Level Settings
+ *
+ * Various operating levels supported by a rig.\n
+ * \c STRING used in rigctl
+ *
+ * \sa rig_parse_level() rig_strlevel()
+ */
+
+enum rig_level_e {
+	RIG_LEVEL_NONE =	0,	/*!< '' -- No Level */
+	RIG_LEVEL_PREAMP =	(1<<0),	/*!< \c PREAMP -- Preamp, arg int (dB) */
+	RIG_LEVEL_ATT =		(1<<1),	/*!< \c ATT -- Attenuator, arg int (dB) */
+	RIG_LEVEL_VOX =		(1<<2),	/*!< \c VOX -- VOX delay, arg int (tenth of seconds) */
+	RIG_LEVEL_AF =		(1<<3),	/*!< \c AF -- Volume, arg float [0.0 ... 1.0] */
+	RIG_LEVEL_RF =		(1<<4),	/*!< \c RF -- RF gain (not TX power), arg float [0.0 ... 1.0] */
+	RIG_LEVEL_SQL =		(1<<5),	/*!< \c SQL -- Squelch, arg float [0.0 ... 1.0] */
+	RIG_LEVEL_IF =		(1<<6),	/*!< \c IF -- IF, arg int (Hz) */
+	RIG_LEVEL_APF =		(1<<7),	/*!< \c APF -- Audio Peak Filter, arg float [0.0 ... 1.0] */
+	RIG_LEVEL_NR =		(1<<8),	/*!< \c NR -- Noise Reduction, arg float [0.0 ... 1.0] */
+	RIG_LEVEL_PBT_IN =	(1<<9),	/*!< \c PBT_IN -- Twin PBT (inside), arg float [0.0 ... 1.0] */
+	RIG_LEVEL_PBT_OUT =	(1<<10),/*!< \c PBT_OUT -- Twin PBT (outside), arg float [0.0 ... 1.0] */
+	RIG_LEVEL_CWPITCH =	(1<<11),/*!< \c CWPITCH -- CW pitch, arg int (Hz) */
+	RIG_LEVEL_RFPOWER =	(1<<12),/*!< \c RFPOWER -- RF Power, arg float [0.0 ... 1.0] */
+	RIG_LEVEL_MICGAIN =	(1<<13),/*!< \c MICGAIN -- MIC Gain, arg float [0.0 ... 1.0] */
+	RIG_LEVEL_KEYSPD =	(1<<14),/*!< \c KEYSPD -- Key Speed, arg int (WPM) */
+	RIG_LEVEL_NOTCHF =	(1<<15),/*!< \c NOTCHF -- Notch Freq., arg int (Hz) */
+	RIG_LEVEL_COMP =	(1<<16),/*!< \c COMP -- Compressor, arg float [0.0 ... 1.0] */
+	RIG_LEVEL_AGC =		(1<<17),/*!< \c AGC -- AGC, arg int (see enum agc_level_e) */
+	RIG_LEVEL_BKINDL =	(1<<18),/*!< \c BKINDL -- BKin Delay, arg int (tenth of dots) */
+	RIG_LEVEL_BALANCE =	(1<<19),/*!< \c BAL -- Balance (Dual Watch), arg float [0.0 ... 1.0] */
+	RIG_LEVEL_METER =	(1<<20),/*!< \c METER -- Display meter, arg int (see enum meter_level_e) */
+
+	RIG_LEVEL_VOXGAIN =	(1<<21),/*!< \c VOXGAIN -- VOX gain level, arg float [0.0 ... 1.0] */
+	RIG_LEVEL_VOXDELAY =  RIG_LEVEL_VOX,	/*!< Synonym of RIG_LEVEL_VOX */
+	RIG_LEVEL_ANTIVOX =	(1<<22),/*!< \c ANTIVOX -- anti-VOX level, arg float [0.0 ... 1.0] */
+	RIG_LEVEL_SLOPE_LOW = (1<<23),/*!< \c SLOPE_LOW -- Slope tune, low frequency cut, */
+	RIG_LEVEL_SLOPE_HIGH = (1<<24),/*!< \c SLOPE_HIGH -- Slope tune, high frequency cut, */
+	RIG_LEVEL_BKIN_DLYMS = (1<<25),/*!< \c BKIN_DLYMS -- BKin Delay, arg int Milliseconds */
+
+		/*!< These ones are not settable */
+	RIG_LEVEL_RAWSTR =	(1<<26),/*!< \c RAWSTR -- Raw (A/D) value for signal strength, specific to each rig, arg int */
+	RIG_LEVEL_SQLSTAT =	(1<<27),/*!< \c SQLSTAT -- SQL status, arg int (open=1/closed=0). Deprecated, use get_dcd instead */
+	RIG_LEVEL_SWR =		(1<<28),/*!< \c SWR -- SWR, arg float [0.0 ... infinite] */
+	RIG_LEVEL_ALC =		(1<<29),/*!< \c ALC -- ALC, arg float */
+	RIG_LEVEL_STRENGTH =(1<<30) /*!< \c STRENGTH -- Effective (calibrated) signal strength relative to S9, arg int (dB) */
+	/*RIG_LEVEL_BWC =		(1<<31)*/ /*!< Bandwidth Control, arg int (Hz) */
+};
+
+#define RIG_LEVEL_FLOAT_LIST (RIG_LEVEL_AF|RIG_LEVEL_RF|RIG_LEVEL_SQL|RIG_LEVEL_APF|RIG_LEVEL_NR|RIG_LEVEL_PBT_IN|RIG_LEVEL_PBT_OUT|RIG_LEVEL_RFPOWER|RIG_LEVEL_MICGAIN|RIG_LEVEL_COMP|RIG_LEVEL_BALANCE|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_VOXGAIN|RIG_LEVEL_ANTIVOX)
+
+#define RIG_LEVEL_READONLY_LIST (RIG_LEVEL_SQLSTAT|RIG_LEVEL_SWR|RIG_LEVEL_ALC|RIG_LEVEL_STRENGTH|RIG_LEVEL_RAWSTR)
+
+#define RIG_LEVEL_IS_FLOAT(l) ((l)&RIG_LEVEL_FLOAT_LIST)
+#define RIG_LEVEL_SET(l) ((l)&~RIG_LEVEL_READONLY_LIST)
+
+
+/**
+ * \brief Rig Parameters
+ *
+ * Parameters are settings that are not VFO specific.\n
+ * \c STRING used in rigctl
+ *
+ * \sa rig_parse_parm() rig_strparm()
+ */
+enum rig_parm_e {
+	RIG_PARM_NONE =		0,	/*!< '' -- No Parm */
+	RIG_PARM_ANN =		(1<<0),	/*!< \c ANN -- "Announce" level, see ann_t */
+	RIG_PARM_APO =		(1<<1),	/*!< \c APO -- Auto power off, int in minute */
+	RIG_PARM_BACKLIGHT =	(1<<2),	/*!< \c BACKLIGHT -- LCD light, float [0.0 ... 1.0] */
+	RIG_PARM_BEEP =		(1<<4),	/*!< \c BEEP -- Beep on keypressed, int (0,1) */
+	RIG_PARM_TIME =		(1<<5),	/*!< \c TIME -- hh:mm:ss, int in seconds from 00:00:00 */
+	RIG_PARM_BAT =		(1<<6),	/*!< \c BAT -- battery level, float [0.0 ... 1.0] */
+	RIG_PARM_KEYLIGHT =	(1<<7)  /*!< \c KEYLIGHT -- Button backlight, on/off */
+};
+
+#define RIG_PARM_FLOAT_LIST (RIG_PARM_BACKLIGHT|RIG_PARM_BAT)
+#define RIG_PARM_READONLY_LIST (RIG_PARM_BAT)
+
+#define RIG_PARM_IS_FLOAT(l) ((l)&RIG_PARM_FLOAT_LIST)
+#define RIG_PARM_SET(l) ((l)&~RIG_PARM_READONLY_LIST)
+
+#define RIG_SETTING_MAX 32
+/**
+ * \brief Setting
+ *
+ * This can be a func, a level or a parm.
+ * Each bit designates one of them.
+ */
+typedef unsigned long setting_t;
+
+/*
+ * tranceive mode, ie. the rig notify the host of any event,
+ * like freq changed, mode changed, etc.
+ */
+#define	RIG_TRN_OFF 0
+#define	RIG_TRN_RIG 1
+#define	RIG_TRN_POLL 2
+
+
+/**
+ * \brief Rig Function Settings
+ *
+ * Various operating functions supported by a rig.\n
+ * \c STRING used in rigctl
+ *
+ * \sa rig_parse_func() rig_strfunc()
+ */
+enum rig_func_e {
+	RIG_FUNC_NONE =    	0,	/*!< '' -- No Function */
+	RIG_FUNC_FAGC =    	(1<<0),	/*!< \c FAGC -- Fast AGC */
+	RIG_FUNC_NB =	    	(1<<1),	/*!< \c NB -- Noise Blanker */
+	RIG_FUNC_COMP =    	(1<<2),	/*!< \c COMP -- Speech Compression */
+	RIG_FUNC_VOX =    	(1<<3),	/*!< \c VOX -- Voice Operated Relay */
+	RIG_FUNC_TONE =    	(1<<4),	/*!< \c TONE -- CTCSS Tone */
+	RIG_FUNC_TSQL =    	(1<<5),	/*!< \c TSQL -- CTCSS Activate/De-activate */
+	RIG_FUNC_SBKIN =    	(1<<6),	/*!< \c SBKIN -- Semi Break-in (CW mode) */
+	RIG_FUNC_FBKIN =    	(1<<7),	/*!< \c FBKIN -- Full Break-in (CW mode) */
+	RIG_FUNC_ANF =    	(1<<8),	/*!< \c ANF -- Automatic Notch Filter (DSP) */
+	RIG_FUNC_NR =     	(1<<9),	/*!< \c NR -- Noise Reduction (DSP) */
+	RIG_FUNC_AIP =     	(1<<10),/*!< \c AIP -- RF pre-amp (AIP on Kenwood, IPO on Yaesu, etc.) */
+	RIG_FUNC_APF =     	(1<<11),/*!< \c APF -- Auto Passband/Audio Peak Filter */
+	RIG_FUNC_MON =     	(1<<12),/*!< \c MON -- Monitor transmitted signal */
+	RIG_FUNC_MN =     	(1<<13),/*!< \c MN -- Manual Notch */
+	RIG_FUNC_RF =     	(1<<14),/*!< \c RF -- RTTY Filter */
+	RIG_FUNC_ARO =     	(1<<15),/*!< \c ARO -- Auto Repeater Offset */
+	RIG_FUNC_LOCK =     	(1<<16),/*!< \c LOCK -- Lock */
+	RIG_FUNC_MUTE =     	(1<<17),/*!< \c MUTE -- Mute */
+	RIG_FUNC_VSC =     	(1<<18),/*!< \c VSC -- Voice Scan Control */
+	RIG_FUNC_REV =     	(1<<19),/*!< \c REV -- Reverse transmit and receive frequencies */
+	RIG_FUNC_SQL =     	(1<<20),/*!< \c SQL -- Turn Squelch Monitor on/off */
+	RIG_FUNC_ABM =     	(1<<21),/*!< \c ABM -- Auto Band Mode */
+	RIG_FUNC_BC =     	(1<<22),/*!< \c BC -- Beat Canceller */
+	RIG_FUNC_MBC =     	(1<<23),/*!< \c MBC -- Manual Beat Canceller */
+	/* 			(1<<24), used to be RIG_FUNC_LMP, see RIG_PARM_BACKLIGHT instead) */
+	RIG_FUNC_AFC =    	(1<<25),/*!< \c AFC -- Auto Frequency Control ON/OFF */
+	RIG_FUNC_SATMODE =	(1<<26),/*!< \c SATMODE -- Satellite mode ON/OFF */
+	RIG_FUNC_SCOPE =  	(1<<27),/*!< \c SCOPE -- Simple bandscope ON/OFF */
+	RIG_FUNC_RESUME =	(1<<28),/*!< \c RESUME -- Scan auto-resume */
+	RIG_FUNC_TBURST =	(1<<29),/*!< \c TBURST -- 1750 Hz tone burst */
+	RIG_FUNC_TUNER =	(1<<30) /*!< \c TUNER -- Enable automatic tuner */
+};
+
+/*
+ * power unit macros, converts to mW
+ * This is limited to 2MW on 32 bits systems.
+ */
+#define mW(p)	 ((int)(p))
+#define Watts(p) ((int)((p)*1000))
+#define W(p)	 Watts(p)
+#define kW(p)	 ((int)((p)*1000000L))
+
+/**
+ * \brief Radio mode
+ *
+ * Various modes supported by a rig.\n
+ * \c STRING used in rigctl
+ *
+ * \sa rig_parse_mode() rig_strrmode()
+ */
+typedef enum {
+	RIG_MODE_NONE =  	0,	/*!< '' -- None */
+	RIG_MODE_AM =    	(1<<0),	/*!< \c AM -- Amplitude Modulation */
+	RIG_MODE_CW =    	(1<<1),	/*!< \c CW -- CW "normal" sideband */
+	RIG_MODE_USB =		(1<<2),	/*!< \c USB -- Upper Side Band */
+	RIG_MODE_LSB =		(1<<3),	/*!< \c LSB -- Lower Side Band */
+	RIG_MODE_RTTY =		(1<<4),	/*!< \c RTTY -- Radio Teletype */
+	RIG_MODE_FM =    	(1<<5),	/*!< \c FM -- "narrow" band FM */
+	RIG_MODE_WFM =   	(1<<6),	/*!< \c WFM -- broadcast wide FM */
+	RIG_MODE_CWR =   	(1<<7),	/*!< \c CWR -- CW "reverse" sideband */
+	RIG_MODE_RTTYR =	(1<<8),	/*!< \c RTTYR -- RTTY "reverse" sideband */
+	RIG_MODE_AMS =    	(1<<9),	/*!< \c AMS -- Amplitude Modulation Synchronous */
+	RIG_MODE_PKTLSB =       (1<<10),/*!< \c PKTLSB -- Packet/Digital LSB mode (dedicated port) */
+	RIG_MODE_PKTUSB =       (1<<11),/*!< \c PKTUSB -- Packet/Digital USB mode (dedicated port) */
+	RIG_MODE_PKTFM =        (1<<12),/*!< \c PKTFM -- Packet/Digital FM mode (dedicated port) */
+	RIG_MODE_ECSSUSB =      (1<<13),/*!< \c ECSSUSB -- Exalted Carrier Single Sideband USB */
+	RIG_MODE_ECSSLSB =      (1<<14),/*!< \c ECSSLSB -- Exalted Carrier Single Sideband LSB */
+	RIG_MODE_FAX =          (1<<15),/*!< \c FAX -- Facsimile Mode */
+	RIG_MODE_SAM =          (1<<16),/*!< \c SAM -- Synchronous AM double sideband */
+	RIG_MODE_SAL =          (1<<17),/*!< \c SAL -- Synchronous AM lower sideband */
+	RIG_MODE_SAH =          (1<<18),/*!< \c SAH -- Synchronous AM upper (higher) sideband */
+	RIG_MODE_DSB =			(1<<19), /*!< \c DSB -- Double sideband suppressed carrier */
+    RIG_MODE_TESTS_MAX               /*!< \c MUST ALWAYS BE LAST, Max Count for dumpcaps.c */
+} rmode_t;
+
+
+/** \brief macro for backends, not to be used by rig_set_mode et al. */
+#define RIG_MODE_SSB  	(RIG_MODE_USB|RIG_MODE_LSB)
+
+/** \brief macro for backends, not to be used by rig_set_mode et al. */
+#define RIG_MODE_ECSS   (RIG_MODE_ECSSUSB|RIG_MODE_ECSSLSB)
+
+
+#define RIG_DBLST_END 0		/* end marker in a preamp/att level list */
+#define RIG_IS_DBLST_END(d) ((d)==0)
+
+/**
+ * \brief Frequency range
+ *
+ * Put together a group of this struct in an array to define
+ * what frequencies your rig has access to.
+ */
+typedef struct freq_range_list {
+  freq_t start;		/*!< Start frequency */
+  freq_t end;		/*!< End frequency */
+  rmode_t modes;	/*!< Bit field of RIG_MODE's */
+  int low_power;	/*!< Lower RF power in mW, -1 for no power (ie. rx list) */
+  int high_power;	/*!< Higher RF power in mW, -1 for no power (ie. rx list) */
+  vfo_t vfo;		/*!< VFO list equipped with this range */
+  ant_t ant;		/*!< Antenna list equipped with this range, 0 means all */
+} freq_range_t;
+
+#define RIG_FRNG_END     {Hz(0),Hz(0),RIG_MODE_NONE,0,0,RIG_VFO_NONE}
+#define RIG_IS_FRNG_END(r) ((r).start == Hz(0) && (r).end == Hz(0))
+
+#define RIG_ITU_REGION1 1
+#define RIG_ITU_REGION2 2
+#define RIG_ITU_REGION3 3
+
+/**
+ * \brief Tuning step definition
+ *
+ * Lists the tuning steps available for each mode.
+ *
+ * If a ts field in the list has RIG_TS_ANY value,
+ * this means the rig allows its tuning step to be
+ * set to any value ranging from the lowest to the
+ * highest (if any) value in the list for that mode.
+ * The tuning step must be sorted in the ascending
+ * order, and the RIG_TS_ANY value, if present, must
+ * be the last one in the list.
+ *
+ * Note also that the minimum frequency resolution
+ * of the rig is determined by the lowest value
+ * in the Tuning step list.
+ *
+ * \sa rig_set_ts, rig_get_resolution
+ */
+struct tuning_step_list {
+  rmode_t modes;	/*!< Bit field of RIG_MODE's */
+  shortfreq_t ts;	/*!< Tuning step in Hz */
+};
+
+#define RIG_TS_ANY     0
+#define RIG_TS_END     {RIG_MODE_NONE,0}
+#define RIG_IS_TS_END(t)	((t).modes == RIG_MODE_NONE && (t).ts == 0)
+
+/**
+ * \brief Filter definition
+ *
+ * Lists the filters available for each mode.
+ *
+ * If more than one filter is available for a given mode,
+ * the first entry in the array will be the default
+ * filter to use for the normal passband of this mode.
+ * The first entry in the array below the default normal passband
+ * is the default narrow passband and the first entry in the array
+ * above the default normal passband is the default wide passband.
+ * Note: if there's no lower width or upper width, then narrow or
+ * respectively wide passband is equal to the default normal passband.
+ *
+ * If a width field in the list has RIG_FLT_ANY value,
+ * this means the rig allows its passband width to be
+ * set to any value ranging from the lowest to the
+ * highest value (if any) in the list for that mode.
+ * The RIG_FLT_ANY value, if present, must
+ * be the last one in the list.
+ *
+ * The width field is the narrowest passband in a transmit/receive chain
+ * with regard to different IF.
+ *
+ * \sa rig_set_mode, rig_passband_normal, rig_passband_narrow, rig_passband_wide
+ */
+struct filter_list {
+  rmode_t modes;	/*!< Bit field of RIG_MODE's */
+  pbwidth_t width;	/*!< Passband width in Hz */
+};
+
+#define RIG_FLT_ANY     0
+#define RIG_FLT_END     {RIG_MODE_NONE,0}
+#define RIG_IS_FLT_END(f)	((f).modes == RIG_MODE_NONE)
+
+
+/** \brief Empty channel_t.flags field */
+#define RIG_CHFLAG_NONE	0
+/** \brief skip memory channel during scan (lock out), channel_t.flags */
+#define RIG_CHFLAG_SKIP	(1<<0)
+/** \brief DATA port mode flag */
+#define RIG_CHFLAG_DATA (1<<1)
+
+/**
+ * \brief Extension attribute definition
+ *
+ */
+struct ext_list {
+  token_t token;	/*!< Token ID */
+  value_t val;		/*!< Value */
+};
+
+#define RIG_EXT_END     {0, {.i=0}}
+#define RIG_IS_EXT_END(x)	((x).token == 0)
+
+/**
+ * \brief Channel structure
+ *
+ * The channel struct stores all the attributes peculiar to a VFO.
+ *
+ * \sa rig_set_channel, rig_get_channel
+ */
+struct channel {
+  int channel_num;		/*!< Channel number */
+  int bank_num;			/*!< Bank number */
+  vfo_t vfo;			/*!< VFO */
+  int ant;			/*!< Selected antenna */
+  freq_t freq;			/*!< Receive frequency */
+  rmode_t mode;			/*!< Receive mode */
+  pbwidth_t width;		/*!< Receive passband width associated with mode */
+
+  freq_t tx_freq;		/*!< Transmit frequency */
+  rmode_t tx_mode;		/*!< Transmit mode */
+  pbwidth_t tx_width;		/*!< Transmit passband width associated with mode */
+
+  split_t split;		/*!< Split mode */
+  vfo_t tx_vfo;			/*!< Split transmit VFO */
+
+  rptr_shift_t rptr_shift;	/*!< Repeater shift */
+  shortfreq_t rptr_offs;	/*!< Repeater offset */
+  shortfreq_t tuning_step;	/*!< Tuning step */
+  shortfreq_t rit;		/*!< RIT */
+  shortfreq_t xit;		/*!< XIT */
+  setting_t funcs;		/*!< Function status */
+  value_t levels[RIG_SETTING_MAX];	/*!< Level values */
+  tone_t ctcss_tone;		/*!< CTCSS tone */
+  tone_t ctcss_sql;		/*!< CTCSS squelch tone */
+  tone_t dcs_code;		/*!< DCS code */
+  tone_t dcs_sql;		/*!< DCS squelch code */
+  int scan_group;		/*!< Scan group */
+  int flags;			/*!< Channel flags, see RIG_CHFLAG's */
+  char channel_desc[MAXCHANDESC];	/*!< Name */
+  struct ext_list *ext_levels;	/*!< Extension level value list, NULL ended. ext_levels can be NULL */
+};
+/** \brief Channel structure typedef */
+typedef struct channel channel_t;
+
+/**
+ * \brief Channel capability definition
+ *
+ * Definition of the attributes that can be stored/retrieved in/from memory
+ */
+struct channel_cap {
+  unsigned bank_num:1;		/*!< Bank number */
+  unsigned vfo:1;		/*!< VFO */
+  unsigned ant:1;		/*!< Selected antenna */
+  unsigned freq:1;		/*!< Receive frequency */
+  unsigned mode:1;		/*!< Receive mode */
+  unsigned width:1;		/*!< Receive passband width associated with mode */
+
+  unsigned tx_freq:1;		/*!< Transmit frequency */
+  unsigned tx_mode:1;		/*!< Transmit mode */
+  unsigned tx_width:1;		/*!< Transmit passband width associated with mode */
+
+  unsigned split:1;		/*!< Split mode */
+  unsigned tx_vfo:1;		/*!< Split transmit VFO */
+  unsigned rptr_shift:1;	/*!< Repeater shift */
+  unsigned rptr_offs:1;		/*!< Repeater offset */
+  unsigned tuning_step:1;	/*!< Tuning step */
+  unsigned rit:1;		/*!< RIT */
+  unsigned xit:1;		/*!< XIT */
+  setting_t funcs;		/*!< Function status */
+  setting_t levels;		/*!< Level values */
+  unsigned ctcss_tone:1;	/*!< CTCSS tone */
+  unsigned ctcss_sql:1;		/*!< CTCSS squelch tone */
+  unsigned dcs_code:1;		/*!< DCS code */
+  unsigned dcs_sql:1;		/*!< DCS squelch code */
+  unsigned scan_group:1;	/*!< Scan group */
+  unsigned flags:1;		/*!< Channel flags */
+  unsigned channel_desc:1;	/*!< Name */
+  unsigned ext_levels:1;	/*!< Extension level value list */
+};
+
+/** \brief Channel cap */
+typedef struct channel_cap channel_cap_t;
+
+
+/**
+ * \brief Memory channel type definition
+ *
+ * Definition of memory types. Depending on the type, the content
+ * of the memory channel has to be interpreted accordingly.
+ * For instance, a RIG_MTYPE_EDGE channel_t will hold only a start
+ * or stop frequency.
+ *
+ * \sa chan_list
+ */
+typedef enum {
+  RIG_MTYPE_NONE=0,		/*!< None */
+  RIG_MTYPE_MEM,		/*!< Regular */
+  RIG_MTYPE_EDGE,		/*!< Scan edge */
+  RIG_MTYPE_CALL,		/*!< Call channel */
+  RIG_MTYPE_MEMOPAD,		/*!< Memory pad */
+  RIG_MTYPE_SAT,		/*!< Satellite */
+  RIG_MTYPE_BAND,		/*!< VFO/Band channel */
+  RIG_MTYPE_PRIO		/*!< Priority channel */
+} chan_type_t;
+
+/**
+ * \brief Memory channel list definition
+ *
+ * Example for the Ic706MkIIG (99 memory channels, 2 scan edges, 2 call chans):
+\code
+	chan_t chan_list[] = {
+		{ 1, 99, RIG_MTYPE_MEM  },
+		{ 100, 103, RIG_MTYPE_EDGE },
+		{ 104, 105, RIG_MTYPE_CALL },
+		RIG_CHAN_END
+	}
+\endcode
+ */
+struct chan_list {
+  int start;			/*!< Starting memory channel \b number */
+  int end;			/*!< Ending memory channel \b number */
+  chan_type_t type;		/*!< Memory type. see chan_type_t */
+  channel_cap_t mem_caps;	/*!< Definition of attributes that can be stored/retrieved */
+};
+
+#define RIG_CHAN_END     {0,0,RIG_MTYPE_NONE}
+#define RIG_IS_CHAN_END(c)	((c).type == RIG_MTYPE_NONE)
+/** \brief Special memory channel value to tell rig_lookup_mem_caps() to retrieve all the ranges */
+#define RIG_MEM_CAPS_ALL -1
+
+/** \brief chan_t type */
+typedef struct chan_list chan_t;
+
+/**
+ * \brief level/parm granularity definition
+ *
+ * The granularity is undefined if min=0, max=0, and step=0.
+ *
+ * For float settings, if min.f=0 and max.f=0 (and step.f!=0),
+ * max.f is assumed to be actually equal to 1.0.
+ *
+ * If step=0 (and min and/or max are not null), then this means step
+ * can have maximum resolution, depending on type (int or float).
+ */
+struct gran {
+	value_t min;		/*!< Minimum value */
+	value_t max;		/*!< Maximum value */
+	value_t step;		/*!< Step */
+};
+
+/** \brief gran_t type */
+typedef	struct gran gran_t;
+
+
+/** \brief Calibration table struct */
+struct cal_table {
+	int size;		/*!< number of plots in the table */
+	struct {
+		int raw;	/*!< raw (A/D) value, as returned by \a RIG_LEVEL_RAWSTR */
+		int val;	/*!< associated value, basically the measured dB value */
+	} table[MAX_CAL_LENGTH];	/*!< table of plots */
+};
+
+/**
+ * \brief calibration table type
+ *
+ * cal_table_t is a data type suited to hold linear calibration.
+ * cal_table_t.size tells the number of plots cal_table_t.table contains.
+ *
+ * If a value is below or equal to cal_table_t.table[0].raw,
+ * rig_raw2val() will return cal_table_t.table[0].val.
+ *
+ * If a value is greater or equal to cal_table_t.table[cal_table_t.size-1].raw,
+ * rig_raw2val() will return cal_table_t.table[cal_table_t.size-1].val.
+ */
+typedef struct cal_table cal_table_t;
+
+#define EMPTY_STR_CAL { 0, { { 0, 0 }, } }
+
+
+typedef int (*chan_cb_t) (RIG *, channel_t**, int, const chan_t*, rig_ptr_t);
+typedef int (*confval_cb_t) (RIG *, const struct confparams *, value_t *, rig_ptr_t);
+
+/**
+ * \brief Rig data structure.
+ *
+ * Basic rig type, can store some useful info about different radios.
+ * Each lib must be able to populate this structure, so we can make
+ * useful inquiries about capabilities.
+ *
+ * The main idea of this struct is that it will be defined by the backend
+ * rig driver, and will remain readonly for the application.
+ * Fields that need to be modifiable by the application are
+ * copied into the struct rig_state, which is a kind of private
+ * of the RIG instance.
+ * This way, you can have several rigs running within the same application,
+ * sharing the struct rig_caps of the backend, while keeping their own
+ * customized data.
+ * NB: don't move fields around, as backend depends on it when initializing
+ *     their caps.
+ */
+struct rig_caps {
+  rig_model_t rig_model;	/*!< Rig model. */
+  const char *model_name;	/*!< Model name. */
+  const char *mfg_name;		/*!< Manufacturer. */
+  const char *version;		/*!< Driver version. */
+  const char *copyright;	/*!< Copyright info. */
+  enum rig_status_e status;	/*!< Driver status. */
+
+  int rig_type;			/*!< Rig type. */
+  ptt_type_t ptt_type;		/*!< Type of the PTT port. */
+  dcd_type_t dcd_type;		/*!< Type of the DCD port. */
+  rig_port_t port_type;		/*!< Type of communication port. */
+
+  int serial_rate_min;		/*!< Minimum serial speed. */
+  int serial_rate_max;		/*!< Maximum serial speed. */
+  int serial_data_bits;		/*!< Number of data bits. */
+  int serial_stop_bits;		/*!< Number of stop bits. */
+  enum serial_parity_e serial_parity;		/*!< Parity. */
+  enum serial_handshake_e serial_handshake;	/*!< Handshake. */
+
+  int write_delay;		/*!< Delay between each byte sent out, in mS */
+  int post_write_delay;		/*!< Delay between each commands send out, in mS */
+  int timeout;			/*!< Timeout, in mS */
+  int retry;			/*!< Maximum number of retries if command fails, 0 to disable */
+
+  setting_t has_get_func;	/*!< List of get functions */
+  setting_t has_set_func;	/*!< List of set functions */
+  setting_t has_get_level;	/*!< List of get level */
+  setting_t has_set_level;	/*!< List of set level */
+  setting_t has_get_parm;	/*!< List of get parm */
+  setting_t has_set_parm;	/*!< List of set parm */
+
+  gran_t level_gran[RIG_SETTING_MAX];	/*!< level granularity (i.e. steps) */
+  gran_t parm_gran[RIG_SETTING_MAX];	/*!< parm granularity (i.e. steps) */
+
+  const struct confparams *extparms;	/*!< Extension parm list, \sa ext.c */
+  const struct confparams *extlevels;	/*!< Extension level list, \sa ext.c */
+
+  const tone_t *ctcss_list;	/*!< CTCSS tones list, zero ended */
+  const tone_t *dcs_list;	/*!< DCS code list, zero ended */
+
+  int preamp[MAXDBLSTSIZ];	/*!< Preamp list in dB, 0 terminated */
+  int attenuator[MAXDBLSTSIZ];	/*!< Preamp list in dB, 0 terminated */
+  shortfreq_t max_rit;		/*!< max absolute RIT */
+  shortfreq_t max_xit;		/*!< max absolute XIT */
+  shortfreq_t max_ifshift;	/*!< max absolute IF-SHIFT */
+
+  ann_t announces;	/*!< Announces bit field list */
+
+  vfo_op_t vfo_ops;	/*!< VFO op bit field list */
+  scan_t scan_ops;	/*!< Scan bit field list */
+  int targetable_vfo;	/*!< Bit field list of direct VFO access commands */
+  int transceive;	/*!< Supported transceive mode */
+
+  int bank_qty;		/*!< Number of banks */
+  int chan_desc_sz;	/*!< Max length of memory channel name */
+
+  chan_t chan_list[CHANLSTSIZ];	/*!< Channel list, zero ended */
+
+  freq_range_t rx_range_list1[FRQRANGESIZ];	/*!< Receive frequency range list for ITU region 1 */
+  freq_range_t tx_range_list1[FRQRANGESIZ];	/*!< Transmit frequency range list for ITU region 1 */
+  freq_range_t rx_range_list2[FRQRANGESIZ];	/*!< Receive frequency range list for ITU region 2 */
+  freq_range_t tx_range_list2[FRQRANGESIZ];	/*!< Transmit frequency range list for ITU region 2 */
+
+  struct tuning_step_list tuning_steps[TSLSTSIZ];	/*!< Tuning step list */
+  struct filter_list filters[FLTLSTSIZ];		/*!< mode/filter table, at -6dB */
+
+  cal_table_t str_cal;				/*!< S-meter calibration table */
+
+  const struct confparams *cfgparams;            /*!< Configuration parametres. */
+  const rig_ptr_t priv;                          /*!< Private data. */
+
+	/*
+	 * Rig API
+	 *
+	 */
+
+  int (*rig_init) (RIG * rig);
+  int (*rig_cleanup) (RIG * rig);
+  int (*rig_open) (RIG * rig);
+  int (*rig_close) (RIG * rig);
+
+	/*
+	 *  General API commands, from most primitive to least.. :()
+	 *  List Set/Get functions pairs
+	 */
+
+  int (*set_freq) (RIG * rig, vfo_t vfo, freq_t freq);
+  int (*get_freq) (RIG * rig, vfo_t vfo, freq_t * freq);
+
+  int (*set_mode) (RIG * rig, vfo_t vfo, rmode_t mode,
+			 pbwidth_t width);
+  int (*get_mode) (RIG * rig, vfo_t vfo, rmode_t * mode,
+			 pbwidth_t * width);
+
+  int (*set_vfo) (RIG * rig, vfo_t vfo);
+  int (*get_vfo) (RIG * rig, vfo_t * vfo);
+
+  int (*set_ptt) (RIG * rig, vfo_t vfo, ptt_t ptt);
+  int (*get_ptt) (RIG * rig, vfo_t vfo, ptt_t * ptt);
+  int (*get_dcd) (RIG * rig, vfo_t vfo, dcd_t * dcd);
+
+  int (*set_rptr_shift) (RIG * rig, vfo_t vfo,
+			       rptr_shift_t rptr_shift);
+  int (*get_rptr_shift) (RIG * rig, vfo_t vfo,
+			       rptr_shift_t * rptr_shift);
+
+  int (*set_rptr_offs) (RIG * rig, vfo_t vfo, shortfreq_t offs);
+  int (*get_rptr_offs) (RIG * rig, vfo_t vfo, shortfreq_t * offs);
+
+  int (*set_split_freq) (RIG * rig, vfo_t vfo, freq_t tx_freq);
+  int (*get_split_freq) (RIG * rig, vfo_t vfo, freq_t * tx_freq);
+  int (*set_split_mode) (RIG * rig, vfo_t vfo, rmode_t tx_mode,
+			       pbwidth_t tx_width);
+  int (*get_split_mode) (RIG * rig, vfo_t vfo, rmode_t * tx_mode,
+			       pbwidth_t * tx_width);
+
+  int (*set_split_vfo) (RIG * rig, vfo_t vfo, split_t split, vfo_t tx_vfo);
+  int (*get_split_vfo) (RIG * rig, vfo_t vfo, split_t * split, vfo_t *tx_vfo);
+
+  int (*set_rit) (RIG * rig, vfo_t vfo, shortfreq_t rit);
+  int (*get_rit) (RIG * rig, vfo_t vfo, shortfreq_t * rit);
+  int (*set_xit) (RIG * rig, vfo_t vfo, shortfreq_t xit);
+  int (*get_xit) (RIG * rig, vfo_t vfo, shortfreq_t * xit);
+
+  int (*set_ts) (RIG * rig, vfo_t vfo, shortfreq_t ts);
+  int (*get_ts) (RIG * rig, vfo_t vfo, shortfreq_t * ts);
+
+  int (*set_dcs_code) (RIG * rig, vfo_t vfo, tone_t code);
+  int (*get_dcs_code) (RIG * rig, vfo_t vfo, tone_t * code);
+  int (*set_tone) (RIG * rig, vfo_t vfo, tone_t tone);
+  int (*get_tone) (RIG * rig, vfo_t vfo, tone_t * tone);
+  int (*set_ctcss_tone) (RIG * rig, vfo_t vfo, tone_t tone);
+  int (*get_ctcss_tone) (RIG * rig, vfo_t vfo, tone_t * tone);
+
+  int (*set_dcs_sql) (RIG * rig, vfo_t vfo, tone_t code);
+  int (*get_dcs_sql) (RIG * rig, vfo_t vfo, tone_t * code);
+  int (*set_tone_sql) (RIG * rig, vfo_t vfo, tone_t tone);
+  int (*get_tone_sql) (RIG * rig, vfo_t vfo, tone_t * tone);
+  int (*set_ctcss_sql) (RIG * rig, vfo_t vfo, tone_t tone);
+  int (*get_ctcss_sql) (RIG * rig, vfo_t vfo, tone_t * tone);
+
+  int (*power2mW) (RIG * rig, unsigned int *mwpower, float power,
+			 freq_t freq, rmode_t mode);
+  int (*mW2power) (RIG * rig, float *power, unsigned int mwpower,
+			 freq_t freq, rmode_t mode);
+
+  int (*set_powerstat) (RIG * rig, powerstat_t status);
+  int (*get_powerstat) (RIG * rig, powerstat_t * status);
+  int (*reset) (RIG * rig, reset_t reset);
+
+  int (*set_ant) (RIG * rig, vfo_t vfo, ant_t ant);
+  int (*get_ant) (RIG * rig, vfo_t vfo, ant_t * ant);
+
+  int (*set_level) (RIG * rig, vfo_t vfo, setting_t level,
+			  value_t val);
+  int (*get_level) (RIG * rig, vfo_t vfo, setting_t level,
+			  value_t * val);
+
+  int (*set_func) (RIG * rig, vfo_t vfo, setting_t func, int status);
+  int (*get_func) (RIG * rig, vfo_t vfo, setting_t func,
+			 int *status);
+
+  int (*set_parm) (RIG * rig, setting_t parm, value_t val);
+  int (*get_parm) (RIG * rig, setting_t parm, value_t * val);
+
+  int (*set_ext_level)(RIG *rig, vfo_t vfo, token_t token, value_t val);
+  int (*get_ext_level)(RIG *rig, vfo_t vfo, token_t token, value_t *val);
+
+  int (*set_ext_parm)(RIG *rig, token_t token, value_t val);
+  int (*get_ext_parm)(RIG *rig, token_t token, value_t *val);
+
+  int (*set_conf) (RIG * rig, token_t token, const char *val);
+  int (*get_conf) (RIG * rig, token_t token, char *val);
+
+  int (*send_dtmf) (RIG * rig, vfo_t vfo, const char *digits);
+  int (*recv_dtmf) (RIG * rig, vfo_t vfo, char *digits, int *length);
+  int (*send_morse) (RIG * rig, vfo_t vfo, const char *msg);
+
+  int (*set_bank) (RIG * rig, vfo_t vfo, int bank);
+  int (*set_mem) (RIG * rig, vfo_t vfo, int ch);
+  int (*get_mem) (RIG * rig, vfo_t vfo, int *ch);
+  int (*vfo_op) (RIG * rig, vfo_t vfo, vfo_op_t op);
+  int (*scan) (RIG * rig, vfo_t vfo, scan_t scan, int ch);
+
+  int (*set_trn) (RIG * rig, int trn);
+  int (*get_trn) (RIG * rig, int *trn);
+
+  int (*decode_event) (RIG * rig);
+
+  int (*set_channel) (RIG * rig, const channel_t * chan);
+  int (*get_channel) (RIG * rig, channel_t * chan);
+
+  const char *(*get_info) (RIG * rig);
+
+  int (*set_chan_all_cb) (RIG * rig, chan_cb_t chan_cb, rig_ptr_t);
+  int (*get_chan_all_cb) (RIG * rig, chan_cb_t chan_cb, rig_ptr_t);
+
+  int (*set_mem_all_cb) (RIG * rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t);
+  int (*get_mem_all_cb) (RIG * rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t);
+
+  const char *clone_combo_set;	/*!< String describing key combination to enter load cloning mode */
+  const char *clone_combo_get;	/*!< String describing key combination to enter save cloning mode */
+};
+
+/**
+ * \brief Port definition
+ *
+ * Of course, looks like OO painstakingly programmed in C, sigh.
+ */
+typedef struct hamlib_port_t {
+  union {
+	rig_port_t rig;		/*!< Communication port type */
+	ptt_type_t ptt;		/*!< PTT port type */
+	dcd_type_t dcd;		/*!< DCD port type */
+  } type;
+  int fd;			/*!< File descriptor */
+  void* handle;			/*!< handle for USB */
+
+  int write_delay;		/*!< Delay between each byte sent out, in mS */
+  int post_write_delay;		/*!< Delay between each commands send out, in mS */
+  struct { int tv_sec,tv_usec; } post_write_date;	/*!< hamlib internal use */
+  int timeout;			/*!< Timeout, in mS */
+  int retry;			/*!< Maximum number of retries, 0 to disable */
+
+  char pathname[FILPATHLEN];	/*!< Port pathname */
+  union {
+	struct {
+		int rate;	/*!< Serial baud rate */
+		int data_bits;	/*!< Number of data bits */
+		int stop_bits;	/*!< Number of stop bits */
+		enum serial_parity_e parity;		/*!< Serial parity */
+		enum serial_handshake_e handshake;	/*!< Serial handshake */
+		enum serial_control_state_e rts_state;	/*!< RTS set state */
+		enum serial_control_state_e dtr_state;	/*!< DTR set state */
+	} serial;		/*!< serial attributes */
+	struct {
+		int pin;	/*!< Parallel port pin number */
+	} parallel;		/*!< parallel attributes */
+	struct {
+		int ptt_bitnum;	/*< Bit number for CM108 GPIO PTT */
+	} cm108;		/*!< CM108 attributes */
+	struct {
+		int vid;	/*!< Vendor ID */
+		int pid;	/*!< Product ID */
+		int conf;	/*!< Configuration */
+		int iface;	/*!< interface */
+		int alt;	/*!< alternate */
+        char *vendor_name; /*!< Vendor name (opt.) */
+        char *product;     /*!< Product (opt.) */
+	} usb;			/*!< USB attributes */
+  } parm;			/*!< Port parameter union */
+} hamlib_port_t;
+
+#if !defined(__APPLE__) || !defined(__cplusplus)
+typedef hamlib_port_t port_t;
+#endif
+
+
+/**
+ * \brief Rig state containing live data and customized fields.
+ *
+ * This struct contains live data, as well as a copy of capability fields
+ * that may be updated (ie. customized)
+ *
+ * It is fine to move fields around, as this kind of struct should
+ * not be initialized like caps are.
+ */
+struct rig_state {
+	/*
+	 * overridable fields
+	 */
+  hamlib_port_t rigport;	/*!< Rig port (internal use). */
+  hamlib_port_t pttport;	/*!< PTT port (internal use). */
+  hamlib_port_t dcdport;	/*!< DCD port (internal use). */
+
+  double vfo_comp;	/*!< VFO compensation in PPM, 0.0 to disable */
+
+  int itu_region;	/*!< ITU region to select among freq_range_t */
+  freq_range_t rx_range_list[FRQRANGESIZ];	/*!< Receive frequency range list */
+  freq_range_t tx_range_list[FRQRANGESIZ];	/*!< Transmit frequency range list */
+
+  struct tuning_step_list tuning_steps[TSLSTSIZ];	/*!< Tuning step list */
+
+  struct filter_list filters[FLTLSTSIZ];	/*!< Mode/filter table, at -6dB */
+
+  cal_table_t str_cal;				/*!< S-meter calibration table */
+
+  chan_t chan_list[CHANLSTSIZ];	/*!< Channel list, zero ended */
+
+  shortfreq_t max_rit;		/*!< max absolute RIT */
+  shortfreq_t max_xit;		/*!< max absolute XIT */
+  shortfreq_t max_ifshift;	/*!< max absolute IF-SHIFT */
+
+  ann_t announces;		/*!< Announces bit field list */
+
+  int preamp[MAXDBLSTSIZ];	/*!< Preamp list in dB, 0 terminated */
+  int attenuator[MAXDBLSTSIZ];	/*!< Preamp list in dB, 0 terminated */
+
+  setting_t has_get_func;	/*!< List of get functions */
+  setting_t has_set_func;	/*!< List of set functions */
+  setting_t has_get_level;	/*!< List of get level */
+  setting_t has_set_level;	/*!< List of set level */
+  setting_t has_get_parm;	/*!< List of get parm */
+  setting_t has_set_parm;	/*!< List of set parm */
+
+  gran_t level_gran[RIG_SETTING_MAX];	/*!< level granularity */
+  gran_t parm_gran[RIG_SETTING_MAX];	/*!< parm granularity */
+
+
+	/*
+	 * non overridable fields, internal use
+	 */
+
+  int hold_decode;	/*!< set to 1 to hold the event decoder (async) otherwise 0 */
+  vfo_t current_vfo;	/*!< VFO currently set */
+  int vfo_list;		/*!< Complete list of VFO for this rig */
+  int comm_state;	/*!< Comm port state, opened/closed. */
+  rig_ptr_t priv;	/*!< Pointer to private rig state data. */
+  rig_ptr_t obj;	/*!< Internal use by hamlib++ for event handling. */
+
+  int transceive;	/*!< Whether the transceive mode is on */
+  int poll_interval;	/*!< Event notification polling period in milliseconds */
+  freq_t current_freq;	/*!< Frequency currently set */
+  rmode_t current_mode;	/*!< Mode currently set */
+  pbwidth_t current_width;	/*!< Passband width currently set */
+  vfo_t tx_vfo;		/*!< Tx VFO currently set */
+  int mode_list;		/*!< Complete list of modes for this rig */
+
+};
+
+
+typedef int (*vprintf_cb_t) (enum rig_debug_level_e, rig_ptr_t, const char *, va_list);
+
+typedef int (*freq_cb_t) (RIG *, vfo_t, freq_t, rig_ptr_t);
+typedef int (*mode_cb_t) (RIG *, vfo_t, rmode_t, pbwidth_t, rig_ptr_t);
+typedef int (*vfo_cb_t) (RIG *, vfo_t, rig_ptr_t);
+typedef int (*ptt_cb_t) (RIG *, vfo_t, ptt_t, rig_ptr_t);
+typedef int (*dcd_cb_t) (RIG *, vfo_t, dcd_t, rig_ptr_t);
+typedef int (*pltune_cb_t) (RIG *, vfo_t, freq_t *, rmode_t *, pbwidth_t *, rig_ptr_t);
+
+/**
+ * \brief Callback functions and args for rig event.
+ *
+ * Some rigs are able to notify the host computer the operator changed
+ * the freq/mode from the front panel, depressed a button, etc.
+ *
+ * Events from the rig are received through async io,
+ * so callback functions will be called from the SIGIO sighandler context.
+ *
+ * Don't set these fields directly, use rig_set_freq_callback et. al. instead.
+ *
+ * Callbacks suit event based programming very well,
+ * really appropriate in a GUI.
+ *
+ * \sa rig_set_freq_callback, rig_set_mode_callback, rig_set_vfo_callback,
+ *	 rig_set_ptt_callback, rig_set_dcd_callback
+ */
+struct rig_callbacks {
+  freq_cb_t freq_event;	/*!< Frequency change event */
+  rig_ptr_t freq_arg;	/*!< Frequency change argument */
+  mode_cb_t mode_event;	/*!< Mode change event */
+  rig_ptr_t mode_arg;	/*!< Mode change argument */
+  vfo_cb_t vfo_event;	/*!< VFO change event */
+  rig_ptr_t vfo_arg;	/*!< VFO change argument */
+  ptt_cb_t ptt_event;	/*!< PTT change event */
+  rig_ptr_t ptt_arg;	/*!< PTT change argument */
+  dcd_cb_t dcd_event;	/*!< DCD change event */
+  rig_ptr_t dcd_arg;	/*!< DCD change argument */
+  pltune_cb_t pltune;   /*!< Pipeline tuning module freq/mode/width callback */
+  rig_ptr_t pltune_arg; /*!< Pipeline tuning argument */
+  /* etc.. */
+};
+
+/**
+ * \brief The Rig structure
+ *
+ * This is the master data structure, acting as a handle for the controlled
+ * rig. A pointer to this structure is returned by the rig_init() API
+ * function and is passed as a parameter to every rig specific API call.
+ *
+ * \sa rig_init(), rig_caps, rig_state
+ */
+struct rig {
+  struct rig_caps *caps;		/*!< Pointer to rig capabilities (read only) */
+  struct rig_state state;		/*!< Rig state */
+  struct rig_callbacks callbacks;	/*!< registered event callbacks */
+};
+
+
+
+/* --------------- API function prototypes -----------------*/
+
+extern HAMLIB_EXPORT(RIG *) rig_init HAMLIB_PARAMS((rig_model_t rig_model));
+extern HAMLIB_EXPORT(int) rig_open HAMLIB_PARAMS((RIG *rig));
+
+  /*
+   *  General API commands, from most primitive to least.. :()
+   *  List Set/Get functions pairs
+   */
+
+extern HAMLIB_EXPORT(int) rig_set_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t freq));
+extern HAMLIB_EXPORT(int) rig_get_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t *freq));
+
+extern HAMLIB_EXPORT(int) rig_set_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width));
+extern HAMLIB_EXPORT(int) rig_get_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width));
+
+extern HAMLIB_EXPORT(int) rig_set_vfo HAMLIB_PARAMS((RIG *rig, vfo_t vfo));
+extern HAMLIB_EXPORT(int) rig_get_vfo HAMLIB_PARAMS((RIG *rig, vfo_t *vfo));
+
+extern HAMLIB_EXPORT(int) rig_set_ptt HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ptt_t ptt));
+extern HAMLIB_EXPORT(int) rig_get_ptt HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ptt_t *ptt));
+
+extern HAMLIB_EXPORT(int) rig_get_dcd HAMLIB_PARAMS((RIG *rig, vfo_t vfo, dcd_t *dcd));
+
+extern HAMLIB_EXPORT(int) rig_set_rptr_shift HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rptr_shift_t rptr_shift));
+extern HAMLIB_EXPORT(int) rig_get_rptr_shift HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rptr_shift_t *rptr_shift));
+extern HAMLIB_EXPORT(int) rig_set_rptr_offs HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t rptr_offs));
+extern HAMLIB_EXPORT(int) rig_get_rptr_offs HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *rptr_offs));
+
+extern HAMLIB_EXPORT(int) rig_set_ctcss_tone HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t tone));
+extern HAMLIB_EXPORT(int) rig_get_ctcss_tone HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *tone));
+extern HAMLIB_EXPORT(int) rig_set_dcs_code HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t code));
+extern HAMLIB_EXPORT(int) rig_get_dcs_code HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *code));
+
+extern HAMLIB_EXPORT(int) rig_set_ctcss_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t tone));
+extern HAMLIB_EXPORT(int) rig_get_ctcss_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *tone));
+extern HAMLIB_EXPORT(int) rig_set_dcs_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t code));
+extern HAMLIB_EXPORT(int) rig_get_dcs_sql HAMLIB_PARAMS((RIG *rig, vfo_t vfo, tone_t *code));
+
+extern HAMLIB_EXPORT(int) rig_set_split_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t tx_freq));
+extern HAMLIB_EXPORT(int) rig_get_split_freq HAMLIB_PARAMS((RIG *rig, vfo_t vfo, freq_t *tx_freq));
+extern HAMLIB_EXPORT(int) rig_set_split_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t tx_mode, pbwidth_t tx_width));
+extern HAMLIB_EXPORT(int) rig_get_split_mode HAMLIB_PARAMS((RIG *rig, vfo_t vfo, rmode_t *tx_mode, pbwidth_t *tx_width));
+extern HAMLIB_EXPORT(int) rig_set_split_vfo HAMLIB_PARAMS((RIG*, vfo_t rx_vfo, split_t split, vfo_t tx_vfo));
+extern HAMLIB_EXPORT(int) rig_get_split_vfo HAMLIB_PARAMS((RIG*, vfo_t rx_vfo, split_t *split, vfo_t *tx_vfo));
+#define rig_set_split(r,v,s) rig_set_split_vfo((r),(v),(s),RIG_VFO_CURR)
+#define rig_get_split(r,v,s) ({ vfo_t _tx_vfo; rig_get_split_vfo((r),(v),(s),&_tx_vfo); })
+
+extern HAMLIB_EXPORT(int) rig_set_rit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t rit));
+extern HAMLIB_EXPORT(int) rig_get_rit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *rit));
+extern HAMLIB_EXPORT(int) rig_set_xit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t xit));
+extern HAMLIB_EXPORT(int) rig_get_xit HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *xit));
+
+extern HAMLIB_EXPORT(int) rig_set_ts HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t ts));
+extern HAMLIB_EXPORT(int) rig_get_ts HAMLIB_PARAMS((RIG *rig, vfo_t vfo, shortfreq_t *ts));
+
+extern HAMLIB_EXPORT(int) rig_power2mW HAMLIB_PARAMS((RIG *rig, unsigned int *mwpower, float power, freq_t freq, rmode_t mode));
+extern HAMLIB_EXPORT(int) rig_mW2power HAMLIB_PARAMS((RIG *rig, float *power, unsigned int mwpower, freq_t freq, rmode_t mode));
+
+extern HAMLIB_EXPORT(shortfreq_t) rig_get_resolution HAMLIB_PARAMS((RIG *rig, rmode_t mode));
+
+extern HAMLIB_EXPORT(int) rig_set_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t level, value_t val));
+extern HAMLIB_EXPORT(int) rig_get_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t level, value_t *val));
+
+#define rig_get_strength(r,v,s) rig_get_level((r),(v),RIG_LEVEL_STRENGTH, (value_t*)(s))
+
+extern HAMLIB_EXPORT(int) rig_set_parm HAMLIB_PARAMS((RIG *rig, setting_t parm, value_t val));
+extern HAMLIB_EXPORT(int) rig_get_parm HAMLIB_PARAMS((RIG *rig, setting_t parm, value_t *val));
+
+extern HAMLIB_EXPORT(int) rig_set_conf HAMLIB_PARAMS((RIG *rig, token_t token, const char *val));
+extern HAMLIB_EXPORT(int) rig_get_conf HAMLIB_PARAMS((RIG *rig, token_t token, char *val));
+
+extern HAMLIB_EXPORT(int) rig_set_powerstat HAMLIB_PARAMS((RIG *rig, powerstat_t status));
+extern HAMLIB_EXPORT(int) rig_get_powerstat HAMLIB_PARAMS((RIG *rig, powerstat_t *status));
+
+extern HAMLIB_EXPORT(int) rig_reset HAMLIB_PARAMS((RIG *rig, reset_t reset));	/* dangerous! */
+
+extern HAMLIB_EXPORT(int) rig_set_ext_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo,
+			token_t token, value_t val));
+extern HAMLIB_EXPORT(int) rig_get_ext_level HAMLIB_PARAMS((RIG *rig, vfo_t vfo,
+			token_t token, value_t *val));
+
+extern HAMLIB_EXPORT(int) rig_set_ext_parm HAMLIB_PARAMS((RIG *rig, token_t token, value_t val));
+extern HAMLIB_EXPORT(int) rig_get_ext_parm HAMLIB_PARAMS((RIG *rig, token_t token, value_t *val));
+
+extern HAMLIB_EXPORT(int) rig_ext_level_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(RIG*, const struct confparams *, rig_ptr_t), rig_ptr_t data));
+extern HAMLIB_EXPORT(int) rig_ext_parm_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(RIG*, const struct confparams *, rig_ptr_t), rig_ptr_t data));
+extern HAMLIB_EXPORT(const struct confparams*) rig_ext_lookup HAMLIB_PARAMS((RIG *rig, const char *name));
+extern HAMLIB_EXPORT(const struct confparams *)  rig_ext_lookup_tok HAMLIB_PARAMS((RIG *rig, token_t token));
+extern HAMLIB_EXPORT(token_t) rig_ext_token_lookup HAMLIB_PARAMS((RIG *rig, const char *name));
+
+
+extern HAMLIB_EXPORT(int) rig_token_foreach HAMLIB_PARAMS((RIG *rig, int (*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data));
+extern HAMLIB_EXPORT(const struct confparams*) rig_confparam_lookup HAMLIB_PARAMS((RIG *rig, const char *name));
+extern HAMLIB_EXPORT(token_t) rig_token_lookup HAMLIB_PARAMS((RIG *rig, const char *name));
+
+extern HAMLIB_EXPORT(int) rig_close HAMLIB_PARAMS((RIG *rig));
+extern HAMLIB_EXPORT(int) rig_cleanup HAMLIB_PARAMS((RIG *rig));
+
+extern HAMLIB_EXPORT(int) rig_set_ant HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ant_t ant));	/* antenna */
+extern HAMLIB_EXPORT(int) rig_get_ant HAMLIB_PARAMS((RIG *rig, vfo_t vfo, ant_t *ant));
+
+extern HAMLIB_EXPORT(setting_t) rig_has_get_level HAMLIB_PARAMS((RIG *rig, setting_t level));
+extern HAMLIB_EXPORT(setting_t) rig_has_set_level HAMLIB_PARAMS((RIG *rig, setting_t level));
+
+extern HAMLIB_EXPORT(setting_t) rig_has_get_parm HAMLIB_PARAMS((RIG *rig, setting_t parm));
+extern HAMLIB_EXPORT(setting_t) rig_has_set_parm HAMLIB_PARAMS((RIG *rig, setting_t parm));
+
+extern HAMLIB_EXPORT(setting_t) rig_has_get_func HAMLIB_PARAMS((RIG *rig, setting_t func));
+extern HAMLIB_EXPORT(setting_t) rig_has_set_func HAMLIB_PARAMS((RIG *rig, setting_t func));
+
+extern HAMLIB_EXPORT(int) rig_set_func HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t func, int status));
+extern HAMLIB_EXPORT(int) rig_get_func HAMLIB_PARAMS((RIG *rig, vfo_t vfo, setting_t func, int *status));
+
+extern HAMLIB_EXPORT(int) rig_send_dtmf HAMLIB_PARAMS((RIG *rig, vfo_t vfo, const char *digits));
+extern HAMLIB_EXPORT(int) rig_recv_dtmf HAMLIB_PARAMS((RIG *rig, vfo_t vfo, char *digits, int *length));
+extern HAMLIB_EXPORT(int) rig_send_morse HAMLIB_PARAMS((RIG *rig, vfo_t vfo, const char *msg));
+
+extern HAMLIB_EXPORT(int) rig_set_bank HAMLIB_PARAMS((RIG *rig, vfo_t vfo, int bank));
+extern HAMLIB_EXPORT(int) rig_set_mem HAMLIB_PARAMS((RIG *rig, vfo_t vfo, int ch));
+extern HAMLIB_EXPORT(int) rig_get_mem HAMLIB_PARAMS((RIG *rig, vfo_t vfo, int *ch));
+extern HAMLIB_EXPORT(int) rig_vfo_op HAMLIB_PARAMS((RIG *rig, vfo_t vfo, vfo_op_t op));
+extern HAMLIB_EXPORT(vfo_op_t) rig_has_vfo_op HAMLIB_PARAMS((RIG *rig, vfo_op_t op));
+extern HAMLIB_EXPORT(int) rig_scan HAMLIB_PARAMS((RIG *rig, vfo_t vfo, scan_t scan, int ch));
+extern HAMLIB_EXPORT(scan_t) rig_has_scan HAMLIB_PARAMS((RIG *rig, scan_t scan));
+
+extern HAMLIB_EXPORT(int) rig_set_channel HAMLIB_PARAMS((RIG *rig, const channel_t *chan));	/* mem */
+extern HAMLIB_EXPORT(int) rig_get_channel HAMLIB_PARAMS((RIG *rig, channel_t *chan));
+
+extern HAMLIB_EXPORT(int) rig_set_chan_all HAMLIB_PARAMS((RIG *rig, const channel_t chans[]));
+extern HAMLIB_EXPORT(int) rig_get_chan_all HAMLIB_PARAMS((RIG *rig, channel_t chans[]));
+extern HAMLIB_EXPORT(int) rig_set_chan_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, rig_ptr_t));
+extern HAMLIB_EXPORT(int) rig_get_chan_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, rig_ptr_t));
+
+extern HAMLIB_EXPORT(int) rig_set_mem_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t));
+extern HAMLIB_EXPORT(int) rig_get_mem_all_cb HAMLIB_PARAMS((RIG *rig, chan_cb_t chan_cb, confval_cb_t parm_cb, rig_ptr_t));
+extern HAMLIB_EXPORT(int) rig_set_mem_all HAMLIB_PARAMS((RIG *rig, const channel_t *chan, const struct confparams *, const value_t *));
+extern HAMLIB_EXPORT(int) rig_get_mem_all HAMLIB_PARAMS((RIG *rig, channel_t *chan, const struct confparams *, value_t *));
+extern HAMLIB_EXPORT(const chan_t *) rig_lookup_mem_caps HAMLIB_PARAMS((RIG *rig, int ch));
+extern HAMLIB_EXPORT(int) rig_mem_count HAMLIB_PARAMS((RIG *rig));
+
+
+extern HAMLIB_EXPORT(int) rig_set_trn HAMLIB_PARAMS((RIG *rig, int trn));
+extern HAMLIB_EXPORT(int) rig_get_trn HAMLIB_PARAMS((RIG *rig, int *trn));
+extern HAMLIB_EXPORT(int) rig_set_freq_callback HAMLIB_PARAMS((RIG *, freq_cb_t, rig_ptr_t));
+extern HAMLIB_EXPORT(int) rig_set_mode_callback HAMLIB_PARAMS((RIG *, mode_cb_t, rig_ptr_t));
+extern HAMLIB_EXPORT(int) rig_set_vfo_callback HAMLIB_PARAMS((RIG *, vfo_cb_t, rig_ptr_t));
+extern HAMLIB_EXPORT(int) rig_set_ptt_callback HAMLIB_PARAMS((RIG *, ptt_cb_t, rig_ptr_t));
+extern HAMLIB_EXPORT(int) rig_set_dcd_callback HAMLIB_PARAMS((RIG *, dcd_cb_t, rig_ptr_t));
+extern HAMLIB_EXPORT(int) rig_set_pltune_callback HAMLIB_PARAMS((RIG *, pltune_cb_t, rig_ptr_t));
+
+extern HAMLIB_EXPORT(const char *) rig_get_info HAMLIB_PARAMS((RIG *rig));
+
+extern HAMLIB_EXPORT(const struct rig_caps *) rig_get_caps HAMLIB_PARAMS((rig_model_t rig_model));
+extern HAMLIB_EXPORT(const freq_range_t *) rig_get_range HAMLIB_PARAMS((const freq_range_t range_list[], freq_t freq, rmode_t mode));
+
+extern HAMLIB_EXPORT(pbwidth_t) rig_passband_normal HAMLIB_PARAMS((RIG *rig, rmode_t mode));
+extern HAMLIB_EXPORT(pbwidth_t) rig_passband_narrow HAMLIB_PARAMS((RIG *rig, rmode_t mode));
+extern HAMLIB_EXPORT(pbwidth_t) rig_passband_wide HAMLIB_PARAMS((RIG *rig, rmode_t mode));
+
+extern HAMLIB_EXPORT(const char *) rigerror HAMLIB_PARAMS((int errnum));
+
+extern HAMLIB_EXPORT(int) rig_setting2idx HAMLIB_PARAMS((setting_t s));
+#define rig_idx2setting(i) (1UL<<(i))
+
+/*
+ * Even if these functions are prefixed with "rig_", they are not rig specific
+ * Maybe "hamlib_" would have been better. Let me know. --SF
+ */
+extern HAMLIB_EXPORT(void) rig_set_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level));
+#define rig_set_debug_level(level) rig_set_debug(level)
+extern HAMLIB_EXPORT(int) rig_need_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level));
+extern HAMLIB_EXPORT(void) rig_debug HAMLIB_PARAMS((enum rig_debug_level_e debug_level, const char *fmt, ...));
+extern HAMLIB_EXPORT(vprintf_cb_t) rig_set_debug_callback HAMLIB_PARAMS((vprintf_cb_t cb, rig_ptr_t arg));
+extern HAMLIB_EXPORT(FILE*) rig_set_debug_file HAMLIB_PARAMS((FILE *stream));
+
+extern HAMLIB_EXPORT(int) rig_register HAMLIB_PARAMS((const struct rig_caps *caps));
+extern HAMLIB_EXPORT(int) rig_unregister HAMLIB_PARAMS((rig_model_t rig_model));
+extern HAMLIB_EXPORT(int) rig_list_foreach HAMLIB_PARAMS((int (*cfunc)(const struct rig_caps*, rig_ptr_t), rig_ptr_t data));
+extern HAMLIB_EXPORT(int) rig_load_backend HAMLIB_PARAMS((const char *be_name));
+extern HAMLIB_EXPORT(int) rig_check_backend HAMLIB_PARAMS((rig_model_t rig_model));
+extern HAMLIB_EXPORT(int) rig_load_all_backends HAMLIB_PARAMS((void));
+
+typedef int (*rig_probe_func_t)(const hamlib_port_t *, rig_model_t, rig_ptr_t);
+extern HAMLIB_EXPORT(int) rig_probe_all HAMLIB_PARAMS((hamlib_port_t *p, rig_probe_func_t, rig_ptr_t));
+extern HAMLIB_EXPORT(rig_model_t) rig_probe HAMLIB_PARAMS((hamlib_port_t *p));
+
+
+/* Misc calls */
+extern HAMLIB_EXPORT(const char *) rig_strrmode(rmode_t mode);
+extern HAMLIB_EXPORT(const char *) rig_strvfo(vfo_t vfo);
+extern HAMLIB_EXPORT(const char *) rig_strfunc(setting_t);
+extern HAMLIB_EXPORT(const char *) rig_strlevel(setting_t);
+extern HAMLIB_EXPORT(const char *) rig_strparm(setting_t);
+extern HAMLIB_EXPORT(const char *) rig_strptrshift(rptr_shift_t);
+extern HAMLIB_EXPORT(const char *) rig_strvfop(vfo_op_t op);
+extern HAMLIB_EXPORT(const char *) rig_strscan(scan_t scan);
+extern HAMLIB_EXPORT(const char *) rig_strstatus(enum rig_status_e status);
+extern HAMLIB_EXPORT(const char *) rig_strmtype(chan_type_t mtype);
+
+extern HAMLIB_EXPORT(rmode_t) rig_parse_mode(const char *s);
+extern HAMLIB_EXPORT(vfo_t) rig_parse_vfo(const char *s);
+extern HAMLIB_EXPORT(setting_t) rig_parse_func(const char *s);
+extern HAMLIB_EXPORT(setting_t) rig_parse_level(const char *s);
+extern HAMLIB_EXPORT(setting_t) rig_parse_parm(const char *s);
+extern HAMLIB_EXPORT(vfo_op_t) rig_parse_vfo_op(const char *s);
+extern HAMLIB_EXPORT(scan_t) rig_parse_scan(const char *s);
+extern HAMLIB_EXPORT(rptr_shift_t) rig_parse_rptr_shift(const char *s);
+extern HAMLIB_EXPORT(chan_type_t) rig_parse_mtype(const char *s);
+
+
+__END_DECLS
+
+#endif /* _RIG_H */
+
+/*! @} */
diff --git a/src/Bindings/Hamlib/Rig.hsc b/src/Bindings/Hamlib/Rig.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Hamlib/Rig.hsc
@@ -0,0 +1,1509 @@
+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
+#include <bindings.dsl.h>
+#include "rig.h"
+#include "Rig.h"
+
+module Bindings.Hamlib.Rig where
+import Foreign.Ptr
+#strict_import
+
+#globalvar hamlib_version , CChar
+#globalvar hamlib_copyright , CChar
+{- enum rig_errcode_e {
+    RIG_OK = 0,
+    RIG_EINVAL,
+    RIG_ECONF,
+    RIG_ENOMEM,
+    RIG_ENIMPL,
+    RIG_ETIMEOUT,
+    RIG_EIO,
+    RIG_EINTERNAL,
+    RIG_EPROTO,
+    RIG_ERJCTED,
+    RIG_ETRUNC,
+    RIG_ENAVAIL,
+    RIG_ENTARGET,
+    RIG_BUSERROR,
+    RIG_BUSBUSY,
+    RIG_EARG,
+    RIG_EVFO,
+    RIG_EDOM
+}; -}
+#integral_t enum rig_errcode_e
+#num RIG_OK
+#num RIG_EINVAL
+#num RIG_ECONF
+#num RIG_ENOMEM
+#num RIG_ENIMPL
+#num RIG_ETIMEOUT
+#num RIG_EIO
+#num RIG_EINTERNAL
+#num RIG_EPROTO
+#num RIG_ERJCTED
+#num RIG_ETRUNC
+#num RIG_ENAVAIL
+#num RIG_ENTARGET
+#num RIG_BUSERROR
+#num RIG_BUSBUSY
+#num RIG_EARG
+#num RIG_EVFO
+#num RIG_EDOM
+{- enum rig_debug_level_e {
+    RIG_DEBUG_NONE = 0,
+    RIG_DEBUG_BUG,
+    RIG_DEBUG_ERR,
+    RIG_DEBUG_WARN,
+    RIG_DEBUG_VERBOSE,
+    RIG_DEBUG_TRACE
+}; -}
+#integral_t enum rig_debug_level_e
+#num RIG_DEBUG_NONE
+#num RIG_DEBUG_BUG
+#num RIG_DEBUG_ERR
+#num RIG_DEBUG_WARN
+#num RIG_DEBUG_VERBOSE
+#num RIG_DEBUG_TRACE
+#synonym_t RIG , <struct rig>
+{- typedef unsigned int tone_t; -}
+#synonym_t tone_t , CUInt
+{- typedef enum rig_port_e {
+            RIG_PORT_NONE = 0,
+            RIG_PORT_SERIAL,
+            RIG_PORT_NETWORK,
+            RIG_PORT_DEVICE,
+            RIG_PORT_PACKET,
+            RIG_PORT_DTMF,
+            RIG_PORT_ULTRA,
+            RIG_PORT_RPC,
+            RIG_PORT_PARALLEL,
+            RIG_PORT_USB,
+            RIG_PORT_UDP_NETWORK,
+            RIG_PORT_CM108
+        } rig_port_t; -}
+#integral_t enum rig_port_e
+#num RIG_PORT_NONE
+#num RIG_PORT_SERIAL
+#num RIG_PORT_NETWORK
+#num RIG_PORT_DEVICE
+#num RIG_PORT_PACKET
+#num RIG_PORT_DTMF
+#num RIG_PORT_ULTRA
+#num RIG_PORT_RPC
+#num RIG_PORT_PARALLEL
+#num RIG_PORT_USB
+#num RIG_PORT_UDP_NETWORK
+#num RIG_PORT_CM108
+#synonym_t rig_port_t , <enum rig_port_e>
+{- enum serial_parity_e {
+    RIG_PARITY_NONE = 0,
+    RIG_PARITY_ODD,
+    RIG_PARITY_EVEN,
+    RIG_PARITY_MARK,
+    RIG_PARITY_SPACE
+}; -}
+#integral_t enum serial_parity_e
+#num RIG_PARITY_NONE
+#num RIG_PARITY_ODD
+#num RIG_PARITY_EVEN
+#num RIG_PARITY_MARK
+#num RIG_PARITY_SPACE
+{- enum serial_handshake_e {
+    RIG_HANDSHAKE_NONE = 0,
+    RIG_HANDSHAKE_XONXOFF,
+    RIG_HANDSHAKE_HARDWARE
+}; -}
+#integral_t enum serial_handshake_e
+#num RIG_HANDSHAKE_NONE
+#num RIG_HANDSHAKE_XONXOFF
+#num RIG_HANDSHAKE_HARDWARE
+{- enum serial_control_state_e {
+    RIG_SIGNAL_UNSET = 0, RIG_SIGNAL_ON, RIG_SIGNAL_OFF
+}; -}
+#integral_t enum serial_control_state_e
+#num RIG_SIGNAL_UNSET
+#num RIG_SIGNAL_ON
+#num RIG_SIGNAL_OFF
+{- typedef enum {
+            RIG_FLAG_RECEIVER = 1 << 1,
+            RIG_FLAG_TRANSMITTER = 1 << 2,
+            RIG_FLAG_SCANNER = 1 << 3,
+            RIG_FLAG_MOBILE = 1 << 4,
+            RIG_FLAG_HANDHELD = 1 << 5,
+            RIG_FLAG_COMPUTER = 1 << 6,
+            RIG_FLAG_TRUNKING = 1 << 7,
+            RIG_FLAG_APRS = 1 << 8,
+            RIG_FLAG_TNC = 1 << 9,
+            RIG_FLAG_DXCLUSTER = 1 << 10,
+            RIG_FLAG_TUNER = 1 << 11
+        } rig_type_t; -}
+#integral_t rig_type_t
+#num RIG_FLAG_RECEIVER
+#num RIG_FLAG_TRANSMITTER
+#num RIG_FLAG_SCANNER
+#num RIG_FLAG_MOBILE
+#num RIG_FLAG_HANDHELD
+#num RIG_FLAG_COMPUTER
+#num RIG_FLAG_TRUNKING
+#num RIG_FLAG_APRS
+#num RIG_FLAG_TNC
+#num RIG_FLAG_DXCLUSTER
+#num RIG_FLAG_TUNER
+{- enum rig_status_e {
+    RIG_STATUS_ALPHA = 0,
+    RIG_STATUS_UNTESTED,
+    RIG_STATUS_BETA,
+    RIG_STATUS_STABLE,
+    RIG_STATUS_BUGGY
+}; -}
+#integral_t enum rig_status_e
+#num RIG_STATUS_ALPHA
+#num RIG_STATUS_UNTESTED
+#num RIG_STATUS_BETA
+#num RIG_STATUS_STABLE
+#num RIG_STATUS_BUGGY
+{- typedef enum {
+            RIG_RPT_SHIFT_NONE = 0, RIG_RPT_SHIFT_MINUS, RIG_RPT_SHIFT_PLUS
+        } rptr_shift_t; -}
+#integral_t rptr_shift_t
+#num RIG_RPT_SHIFT_NONE
+#num RIG_RPT_SHIFT_MINUS
+#num RIG_RPT_SHIFT_PLUS
+{- typedef enum {
+            RIG_SPLIT_OFF = 0, RIG_SPLIT_ON
+        } split_t; -}
+#integral_t split_t
+#num RIG_SPLIT_OFF
+#num RIG_SPLIT_ON
+{- typedef double freq_t; -}
+#synonym_t freq_t , CDouble
+{- typedef signed long shortfreq_t; -}
+#synonym_t shortfreq_t , CLong
+{- typedef int vfo_t; -}
+#synonym_t vfo_t , CInt
+{- typedef shortfreq_t pbwidth_t; -}
+#synonym_t pbwidth_t , CLong
+{- typedef enum dcd_e {
+            RIG_DCD_OFF = 0, RIG_DCD_ON
+        } dcd_t; -}
+#integral_t enum dcd_e
+#num RIG_DCD_OFF
+#num RIG_DCD_ON
+#synonym_t dcd_t , <enum dcd_e>
+{- typedef enum {
+            RIG_DCD_NONE = 0,
+            RIG_DCD_RIG,
+            RIG_DCD_SERIAL_DSR,
+            RIG_DCD_SERIAL_CTS,
+            RIG_DCD_SERIAL_CAR,
+            RIG_DCD_PARALLEL,
+            RIG_DCD_CM108
+        } dcd_type_t; -}
+#integral_t dcd_type_t
+#num RIG_DCD_NONE
+#num RIG_DCD_RIG
+#num RIG_DCD_SERIAL_DSR
+#num RIG_DCD_SERIAL_CTS
+#num RIG_DCD_SERIAL_CAR
+#num RIG_DCD_PARALLEL
+#num RIG_DCD_CM108
+{- typedef enum {
+            RIG_PTT_OFF = 0, RIG_PTT_ON, RIG_PTT_ON_MIC, RIG_PTT_ON_DATA
+        } ptt_t; -}
+#integral_t ptt_t
+#num RIG_PTT_OFF
+#num RIG_PTT_ON
+#num RIG_PTT_ON_MIC
+#num RIG_PTT_ON_DATA
+{- typedef enum {
+            RIG_PTT_NONE = 0,
+            RIG_PTT_RIG,
+            RIG_PTT_SERIAL_DTR,
+            RIG_PTT_SERIAL_RTS,
+            RIG_PTT_PARALLEL,
+            RIG_PTT_RIG_MICDATA,
+            RIG_PTT_CM108
+        } ptt_type_t; -}
+#integral_t ptt_type_t
+#num RIG_PTT_NONE
+#num RIG_PTT_RIG
+#num RIG_PTT_SERIAL_DTR
+#num RIG_PTT_SERIAL_RTS
+#num RIG_PTT_PARALLEL
+#num RIG_PTT_RIG_MICDATA
+#num RIG_PTT_CM108
+{- typedef enum {
+            RIG_POWER_OFF = 0,
+            RIG_POWER_ON = 1 << 0,
+            RIG_POWER_STANDBY = 1 << 1
+        } powerstat_t; -}
+#integral_t powerstat_t
+#num RIG_POWER_OFF
+#num RIG_POWER_ON
+#num RIG_POWER_STANDBY
+{- typedef enum {
+            RIG_RESET_NONE = 0,
+            RIG_RESET_SOFT = 1 << 0,
+            RIG_RESET_VFO = 1 << 1,
+            RIG_RESET_MCALL = 1 << 2,
+            RIG_RESET_MASTER = 1 << 3
+        } reset_t; -}
+#integral_t reset_t
+#num RIG_RESET_NONE
+#num RIG_RESET_SOFT
+#num RIG_RESET_VFO
+#num RIG_RESET_MCALL
+#num RIG_RESET_MASTER
+{- typedef enum {
+            RIG_OP_NONE = 0,
+            RIG_OP_CPY = 1 << 0,
+            RIG_OP_XCHG = 1 << 1,
+            RIG_OP_FROM_VFO = 1 << 2,
+            RIG_OP_TO_VFO = 1 << 3,
+            RIG_OP_MCL = 1 << 4,
+            RIG_OP_UP = 1 << 5,
+            RIG_OP_DOWN = 1 << 6,
+            RIG_OP_BAND_UP = 1 << 7,
+            RIG_OP_BAND_DOWN = 1 << 8,
+            RIG_OP_LEFT = 1 << 9,
+            RIG_OP_RIGHT = 1 << 10,
+            RIG_OP_TUNE = 1 << 11,
+            RIG_OP_TOGGLE = 1 << 12
+        } vfo_op_t; -}
+#integral_t vfo_op_t
+#num RIG_OP_NONE
+#num RIG_OP_CPY
+#num RIG_OP_XCHG
+#num RIG_OP_FROM_VFO
+#num RIG_OP_TO_VFO
+#num RIG_OP_MCL
+#num RIG_OP_UP
+#num RIG_OP_DOWN
+#num RIG_OP_BAND_UP
+#num RIG_OP_BAND_DOWN
+#num RIG_OP_LEFT
+#num RIG_OP_RIGHT
+#num RIG_OP_TUNE
+#num RIG_OP_TOGGLE
+{- typedef enum {
+            RIG_SCAN_NONE = 0,
+            RIG_SCAN_STOP = RIG_SCAN_NONE,
+            RIG_SCAN_MEM = 1 << 0,
+            RIG_SCAN_SLCT = 1 << 1,
+            RIG_SCAN_PRIO = 1 << 2,
+            RIG_SCAN_PROG = 1 << 3,
+            RIG_SCAN_DELTA = 1 << 4,
+            RIG_SCAN_VFO = 1 << 5,
+            RIG_SCAN_PLT = 1 << 6
+        } scan_t; -}
+#integral_t scan_t
+#num RIG_SCAN_NONE
+#num RIG_SCAN_STOP
+#num RIG_SCAN_MEM
+#num RIG_SCAN_SLCT
+#num RIG_SCAN_PRIO
+#num RIG_SCAN_PROG
+#num RIG_SCAN_DELTA
+#num RIG_SCAN_VFO
+#num RIG_SCAN_PLT
+{- typedef long token_t; -}
+#synonym_t token_t , CLong
+{- enum rig_conf_e {
+    RIG_CONF_STRING,
+    RIG_CONF_COMBO,
+    RIG_CONF_NUMERIC,
+    RIG_CONF_CHECKBUTTON,
+    RIG_CONF_BUTTON
+}; -}
+#integral_t enum rig_conf_e
+#num RIG_CONF_STRING
+#num RIG_CONF_COMBO
+#num RIG_CONF_NUMERIC
+#num RIG_CONF_CHECKBUTTON
+#num RIG_CONF_BUTTON
+{- struct confparams {
+    token_t token;
+    const char * name;
+    const char * label;
+    const char * tooltip;
+    const char * dflt;
+    enum rig_conf_e type;
+    union u {
+        struct n {
+            float min; float max; float step;
+        } n;
+        struct c {
+            const char * combostr[8];
+        } c;
+    } u;
+}; -}
+
+#starttype struct n
+#field min , CFloat
+#field max , CFloat
+#field step , CFloat
+#stoptype
+
+#starttype struct c
+#field combostr , CString
+#stoptype
+
+#starttype union u
+#field n , <struct n>
+#field c , <struct c>
+#stoptype
+
+#starttype struct confparams
+#field token , CLong
+#field name , CString
+#field label , CString
+#field tooltip , CString
+#field dflt , CString
+#field type , <enum rig_conf_e>
+#field u , <union u>
+#stoptype
+{- typedef enum {
+            RIG_ANN_NONE = 0,
+            RIG_ANN_OFF = RIG_ANN_NONE,
+            RIG_ANN_FREQ = 1 << 0,
+            RIG_ANN_RXMODE = 1 << 1,
+            RIG_ANN_CW = 1 << 2,
+            RIG_ANN_ENG = 1 << 3,
+            RIG_ANN_JAP = 1 << 4
+        } ann_t; -}
+#integral_t ann_t
+#num RIG_ANN_NONE
+#num RIG_ANN_OFF
+#num RIG_ANN_FREQ
+#num RIG_ANN_RXMODE
+#num RIG_ANN_CW
+#num RIG_ANN_ENG
+#num RIG_ANN_JAP
+{- typedef int ant_t; -}
+#synonym_t ant_t , CInt
+{- enum agc_level_e {
+    RIG_AGC_OFF = 0,
+    RIG_AGC_SUPERFAST,
+    RIG_AGC_FAST,
+    RIG_AGC_SLOW,
+    RIG_AGC_USER,
+    RIG_AGC_MEDIUM,
+    RIG_AGC_AUTO
+}; -}
+#integral_t enum agc_level_e
+#num RIG_AGC_OFF
+#num RIG_AGC_SUPERFAST
+#num RIG_AGC_FAST
+#num RIG_AGC_SLOW
+#num RIG_AGC_USER
+#num RIG_AGC_MEDIUM
+#num RIG_AGC_AUTO
+{- enum meter_level_e {
+    RIG_METER_NONE = 0,
+    RIG_METER_SWR = 1 << 0,
+    RIG_METER_COMP = 1 << 1,
+    RIG_METER_ALC = 1 << 2,
+    RIG_METER_IC = 1 << 3,
+    RIG_METER_DB = 1 << 4,
+    RIG_METER_PO = 1 << 5,
+    RIG_METER_VDD = 1 << 6
+}; -}
+#integral_t enum meter_level_e
+#num RIG_METER_NONE
+#num RIG_METER_SWR
+#num RIG_METER_COMP
+#num RIG_METER_ALC
+#num RIG_METER_IC
+#num RIG_METER_DB
+#num RIG_METER_PO
+#num RIG_METER_VDD
+{- typedef union {
+            signed int i; float f; char * s; const char * cs;
+        } value_t; -}
+#starttype value_t
+#field i , CInt
+#field f , CFloat
+#field s , CString
+#field cs , CString
+#stoptype
+{- enum rig_level_e {
+    RIG_LEVEL_NONE = 0,
+    RIG_LEVEL_PREAMP = 1 << 0,
+    RIG_LEVEL_ATT = 1 << 1,
+    RIG_LEVEL_VOX = 1 << 2,
+    RIG_LEVEL_AF = 1 << 3,
+    RIG_LEVEL_RF = 1 << 4,
+    RIG_LEVEL_SQL = 1 << 5,
+    RIG_LEVEL_IF = 1 << 6,
+    RIG_LEVEL_APF = 1 << 7,
+    RIG_LEVEL_NR = 1 << 8,
+    RIG_LEVEL_PBT_IN = 1 << 9,
+    RIG_LEVEL_PBT_OUT = 1 << 10,
+    RIG_LEVEL_CWPITCH = 1 << 11,
+    RIG_LEVEL_RFPOWER = 1 << 12,
+    RIG_LEVEL_MICGAIN = 1 << 13,
+    RIG_LEVEL_KEYSPD = 1 << 14,
+    RIG_LEVEL_NOTCHF = 1 << 15,
+    RIG_LEVEL_COMP = 1 << 16,
+    RIG_LEVEL_AGC = 1 << 17,
+    RIG_LEVEL_BKINDL = 1 << 18,
+    RIG_LEVEL_BALANCE = 1 << 19,
+    RIG_LEVEL_METER = 1 << 20,
+    RIG_LEVEL_VOXGAIN = 1 << 21,
+    RIG_LEVEL_VOXDELAY = RIG_LEVEL_VOX,
+    RIG_LEVEL_ANTIVOX = 1 << 22,
+    RIG_LEVEL_SLOPE_LOW = 1 << 23,
+    RIG_LEVEL_SLOPE_HIGH = 1 << 24,
+    RIG_LEVEL_BKIN_DLYMS = 1 << 25,
+    RIG_LEVEL_RAWSTR = 1 << 26,
+    RIG_LEVEL_SQLSTAT = 1 << 27,
+    RIG_LEVEL_SWR = 1 << 28,
+    RIG_LEVEL_ALC = 1 << 29,
+    RIG_LEVEL_STRENGTH = 1 << 30
+}; -}
+#integral_t enum rig_level_e
+#num RIG_LEVEL_NONE
+#num RIG_LEVEL_PREAMP
+#num RIG_LEVEL_ATT
+#num RIG_LEVEL_VOX
+#num RIG_LEVEL_AF
+#num RIG_LEVEL_RF
+#num RIG_LEVEL_SQL
+#num RIG_LEVEL_IF
+#num RIG_LEVEL_APF
+#num RIG_LEVEL_NR
+#num RIG_LEVEL_PBT_IN
+#num RIG_LEVEL_PBT_OUT
+#num RIG_LEVEL_CWPITCH
+#num RIG_LEVEL_RFPOWER
+#num RIG_LEVEL_MICGAIN
+#num RIG_LEVEL_KEYSPD
+#num RIG_LEVEL_NOTCHF
+#num RIG_LEVEL_COMP
+#num RIG_LEVEL_AGC
+#num RIG_LEVEL_BKINDL
+#num RIG_LEVEL_BALANCE
+#num RIG_LEVEL_METER
+#num RIG_LEVEL_VOXGAIN
+#num RIG_LEVEL_VOXDELAY
+#num RIG_LEVEL_ANTIVOX
+#num RIG_LEVEL_SLOPE_LOW
+#num RIG_LEVEL_SLOPE_HIGH
+#num RIG_LEVEL_BKIN_DLYMS
+#num RIG_LEVEL_RAWSTR
+#num RIG_LEVEL_SQLSTAT
+#num RIG_LEVEL_SWR
+#num RIG_LEVEL_ALC
+#num RIG_LEVEL_STRENGTH
+{- enum rig_parm_e {
+    RIG_PARM_NONE = 0,
+    RIG_PARM_ANN = 1 << 0,
+    RIG_PARM_APO = 1 << 1,
+    RIG_PARM_BACKLIGHT = 1 << 2,
+    RIG_PARM_BEEP = 1 << 4,
+    RIG_PARM_TIME = 1 << 5,
+    RIG_PARM_BAT = 1 << 6,
+    RIG_PARM_KEYLIGHT = 1 << 7
+}; -}
+#integral_t enum rig_parm_e
+#num RIG_PARM_NONE
+#num RIG_PARM_ANN
+#num RIG_PARM_APO
+#num RIG_PARM_BACKLIGHT
+#num RIG_PARM_BEEP
+#num RIG_PARM_TIME
+#num RIG_PARM_BAT
+#num RIG_PARM_KEYLIGHT
+{- typedef unsigned long setting_t; -}
+#synonym_t setting_t , CULong
+{- enum rig_func_e {
+    RIG_FUNC_NONE = 0,
+    RIG_FUNC_FAGC = 1 << 0,
+    RIG_FUNC_NB = 1 << 1,
+    RIG_FUNC_COMP = 1 << 2,
+    RIG_FUNC_VOX = 1 << 3,
+    RIG_FUNC_TONE = 1 << 4,
+    RIG_FUNC_TSQL = 1 << 5,
+    RIG_FUNC_SBKIN = 1 << 6,
+    RIG_FUNC_FBKIN = 1 << 7,
+    RIG_FUNC_ANF = 1 << 8,
+    RIG_FUNC_NR = 1 << 9,
+    RIG_FUNC_AIP = 1 << 10,
+    RIG_FUNC_APF = 1 << 11,
+    RIG_FUNC_MON = 1 << 12,
+    RIG_FUNC_MN = 1 << 13,
+    RIG_FUNC_RF = 1 << 14,
+    RIG_FUNC_ARO = 1 << 15,
+    RIG_FUNC_LOCK = 1 << 16,
+    RIG_FUNC_MUTE = 1 << 17,
+    RIG_FUNC_VSC = 1 << 18,
+    RIG_FUNC_REV = 1 << 19,
+    RIG_FUNC_SQL = 1 << 20,
+    RIG_FUNC_ABM = 1 << 21,
+    RIG_FUNC_BC = 1 << 22,
+    RIG_FUNC_MBC = 1 << 23,
+    RIG_FUNC_AFC = 1 << 25,
+    RIG_FUNC_SATMODE = 1 << 26,
+    RIG_FUNC_SCOPE = 1 << 27,
+    RIG_FUNC_RESUME = 1 << 28,
+    RIG_FUNC_TBURST = 1 << 29,
+    RIG_FUNC_TUNER = 1 << 30
+}; -}
+#integral_t enum rig_func_e
+#num RIG_FUNC_NONE
+#num RIG_FUNC_FAGC
+#num RIG_FUNC_NB
+#num RIG_FUNC_COMP
+#num RIG_FUNC_VOX
+#num RIG_FUNC_TONE
+#num RIG_FUNC_TSQL
+#num RIG_FUNC_SBKIN
+#num RIG_FUNC_FBKIN
+#num RIG_FUNC_ANF
+#num RIG_FUNC_NR
+#num RIG_FUNC_AIP
+#num RIG_FUNC_APF
+#num RIG_FUNC_MON
+#num RIG_FUNC_MN
+#num RIG_FUNC_RF
+#num RIG_FUNC_ARO
+#num RIG_FUNC_LOCK
+#num RIG_FUNC_MUTE
+#num RIG_FUNC_VSC
+#num RIG_FUNC_REV
+#num RIG_FUNC_SQL
+#num RIG_FUNC_ABM
+#num RIG_FUNC_BC
+#num RIG_FUNC_MBC
+#num RIG_FUNC_AFC
+#num RIG_FUNC_SATMODE
+#num RIG_FUNC_SCOPE
+#num RIG_FUNC_RESUME
+#num RIG_FUNC_TBURST
+#num RIG_FUNC_TUNER
+{- typedef enum {
+            RIG_MODE_NONE = 0,
+            RIG_MODE_AM = 1 << 0,
+            RIG_MODE_CW = 1 << 1,
+            RIG_MODE_USB = 1 << 2,
+            RIG_MODE_LSB = 1 << 3,
+            RIG_MODE_RTTY = 1 << 4,
+            RIG_MODE_FM = 1 << 5,
+            RIG_MODE_WFM = 1 << 6,
+            RIG_MODE_CWR = 1 << 7,
+            RIG_MODE_RTTYR = 1 << 8,
+            RIG_MODE_AMS = 1 << 9,
+            RIG_MODE_PKTLSB = 1 << 10,
+            RIG_MODE_PKTUSB = 1 << 11,
+            RIG_MODE_PKTFM = 1 << 12,
+            RIG_MODE_ECSSUSB = 1 << 13,
+            RIG_MODE_ECSSLSB = 1 << 14,
+            RIG_MODE_FAX = 1 << 15,
+            RIG_MODE_SAM = 1 << 16,
+            RIG_MODE_SAL = 1 << 17,
+            RIG_MODE_SAH = 1 << 18,
+            RIG_MODE_DSB = 1 << 19,
+            RIG_MODE_TESTS_MAX
+        } rmode_t; -}
+#integral_t rmode_t
+#num RIG_MODE_NONE
+#num RIG_MODE_AM
+#num RIG_MODE_CW
+#num RIG_MODE_USB
+#num RIG_MODE_LSB
+#num RIG_MODE_RTTY
+#num RIG_MODE_FM
+#num RIG_MODE_WFM
+#num RIG_MODE_CWR
+#num RIG_MODE_RTTYR
+#num RIG_MODE_AMS
+#num RIG_MODE_PKTLSB
+#num RIG_MODE_PKTUSB
+#num RIG_MODE_PKTFM
+#num RIG_MODE_ECSSUSB
+#num RIG_MODE_ECSSLSB
+#num RIG_MODE_FAX
+#num RIG_MODE_SAM
+#num RIG_MODE_SAL
+#num RIG_MODE_SAH
+#num RIG_MODE_DSB
+#num RIG_MODE_TESTS_MAX
+{- typedef struct freq_range_list {
+            freq_t start;
+            freq_t end;
+            rmode_t modes;
+            int low_power;
+            int high_power;
+            vfo_t vfo;
+            ant_t ant;
+        } freq_range_t; -}
+#starttype struct freq_range_list
+#field start , CDouble
+#field end , CDouble
+#field modes , <rmode_t>
+#field low_power , CInt
+#field high_power , CInt
+#field vfo , CInt
+#field ant , CInt
+#stoptype
+#synonym_t freq_range_t , <struct freq_range_list>
+{- struct tuning_step_list {
+    rmode_t modes; shortfreq_t ts;
+}; -}
+#starttype struct tuning_step_list
+#field modes , <rmode_t>
+#field ts , CLong
+#stoptype
+{- struct filter_list {
+    rmode_t modes; pbwidth_t width;
+}; -}
+#starttype struct filter_list
+#field modes , <rmode_t>
+#field width , CLong
+#stoptype
+{- struct ext_list {
+    token_t token; value_t val;
+}; -}
+#starttype struct ext_list
+#field token , CLong
+#field val , <value_t>
+#stoptype
+{- struct channel {
+    int channel_num;
+    int bank_num;
+    vfo_t vfo;
+    int ant;
+    freq_t freq;
+    rmode_t mode;
+    pbwidth_t width;
+    freq_t tx_freq;
+    rmode_t tx_mode;
+    pbwidth_t tx_width;
+    split_t split;
+    vfo_t tx_vfo;
+    rptr_shift_t rptr_shift;
+    shortfreq_t rptr_offs;
+    shortfreq_t tuning_step;
+    shortfreq_t rit;
+    shortfreq_t xit;
+    setting_t funcs;
+    value_t levels[32];
+    tone_t ctcss_tone;
+    tone_t ctcss_sql;
+    tone_t dcs_code;
+    tone_t dcs_sql;
+    int scan_group;
+    int flags;
+    char channel_desc[30];
+    struct ext_list * ext_levels;
+}; -}
+#starttype struct channel
+#field channel_num , CInt
+#field bank_num , CInt
+#field vfo , CInt
+#field ant , CInt
+#field freq , CDouble
+#field mode , <rmode_t>
+#field width , CLong
+#field tx_freq , CDouble
+#field tx_mode , <rmode_t>
+#field tx_width , CLong
+#field split , <split_t>
+#field tx_vfo , CInt
+#field rptr_shift , <rptr_shift_t>
+#field rptr_offs , CLong
+#field tuning_step , CLong
+#field rit , CLong
+#field xit , CLong
+#field funcs , CULong
+#array_field levels , <value_t>
+#field ctcss_tone , CUInt
+#field ctcss_sql , CUInt
+#field dcs_code , CUInt
+#field dcs_sql , CUInt
+#field scan_group , CInt
+#field flags , CInt
+#field channel_desc , CString
+#field ext_levels , Ptr <struct ext_list>
+#stoptype
+{- typedef struct channel channel_t; -}
+#synonym_t channel_t , <struct channel>
+{- struct channel_cap {
+    unsigned bank_num : 1;
+    unsigned vfo : 1;
+    unsigned ant : 1;
+    unsigned freq : 1;
+    unsigned mode : 1;
+    unsigned width : 1;
+    unsigned tx_freq : 1;
+    unsigned tx_mode : 1;
+    unsigned tx_width : 1;
+    unsigned split : 1;
+    unsigned tx_vfo : 1;
+    unsigned rptr_shift : 1;
+    unsigned rptr_offs : 1;
+    unsigned tuning_step : 1;
+    unsigned rit : 1;
+    unsigned xit : 1;
+    setting_t funcs;
+    setting_t levels;
+    unsigned ctcss_tone : 1;
+    unsigned ctcss_sql : 1;
+    unsigned dcs_code : 1;
+    unsigned dcs_sql : 1;
+    unsigned scan_group : 1;
+    unsigned flags : 1;
+    unsigned channel_desc : 1;
+    unsigned ext_levels : 1;
+}; -}
+#starttype struct channel_cap
+
+#stoptype
+{- typedef struct channel_cap channel_cap_t; -}
+#synonym_t channel_cap_t , <struct channel_cap>
+{- typedef enum {
+            RIG_MTYPE_NONE = 0,
+            RIG_MTYPE_MEM,
+            RIG_MTYPE_EDGE,
+            RIG_MTYPE_CALL,
+            RIG_MTYPE_MEMOPAD,
+            RIG_MTYPE_SAT,
+            RIG_MTYPE_BAND,
+            RIG_MTYPE_PRIO
+        } chan_type_t; -}
+#integral_t chan_type_t
+#num RIG_MTYPE_NONE
+#num RIG_MTYPE_MEM
+#num RIG_MTYPE_EDGE
+#num RIG_MTYPE_CALL
+#num RIG_MTYPE_MEMOPAD
+#num RIG_MTYPE_SAT
+#num RIG_MTYPE_BAND
+#num RIG_MTYPE_PRIO
+{- struct chan_list {
+    int start; int end; chan_type_t type; channel_cap_t mem_caps;
+}; -}
+#starttype struct chan_list
+#field start , CInt
+#field end , CInt
+#field type , <chan_type_t>
+#field mem_caps , <struct channel_cap>
+#stoptype
+{- typedef struct chan_list chan_t; -}
+#synonym_t chan_t , <struct chan_list>
+{- struct gran {
+    value_t min; value_t max; value_t step;
+}; -}
+#starttype struct gran
+#field min , <value_t>
+#field max , <value_t>
+#field step , <value_t>
+#stoptype
+{- typedef struct gran gran_t; -}
+#synonym_t gran_t , <struct gran>
+{- struct cal_table {
+    int size;
+    struct table {
+        int raw; int val;
+    } table[32];
+}; -}
+#starttype struct table
+#field raw , CInt
+#field val , CInt
+#stoptype
+
+#starttype struct cal_table
+#field size , CInt
+#array_field table , <struct table>
+#stoptype
+{- typedef struct cal_table cal_table_t; -}
+#synonym_t cal_table_t , <struct cal_table>
+#callback chan_cb_t , Ptr <struct rig> -> Ptr (Ptr <struct channel>) -> CInt -> Ptr <struct chan_list> -> Ptr () -> IO CInt
+#callback confval_cb_t , Ptr <struct rig> -> Ptr <struct confparams> -> Ptr <value_t> -> Ptr () -> IO CInt
+{- struct rig_caps {
+    rig_model_t rig_model;
+    const char * model_name;
+    const char * mfg_name;
+    const char * version;
+    const char * copyright;
+    enum rig_status_e status;
+    int rig_type;
+    ptt_type_t ptt_type;
+    dcd_type_t dcd_type;
+    rig_port_t port_type;
+    int serial_rate_min;
+    int serial_rate_max;
+    int serial_data_bits;
+    int serial_stop_bits;
+    enum serial_parity_e serial_parity;
+    enum serial_handshake_e serial_handshake;
+    int write_delay;
+    int post_write_delay;
+    int timeout;
+    int retry;
+    setting_t has_get_func;
+    setting_t has_set_func;
+    setting_t has_get_level;
+    setting_t has_set_level;
+    setting_t has_get_parm;
+    setting_t has_set_parm;
+    gran_t level_gran[32];
+    gran_t parm_gran[32];
+    const struct confparams * extparms;
+    const struct confparams * extlevels;
+    const tone_t * ctcss_list;
+    const tone_t * dcs_list;
+    int preamp[8];
+    int attenuator[8];
+    shortfreq_t max_rit;
+    shortfreq_t max_xit;
+    shortfreq_t max_ifshift;
+    ann_t announces;
+    vfo_op_t vfo_ops;
+    scan_t scan_ops;
+    int targetable_vfo;
+    int transceive;
+    int bank_qty;
+    int chan_desc_sz;
+    chan_t chan_list[16];
+    freq_range_t rx_range_list1[30];
+    freq_range_t tx_range_list1[30];
+    freq_range_t rx_range_list2[30];
+    freq_range_t tx_range_list2[30];
+    struct tuning_step_list tuning_steps[20];
+    struct filter_list filters[42];
+    cal_table_t str_cal;
+    const struct confparams * cfgparams;
+    const void * priv;
+    int (* rig_init)(RIG * rig);
+    int (* rig_cleanup)(RIG * rig);
+    int (* rig_open)(RIG * rig);
+    int (* rig_close)(RIG * rig);
+    int (* set_freq)(RIG * rig, vfo_t vfo, freq_t freq);
+    int (* get_freq)(RIG * rig, vfo_t vfo, freq_t * freq);
+    int (* set_mode)(RIG * rig,
+                     vfo_t vfo,
+                     rmode_t mode,
+                     pbwidth_t width);
+    int (* get_mode)(RIG * rig,
+                     vfo_t vfo,
+                     rmode_t * mode,
+                     pbwidth_t * width);
+    int (* set_vfo)(RIG * rig, vfo_t vfo);
+    int (* get_vfo)(RIG * rig, vfo_t * vfo);
+    int (* set_ptt)(RIG * rig, vfo_t vfo, ptt_t ptt);
+    int (* get_ptt)(RIG * rig, vfo_t vfo, ptt_t * ptt);
+    int (* get_dcd)(RIG * rig, vfo_t vfo, dcd_t * dcd);
+    int (* set_rptr_shift)(RIG * rig,
+                           vfo_t vfo,
+                           rptr_shift_t rptr_shift);
+    int (* get_rptr_shift)(RIG * rig,
+                           vfo_t vfo,
+                           rptr_shift_t * rptr_shift);
+    int (* set_rptr_offs)(RIG * rig, vfo_t vfo, shortfreq_t offs);
+    int (* get_rptr_offs)(RIG * rig, vfo_t vfo, shortfreq_t * offs);
+    int (* set_split_freq)(RIG * rig, vfo_t vfo, freq_t tx_freq);
+    int (* get_split_freq)(RIG * rig, vfo_t vfo, freq_t * tx_freq);
+    int (* set_split_mode)(RIG * rig,
+                           vfo_t vfo,
+                           rmode_t tx_mode,
+                           pbwidth_t tx_width);
+    int (* get_split_mode)(RIG * rig,
+                           vfo_t vfo,
+                           rmode_t * tx_mode,
+                           pbwidth_t * tx_width);
+    int (* set_split_vfo)(RIG * rig,
+                          vfo_t vfo,
+                          split_t split,
+                          vfo_t tx_vfo);
+    int (* get_split_vfo)(RIG * rig,
+                          vfo_t vfo,
+                          split_t * split,
+                          vfo_t * tx_vfo);
+    int (* set_rit)(RIG * rig, vfo_t vfo, shortfreq_t rit);
+    int (* get_rit)(RIG * rig, vfo_t vfo, shortfreq_t * rit);
+    int (* set_xit)(RIG * rig, vfo_t vfo, shortfreq_t xit);
+    int (* get_xit)(RIG * rig, vfo_t vfo, shortfreq_t * xit);
+    int (* set_ts)(RIG * rig, vfo_t vfo, shortfreq_t ts);
+    int (* get_ts)(RIG * rig, vfo_t vfo, shortfreq_t * ts);
+    int (* set_dcs_code)(RIG * rig, vfo_t vfo, tone_t code);
+    int (* get_dcs_code)(RIG * rig, vfo_t vfo, tone_t * code);
+    int (* set_tone)(RIG * rig, vfo_t vfo, tone_t tone);
+    int (* get_tone)(RIG * rig, vfo_t vfo, tone_t * tone);
+    int (* set_ctcss_tone)(RIG * rig, vfo_t vfo, tone_t tone);
+    int (* get_ctcss_tone)(RIG * rig, vfo_t vfo, tone_t * tone);
+    int (* set_dcs_sql)(RIG * rig, vfo_t vfo, tone_t code);
+    int (* get_dcs_sql)(RIG * rig, vfo_t vfo, tone_t * code);
+    int (* set_tone_sql)(RIG * rig, vfo_t vfo, tone_t tone);
+    int (* get_tone_sql)(RIG * rig, vfo_t vfo, tone_t * tone);
+    int (* set_ctcss_sql)(RIG * rig, vfo_t vfo, tone_t tone);
+    int (* get_ctcss_sql)(RIG * rig, vfo_t vfo, tone_t * tone);
+    int (* power2mW)(RIG * rig,
+                     unsigned int * mwpower,
+                     float power,
+                     freq_t freq,
+                     rmode_t mode);
+    int (* mW2power)(RIG * rig,
+                     float * power,
+                     unsigned int mwpower,
+                     freq_t freq,
+                     rmode_t mode);
+    int (* set_powerstat)(RIG * rig, powerstat_t status);
+    int (* get_powerstat)(RIG * rig, powerstat_t * status);
+    int (* reset)(RIG * rig, reset_t reset);
+    int (* set_ant)(RIG * rig, vfo_t vfo, ant_t ant);
+    int (* get_ant)(RIG * rig, vfo_t vfo, ant_t * ant);
+    int (* set_level)(RIG * rig,
+                      vfo_t vfo,
+                      setting_t level,
+                      value_t val);
+    int (* get_level)(RIG * rig,
+                      vfo_t vfo,
+                      setting_t level,
+                      value_t * val);
+    int (* set_func)(RIG * rig, vfo_t vfo, setting_t func, int status);
+    int (* get_func)(RIG * rig,
+                     vfo_t vfo,
+                     setting_t func,
+                     int * status);
+    int (* set_parm)(RIG * rig, setting_t parm, value_t val);
+    int (* get_parm)(RIG * rig, setting_t parm, value_t * val);
+    int (* set_ext_level)(RIG * rig,
+                          vfo_t vfo,
+                          token_t token,
+                          value_t val);
+    int (* get_ext_level)(RIG * rig,
+                          vfo_t vfo,
+                          token_t token,
+                          value_t * val);
+    int (* set_ext_parm)(RIG * rig, token_t token, value_t val);
+    int (* get_ext_parm)(RIG * rig, token_t token, value_t * val);
+    int (* set_conf)(RIG * rig, token_t token, const char * val);
+    int (* get_conf)(RIG * rig, token_t token, char * val);
+    int (* send_dtmf)(RIG * rig, vfo_t vfo, const char * digits);
+    int (* recv_dtmf)(RIG * rig,
+                      vfo_t vfo,
+                      char * digits,
+                      int * length);
+    int (* send_morse)(RIG * rig, vfo_t vfo, const char * msg);
+    int (* set_bank)(RIG * rig, vfo_t vfo, int bank);
+    int (* set_mem)(RIG * rig, vfo_t vfo, int ch);
+    int (* get_mem)(RIG * rig, vfo_t vfo, int * ch);
+    int (* vfo_op)(RIG * rig, vfo_t vfo, vfo_op_t op);
+    int (* scan)(RIG * rig, vfo_t vfo, scan_t scan, int ch);
+    int (* set_trn)(RIG * rig, int trn);
+    int (* get_trn)(RIG * rig, int * trn);
+    int (* decode_event)(RIG * rig);
+    int (* set_channel)(RIG * rig, const channel_t * chan);
+    int (* get_channel)(RIG * rig, channel_t * chan);
+    const char * (* get_info)(RIG * rig);
+    int (* set_chan_all_cb)(RIG * rig, chan_cb_t chan_cb, void *);
+    int (* get_chan_all_cb)(RIG * rig, chan_cb_t chan_cb, void *);
+    int (* set_mem_all_cb)(RIG * rig,
+                           chan_cb_t chan_cb,
+                           confval_cb_t parm_cb,
+                           void *);
+    int (* get_mem_all_cb)(RIG * rig,
+                           chan_cb_t chan_cb,
+                           confval_cb_t parm_cb,
+                           void *);
+    const char * clone_combo_set;
+    const char * clone_combo_get;
+}; -}
+#starttype struct rig_caps
+#field rig_model , CInt
+#field model_name , CString
+#field mfg_name , CString
+#field version , CString
+#field copyright , CString
+#field status , <enum rig_status_e>
+#field rig_type , CInt
+#field ptt_type , <ptt_type_t>
+#field dcd_type , <dcd_type_t>
+#field port_type , <enum rig_port_e>
+#field serial_rate_min , CInt
+#field serial_rate_max , CInt
+#field serial_data_bits , CInt
+#field serial_stop_bits , CInt
+#field serial_parity , <enum serial_parity_e>
+#field serial_handshake , <enum serial_handshake_e>
+#field write_delay , CInt
+#field post_write_delay , CInt
+#field timeout , CInt
+#field retry , CInt
+#field has_get_func , CULong
+#field has_set_func , CULong
+#field has_get_level , CULong
+#field has_set_level , CULong
+#field has_get_parm , CULong
+#field has_set_parm , CULong
+#array_field level_gran , <struct gran>
+#array_field parm_gran , <struct gran>
+#field extparms , Ptr <struct confparams>
+#field extlevels , Ptr <struct confparams>
+#field ctcss_list , Ptr CUInt
+#field dcs_list , Ptr CUInt
+#array_field preamp , CInt
+#array_field attenuator , CInt
+#field max_rit , CLong
+#field max_xit , CLong
+#field max_ifshift , CLong
+#field announces , <ann_t>
+#field vfo_ops , <vfo_op_t>
+#field scan_ops , <scan_t>
+#field targetable_vfo , CInt
+#field transceive , CInt
+#field bank_qty , CInt
+#field chan_desc_sz , CInt
+#array_field chan_list , <struct chan_list>
+#array_field rx_range_list1 , <struct freq_range_list>
+#array_field tx_range_list1 , <struct freq_range_list>
+#array_field rx_range_list2 , <struct freq_range_list>
+#array_field tx_range_list2 , <struct freq_range_list>
+#array_field tuning_steps , <struct tuning_step_list>
+#array_field filters , <struct filter_list>
+#field str_cal , <struct cal_table>
+#field cfgparams , Ptr <struct confparams>
+#field priv , Ptr ()
+#field rig_init , FunPtr (Ptr <struct rig> -> CInt)
+#field rig_cleanup , FunPtr (Ptr <struct rig> -> CInt)
+#field rig_open , FunPtr (Ptr <struct rig> -> CInt)
+#field rig_close , FunPtr (Ptr <struct rig> -> CInt)
+#field set_freq , FunPtr (Ptr <struct rig> -> CInt -> CDouble -> CInt)
+#field get_freq , FunPtr (Ptr <struct rig> -> CInt -> Ptr CDouble -> CInt)
+#field set_mode , FunPtr (Ptr <struct rig> -> CInt -> <rmode_t> -> CLong -> CInt)
+#field get_mode , FunPtr (Ptr <struct rig> -> CInt -> Ptr <rmode_t> -> Ptr CLong -> CInt)
+#field set_vfo , FunPtr (Ptr <struct rig> -> CInt -> CInt)
+#field get_vfo , FunPtr (Ptr <struct rig> -> Ptr CInt -> CInt)
+#field set_ptt , FunPtr (Ptr <struct rig> -> CInt -> <ptt_t> -> CInt)
+#field get_ptt , FunPtr (Ptr <struct rig> -> CInt -> Ptr <ptt_t> -> CInt)
+#field get_dcd , FunPtr (Ptr <struct rig> -> CInt -> Ptr <enum dcd_e> -> CInt)
+#field set_rptr_shift , FunPtr (Ptr <struct rig> -> CInt -> <rptr_shift_t> -> CInt)
+#field get_rptr_shift , FunPtr (Ptr <struct rig> -> CInt -> Ptr <rptr_shift_t> -> CInt)
+#field set_rptr_offs , FunPtr (Ptr <struct rig> -> CInt -> CLong -> CInt)
+#field get_rptr_offs , FunPtr (Ptr <struct rig> -> CInt -> Ptr CLong -> CInt)
+#field set_split_freq , FunPtr (Ptr <struct rig> -> CInt -> CDouble -> CInt)
+#field get_split_freq , FunPtr (Ptr <struct rig> -> CInt -> Ptr CDouble -> CInt)
+#field set_split_mode , FunPtr (Ptr <struct rig> -> CInt -> <rmode_t> -> CLong -> CInt)
+#field get_split_mode , FunPtr (Ptr <struct rig> -> CInt -> Ptr <rmode_t> -> Ptr CLong -> CInt)
+#field set_split_vfo , FunPtr (Ptr <struct rig> -> CInt -> <split_t> -> CInt -> CInt)
+#field get_split_vfo , FunPtr (Ptr <struct rig> -> CInt -> Ptr <split_t> -> Ptr CInt -> CInt)
+#field set_rit , FunPtr (Ptr <struct rig> -> CInt -> CLong -> CInt)
+#field get_rit , FunPtr (Ptr <struct rig> -> CInt -> Ptr CLong -> CInt)
+#field set_xit , FunPtr (Ptr <struct rig> -> CInt -> CLong -> CInt)
+#field get_xit , FunPtr (Ptr <struct rig> -> CInt -> Ptr CLong -> CInt)
+#field set_ts , FunPtr (Ptr <struct rig> -> CInt -> CLong -> CInt)
+#field get_ts , FunPtr (Ptr <struct rig> -> CInt -> Ptr CLong -> CInt)
+#field set_dcs_code , FunPtr (Ptr <struct rig> -> CInt -> CUInt -> CInt)
+#field get_dcs_code , FunPtr (Ptr <struct rig> -> CInt -> Ptr CUInt -> CInt)
+#field set_tone , FunPtr (Ptr <struct rig> -> CInt -> CUInt -> CInt)
+#field get_tone , FunPtr (Ptr <struct rig> -> CInt -> Ptr CUInt -> CInt)
+#field set_ctcss_tone , FunPtr (Ptr <struct rig> -> CInt -> CUInt -> CInt)
+#field get_ctcss_tone , FunPtr (Ptr <struct rig> -> CInt -> Ptr CUInt -> CInt)
+#field set_dcs_sql , FunPtr (Ptr <struct rig> -> CInt -> CUInt -> CInt)
+#field get_dcs_sql , FunPtr (Ptr <struct rig> -> CInt -> Ptr CUInt -> CInt)
+#field set_tone_sql , FunPtr (Ptr <struct rig> -> CInt -> CUInt -> CInt)
+#field get_tone_sql , FunPtr (Ptr <struct rig> -> CInt -> Ptr CUInt -> CInt)
+#field set_ctcss_sql , FunPtr (Ptr <struct rig> -> CInt -> CUInt -> CInt)
+#field get_ctcss_sql , FunPtr (Ptr <struct rig> -> CInt -> Ptr CUInt -> CInt)
+#field power2mW , FunPtr (Ptr <struct rig> -> Ptr CUInt -> CFloat -> CDouble -> <rmode_t> -> CInt)
+#field mW2power , FunPtr (Ptr <struct rig> -> Ptr CFloat -> CUInt -> CDouble -> <rmode_t> -> CInt)
+#field set_powerstat , FunPtr (Ptr <struct rig> -> <powerstat_t> -> CInt)
+#field get_powerstat , FunPtr (Ptr <struct rig> -> Ptr <powerstat_t> -> CInt)
+#field reset , FunPtr (Ptr <struct rig> -> <reset_t> -> CInt)
+#field set_ant , FunPtr (Ptr <struct rig> -> CInt -> CInt -> CInt)
+#field get_ant , FunPtr (Ptr <struct rig> -> CInt -> Ptr CInt -> CInt)
+#field set_level , FunPtr (Ptr <struct rig> -> CInt -> CULong -> <value_t> -> CInt)
+#field get_level , FunPtr (Ptr <struct rig> -> CInt -> CULong -> Ptr <value_t> -> CInt)
+#field set_func , FunPtr (Ptr <struct rig> -> CInt -> CULong -> CInt -> CInt)
+#field get_func , FunPtr (Ptr <struct rig> -> CInt -> CULong -> Ptr CInt -> CInt)
+#field set_parm , FunPtr (Ptr <struct rig> -> CULong -> <value_t> -> CInt)
+#field get_parm , FunPtr (Ptr <struct rig> -> CULong -> Ptr <value_t> -> CInt)
+#field set_ext_level , FunPtr (Ptr <struct rig> -> CInt -> CLong -> <value_t> -> CInt)
+#field get_ext_level , FunPtr (Ptr <struct rig> -> CInt -> CLong -> Ptr <value_t> -> CInt)
+#field set_ext_parm , FunPtr (Ptr <struct rig> -> CLong -> <value_t> -> CInt)
+#field get_ext_parm , FunPtr (Ptr <struct rig> -> CLong -> Ptr <value_t> -> CInt)
+#field set_conf , FunPtr (Ptr <struct rig> -> CLong -> CString -> CInt)
+#field get_conf , FunPtr (Ptr <struct rig> -> CLong -> CString -> CInt)
+#field send_dtmf , FunPtr (Ptr <struct rig> -> CInt -> CString -> CInt)
+#field recv_dtmf , FunPtr (Ptr <struct rig> -> CInt -> CString -> Ptr CInt -> CInt)
+#field send_morse , FunPtr (Ptr <struct rig> -> CInt -> CString -> CInt)
+#field set_bank , FunPtr (Ptr <struct rig> -> CInt -> CInt -> CInt)
+#field set_mem , FunPtr (Ptr <struct rig> -> CInt -> CInt -> CInt)
+#field get_mem , FunPtr (Ptr <struct rig> -> CInt -> Ptr CInt -> CInt)
+#field vfo_op , FunPtr (Ptr <struct rig> -> CInt -> <vfo_op_t> -> CInt)
+#field scan , FunPtr (Ptr <struct rig> -> CInt -> <scan_t> -> CInt -> CInt)
+#field set_trn , FunPtr (Ptr <struct rig> -> CInt -> CInt)
+#field get_trn , FunPtr (Ptr <struct rig> -> Ptr CInt -> CInt)
+#field decode_event , FunPtr (Ptr <struct rig> -> CInt)
+#field set_channel , FunPtr (Ptr <struct rig> -> Ptr <struct channel> -> CInt)
+#field get_channel , FunPtr (Ptr <struct rig> -> Ptr <struct channel> -> CInt)
+#field get_info , FunPtr (Ptr <struct rig> -> CString)
+#field set_chan_all_cb , FunPtr (Ptr <struct rig> -> <chan_cb_t> -> Ptr () -> CInt)
+#field get_chan_all_cb , FunPtr (Ptr <struct rig> -> <chan_cb_t> -> Ptr () -> CInt)
+#field set_mem_all_cb , FunPtr (Ptr <struct rig> -> <chan_cb_t> -> <confval_cb_t> -> Ptr () -> CInt)
+#field get_mem_all_cb , FunPtr (Ptr <struct rig> -> <chan_cb_t> -> <confval_cb_t> -> Ptr () -> CInt)
+#field clone_combo_set , CString
+#field clone_combo_get , CString
+#stoptype
+{- typedef struct hamlib_port_t {
+            union type {
+                rig_port_t rig; ptt_type_t ptt; dcd_type_t dcd;
+            } type;
+            int fd;
+            void * handle;
+            int write_delay;
+            int post_write_delay;
+            struct post_write_date {
+                int tv_sec, tv_usec;
+            } post_write_date;
+            int timeout;
+            int retry;
+            char pathname[100];
+            union parm {
+                struct serial {
+                    int rate;
+                    int data_bits;
+                    int stop_bits;
+                    enum serial_parity_e parity;
+                    enum serial_handshake_e handshake;
+                    enum serial_control_state_e rts_state;
+                    enum serial_control_state_e dtr_state;
+                } serial;
+                struct parallel {
+                    int pin;
+                } parallel;
+                struct cm108 {
+                    int ptt_bitnum;
+                } cm108;
+                struct usb {
+                    int vid;
+                    int pid;
+                    int conf;
+                    int iface;
+                    int alt;
+                    char * vendor_name;
+                    char * product;
+                } usb;
+            } parm;
+        } hamlib_port_t; -}
+#starttype union type
+#field rig , <struct rig_port_t>
+#field ptt , <struct ptt_type_t>
+#field dcd , <struct dcd_type_t>
+#stoptype
+
+#starttype struct post_write_date
+#field tv_sec , CInt
+#field tv_usec , CInt
+#stoptype
+
+#starttype struct serial
+#field rate , CInt
+#field data_bits , CInt
+#field stop_bits , CInt
+#field parity , <enum serial_parity_e>
+#field handshake , <enum serial_handshake_e>
+#field rts_state , <enum serial_control_state_e>
+#field dtr_state , <enum serial_control_state_e>
+#stoptype
+
+#starttype struct parallel
+#field pin , CInt
+#stoptype
+
+#starttype struct cm108
+#field ptt_bitnum , CInt
+#stoptype
+
+#starttype struct usb
+#field vid , CInt
+#field pid , CInt
+#field conf , CInt
+#field iface , CInt
+#field alt , CInt
+#field vendor_name , CString
+#field product , CString
+#stoptype
+
+#starttype union parm
+#field serial , <struct serial>
+#field parallel , <struct parallel>
+#field cm108 , <struct cm108>
+#field usb , <struct usb>
+#stoptype
+
+#starttype struct hamlib_port_t
+#field type , <union type>
+#field fd , CInt
+#field handle , Ptr ()
+#field write_delay , CInt
+#field post_write_delay , CInt
+#field post_write_date , <struct post_write_date>
+#field timeout , CInt
+#field retry , CInt
+#array_field pathname , CChar
+#field parm , <union parm>
+#stoptype
+{- typedef hamlib_port_t port_t; -}
+#synonym_t port_t , <struct hamlib_port_t>
+{- struct rig_state {
+    hamlib_port_t rigport;
+    hamlib_port_t pttport;
+    hamlib_port_t dcdport;
+    double vfo_comp;
+    int itu_region;
+    freq_range_t rx_range_list[30];
+    freq_range_t tx_range_list[30];
+    struct tuning_step_list tuning_steps[20];
+    struct filter_list filters[42];
+    cal_table_t str_cal;
+    chan_t chan_list[16];
+    shortfreq_t max_rit;
+    shortfreq_t max_xit;
+    shortfreq_t max_ifshift;
+    ann_t announces;
+    int preamp[8];
+    int attenuator[8];
+    setting_t has_get_func;
+    setting_t has_set_func;
+    setting_t has_get_level;
+    setting_t has_set_level;
+    setting_t has_get_parm;
+    setting_t has_set_parm;
+    gran_t level_gran[32];
+    gran_t parm_gran[32];
+    int hold_decode;
+    vfo_t current_vfo;
+    int vfo_list;
+    int comm_state;
+    void * priv;
+    void * obj;
+    int transceive;
+    int poll_interval;
+    freq_t current_freq;
+    rmode_t current_mode;
+    pbwidth_t current_width;
+    vfo_t tx_vfo;
+    int mode_list;
+}; -}
+#starttype struct rig_state
+#field rigport , <struct hamlib_port_t>
+#field pttport , <struct hamlib_port_t>
+#field dcdport , <struct hamlib_port_t>
+#field vfo_comp , CDouble
+#field itu_region , CInt
+#array_field rx_range_list , <struct freq_range_list>
+#array_field tx_range_list , <struct freq_range_list>
+#array_field tuning_steps , <struct tuning_step_list>
+#array_field filters , <struct filter_list>
+#field str_cal , <struct cal_table>
+#array_field chan_list , <struct chan_list>
+#field max_rit , CLong
+#field max_xit , CLong
+#field max_ifshift , CLong
+#field announces , <ann_t>
+#array_field preamp , CInt
+#array_field attenuator , CInt
+#field has_get_func , CULong
+#field has_set_func , CULong
+#field has_get_level , CULong
+#field has_set_level , CULong
+#field has_get_parm , CULong
+#field has_set_parm , CULong
+#array_field level_gran , <struct gran>
+#array_field parm_gran , <struct gran>
+#field hold_decode , CInt
+#field current_vfo , CInt
+#field vfo_list , CInt
+#field comm_state , CInt
+#field priv , Ptr ()
+#field obj , Ptr ()
+#field transceive , CInt
+#field poll_interval , CInt
+#field current_freq , CDouble
+#field current_mode , <rmode_t>
+#field current_width , CLong
+#field tx_vfo , CInt
+#field mode_list , CInt
+#stoptype
+
+#callback freq_cb_t , Ptr <struct rig> -> CInt -> CDouble -> Ptr () -> IO CInt
+#callback mode_cb_t , Ptr <struct rig> -> CInt -> <rmode_t> -> CLong -> Ptr () -> IO CInt
+#callback vfo_cb_t , Ptr <struct rig> -> CInt -> Ptr () -> IO CInt
+#callback ptt_cb_t , Ptr <struct rig> -> CInt -> <ptt_t> -> Ptr () -> IO CInt
+#callback dcd_cb_t , Ptr <struct rig> -> CInt -> <enum dcd_e> -> Ptr () -> IO CInt
+#callback pltune_cb_t , Ptr <struct rig> -> CInt -> Ptr CDouble -> Ptr <rmode_t> -> Ptr CLong -> Ptr () -> IO CInt
+{- struct rig_callbacks {
+    freq_cb_t freq_event;
+    void * freq_arg;
+    mode_cb_t mode_event;
+    void * mode_arg;
+    vfo_cb_t vfo_event;
+    void * vfo_arg;
+    ptt_cb_t ptt_event;
+    void * ptt_arg;
+    dcd_cb_t dcd_event;
+    void * dcd_arg;
+    pltune_cb_t pltune;
+    void * pltune_arg;
+}; -}
+#starttype struct rig_callbacks
+#field freq_event , <freq_cb_t>
+#field freq_arg , Ptr ()
+#field mode_event , <mode_cb_t>
+#field mode_arg , Ptr ()
+#field vfo_event , <vfo_cb_t>
+#field vfo_arg , Ptr ()
+#field ptt_event , <ptt_cb_t>
+#field ptt_arg , Ptr ()
+#field dcd_event , <dcd_cb_t>
+#field dcd_arg , Ptr ()
+#field pltune , <pltune_cb_t>
+#field pltune_arg , Ptr ()
+#stoptype
+{- struct rig {
+    struct rig_caps * caps;
+    struct rig_state state;
+    struct rig_callbacks callbacks;
+}; -}
+#starttype struct rig
+#field caps , Ptr <struct rig_caps>
+#field state , <struct rig_state>
+#field callbacks , <struct rig_callbacks>
+#stoptype
+#ccall rig_init , CInt -> IO (Ptr <struct rig>)
+#ccall rig_open , Ptr <struct rig> -> IO CInt
+#ccall rig_set_freq , Ptr <struct rig> -> CInt -> CDouble -> IO CInt
+#ccall rig_get_freq , Ptr <struct rig> -> CInt -> Ptr CDouble -> IO CInt
+#ccall rig_set_mode , Ptr <struct rig> -> CInt -> <rmode_t> -> CLong -> IO CInt
+#ccall rig_get_mode , Ptr <struct rig> -> CInt -> Ptr <rmode_t> -> Ptr CLong -> IO CInt
+#ccall rig_set_vfo , Ptr <struct rig> -> CInt -> IO CInt
+#ccall rig_get_vfo , Ptr <struct rig> -> Ptr CInt -> IO CInt
+#ccall rig_set_ptt , Ptr <struct rig> -> CInt -> <ptt_t> -> IO CInt
+#ccall rig_get_ptt , Ptr <struct rig> -> CInt -> Ptr <ptt_t> -> IO CInt
+#ccall rig_get_dcd , Ptr <struct rig> -> CInt -> Ptr <enum dcd_e> -> IO CInt
+#ccall rig_set_rptr_shift , Ptr <struct rig> -> CInt -> <rptr_shift_t> -> IO CInt
+#ccall rig_get_rptr_shift , Ptr <struct rig> -> CInt -> Ptr <rptr_shift_t> -> IO CInt
+#ccall rig_set_rptr_offs , Ptr <struct rig> -> CInt -> CLong -> IO CInt
+#ccall rig_get_rptr_offs , Ptr <struct rig> -> CInt -> Ptr CLong -> IO CInt
+#ccall rig_set_ctcss_tone , Ptr <struct rig> -> CInt -> CUInt -> IO CInt
+#ccall rig_get_ctcss_tone , Ptr <struct rig> -> CInt -> Ptr CUInt -> IO CInt
+#ccall rig_set_dcs_code , Ptr <struct rig> -> CInt -> CUInt -> IO CInt
+#ccall rig_get_dcs_code , Ptr <struct rig> -> CInt -> Ptr CUInt -> IO CInt
+#ccall rig_set_ctcss_sql , Ptr <struct rig> -> CInt -> CUInt -> IO CInt
+#ccall rig_get_ctcss_sql , Ptr <struct rig> -> CInt -> Ptr CUInt -> IO CInt
+#ccall rig_set_dcs_sql , Ptr <struct rig> -> CInt -> CUInt -> IO CInt
+#ccall rig_get_dcs_sql , Ptr <struct rig> -> CInt -> Ptr CUInt -> IO CInt
+#ccall rig_set_split_freq , Ptr <struct rig> -> CInt -> CDouble -> IO CInt
+#ccall rig_get_split_freq , Ptr <struct rig> -> CInt -> Ptr CDouble -> IO CInt
+#ccall rig_set_split_mode , Ptr <struct rig> -> CInt -> <rmode_t> -> CLong -> IO CInt
+#ccall rig_get_split_mode , Ptr <struct rig> -> CInt -> Ptr <rmode_t> -> Ptr CLong -> IO CInt
+#ccall rig_set_split_vfo , Ptr <struct rig> -> CInt -> <split_t> -> CInt -> IO CInt
+#ccall rig_get_split_vfo , Ptr <struct rig> -> CInt -> Ptr <split_t> -> Ptr CInt -> IO CInt
+#ccall rig_set_rit , Ptr <struct rig> -> CInt -> CLong -> IO CInt
+#ccall rig_get_rit , Ptr <struct rig> -> CInt -> Ptr CLong -> IO CInt
+#ccall rig_set_xit , Ptr <struct rig> -> CInt -> CLong -> IO CInt
+#ccall rig_get_xit , Ptr <struct rig> -> CInt -> Ptr CLong -> IO CInt
+#ccall rig_set_ts , Ptr <struct rig> -> CInt -> CLong -> IO CInt
+#ccall rig_get_ts , Ptr <struct rig> -> CInt -> Ptr CLong -> IO CInt
+#ccall rig_power2mW , Ptr <struct rig> -> Ptr CUInt -> CFloat -> CDouble -> <rmode_t> -> IO CInt
+#ccall rig_mW2power , Ptr <struct rig> -> Ptr CFloat -> CUInt -> CDouble -> <rmode_t> -> IO CInt
+#ccall rig_get_resolution , Ptr <struct rig> -> <rmode_t> -> IO CLong
+#ccall rig_get_level , Ptr <struct rig> -> CInt -> CULong -> Ptr <value_t> -> IO CInt
+#ccall rig_get_parm , Ptr <struct rig> -> CULong -> Ptr <value_t> -> IO CInt
+#ccall rig_set_conf , Ptr <struct rig> -> CLong -> CString -> IO CInt
+#ccall rig_get_conf , Ptr <struct rig> -> CLong -> CString -> IO CInt
+#ccall rig_set_powerstat , Ptr <struct rig> -> <powerstat_t> -> IO CInt
+#ccall rig_get_powerstat , Ptr <struct rig> -> Ptr <powerstat_t> -> IO CInt
+#ccall rig_reset , Ptr <struct rig> -> <reset_t> -> IO CInt
+#ccall rig_get_ext_level , Ptr <struct rig> -> CInt -> CLong -> Ptr <value_t> -> IO CInt
+#ccall rig_get_ext_parm , Ptr <struct rig> -> CLong -> Ptr <value_t> -> IO CInt
+#ccall rig_ext_level_foreach , Ptr <struct rig> -> FunPtr (Ptr <struct rig> -> Ptr <struct confparams> -> Ptr () -> CInt) -> Ptr () -> IO CInt
+#ccall rig_ext_parm_foreach , Ptr <struct rig> -> FunPtr (Ptr <struct rig> -> Ptr <struct confparams> -> Ptr () -> CInt) -> Ptr () -> IO CInt
+#ccall rig_ext_lookup , Ptr <struct rig> -> CString -> IO (Ptr <struct confparams>)
+#ccall rig_ext_lookup_tok , Ptr <struct rig> -> CLong -> IO (Ptr <struct confparams>)
+#ccall rig_ext_token_lookup , Ptr <struct rig> -> CString -> IO CLong
+#ccall rig_token_foreach , Ptr <struct rig> -> FunPtr (Ptr <struct confparams> -> Ptr () -> CInt) -> Ptr () -> IO CInt
+#ccall rig_confparam_lookup , Ptr <struct rig> -> CString -> IO (Ptr <struct confparams>)
+#ccall rig_token_lookup , Ptr <struct rig> -> CString -> IO CLong
+#ccall rig_close , Ptr <struct rig> -> IO CInt
+#ccall rig_cleanup , Ptr <struct rig> -> IO CInt
+#ccall rig_set_ant , Ptr <struct rig> -> CInt -> CInt -> IO CInt
+#ccall rig_get_ant , Ptr <struct rig> -> CInt -> Ptr CInt -> IO CInt
+#ccall rig_has_get_level , Ptr <struct rig> -> CULong -> IO CULong
+#ccall rig_has_set_level , Ptr <struct rig> -> CULong -> IO CULong
+#ccall rig_has_get_parm , Ptr <struct rig> -> CULong -> IO CULong
+#ccall rig_has_set_parm , Ptr <struct rig> -> CULong -> IO CULong
+#ccall rig_has_get_func , Ptr <struct rig> -> CULong -> IO CULong
+#ccall rig_has_set_func , Ptr <struct rig> -> CULong -> IO CULong
+#ccall rig_set_func , Ptr <struct rig> -> CInt -> CULong -> CInt -> IO CInt
+#ccall rig_get_func , Ptr <struct rig> -> CInt -> CULong -> Ptr CInt -> IO CInt
+#ccall rig_send_dtmf , Ptr <struct rig> -> CInt -> CString -> IO CInt
+#ccall rig_recv_dtmf , Ptr <struct rig> -> CInt -> CString -> Ptr CInt -> IO CInt
+#ccall rig_send_morse , Ptr <struct rig> -> CInt -> CString -> IO CInt
+#ccall rig_set_bank , Ptr <struct rig> -> CInt -> CInt -> IO CInt
+#ccall rig_set_mem , Ptr <struct rig> -> CInt -> CInt -> IO CInt
+#ccall rig_get_mem , Ptr <struct rig> -> CInt -> Ptr CInt -> IO CInt
+#ccall rig_vfo_op , Ptr <struct rig> -> CInt -> <vfo_op_t> -> IO CInt
+#ccall rig_has_vfo_op , Ptr <struct rig> -> <vfo_op_t> -> IO <vfo_op_t>
+#ccall rig_scan , Ptr <struct rig> -> CInt -> <scan_t> -> CInt -> IO CInt
+#ccall rig_has_scan , Ptr <struct rig> -> <scan_t> -> IO <scan_t>
+#ccall rig_set_channel , Ptr <struct rig> -> Ptr <struct channel> -> IO CInt
+#ccall rig_get_channel , Ptr <struct rig> -> Ptr <struct channel> -> IO CInt
+#ccall rig_set_chan_all , Ptr <struct rig> -> Ptr (<struct channel>) -> IO CInt
+#ccall rig_get_chan_all , Ptr <struct rig> -> Ptr (<struct channel>) -> IO CInt
+#ccall rig_set_chan_all_cb , Ptr <struct rig> -> <chan_cb_t> -> Ptr () -> IO CInt
+#ccall rig_get_chan_all_cb , Ptr <struct rig> -> <chan_cb_t> -> Ptr () -> IO CInt
+#ccall rig_set_mem_all_cb , Ptr <struct rig> -> <chan_cb_t> -> <confval_cb_t> -> Ptr () -> IO CInt
+#ccall rig_get_mem_all_cb , Ptr <struct rig> -> <chan_cb_t> -> <confval_cb_t> -> Ptr () -> IO CInt
+#ccall rig_set_mem_all , Ptr <struct rig> -> Ptr <struct channel> -> Ptr <struct confparams> -> Ptr <value_t> -> IO CInt
+#ccall rig_get_mem_all , Ptr <struct rig> -> Ptr <struct channel> -> Ptr <struct confparams> -> Ptr <value_t> -> IO CInt
+#ccall rig_lookup_mem_caps , Ptr <struct rig> -> CInt -> IO (Ptr <struct chan_list>)
+#ccall rig_mem_count , Ptr <struct rig> -> IO CInt
+#ccall rig_set_trn , Ptr <struct rig> -> CInt -> IO CInt
+#ccall rig_get_trn , Ptr <struct rig> -> Ptr CInt -> IO CInt
+#ccall rig_set_freq_callback , Ptr <struct rig> -> <freq_cb_t> -> Ptr () -> IO CInt
+#ccall rig_set_mode_callback , Ptr <struct rig> -> <mode_cb_t> -> Ptr () -> IO CInt
+#ccall rig_set_vfo_callback , Ptr <struct rig> -> <vfo_cb_t> -> Ptr () -> IO CInt
+#ccall rig_set_ptt_callback , Ptr <struct rig> -> <ptt_cb_t> -> Ptr () -> IO CInt
+#ccall rig_set_dcd_callback , Ptr <struct rig> -> <dcd_cb_t> -> Ptr () -> IO CInt
+#ccall rig_set_pltune_callback , Ptr <struct rig> -> <pltune_cb_t> -> Ptr () -> IO CInt
+#ccall rig_get_info , Ptr <struct rig> -> IO CString
+#ccall rig_get_caps , CInt -> IO (Ptr <struct rig_caps>)
+#ccall rig_get_range , Ptr (<struct freq_range_list>) -> CDouble -> <rmode_t> -> IO (Ptr <struct freq_range_list>)
+#ccall rig_passband_normal , Ptr <struct rig> -> <rmode_t> -> IO CLong
+#ccall rig_passband_narrow , Ptr <struct rig> -> <rmode_t> -> IO CLong
+#ccall rig_passband_wide , Ptr <struct rig> -> <rmode_t> -> IO CLong
+#ccall rigerror , CInt -> IO CString
+#ccall rig_setting2idx , CULong -> IO CInt
+#ccall rig_set_debug , <enum rig_debug_level_e> -> IO ()
+#ccall rig_need_debug , <enum rig_debug_level_e> -> IO CInt
+#ccall rig_debug , <enum rig_debug_level_e> -> CString -> IO ()
+#ccall rig_register , Ptr <struct rig_caps> -> IO CInt
+#ccall rig_unregister , CInt -> IO CInt
+#ccall rig_list_foreach , FunPtr (Ptr <struct rig_caps> -> Ptr () -> CInt) -> Ptr () -> IO CInt
+#ccall rig_load_backend , CString -> IO CInt
+#ccall rig_check_backend , CInt -> IO CInt
+#ccall rig_load_all_backends , IO CInt
+#callback rig_probe_func_t , Ptr <struct hamlib_port_t> -> CInt -> Ptr () -> IO CInt
+#ccall rig_probe_all , Ptr <struct hamlib_port_t> -> <rig_probe_func_t> -> Ptr () -> IO CInt
+#ccall rig_probe , Ptr <struct hamlib_port_t> -> IO CInt
+#ccall rig_strrmode , <rmode_t> -> IO CString
+#ccall rig_strvfo , CInt -> IO CString
+#ccall rig_strfunc , CULong -> IO CString
+#ccall rig_strlevel , CULong -> IO CString
+#ccall rig_strparm , CULong -> IO CString
+#ccall rig_strptrshift , <rptr_shift_t> -> IO CString
+#ccall rig_strvfop , <vfo_op_t> -> IO CString
+#ccall rig_strscan , <scan_t> -> IO CString
+#ccall rig_strstatus , <enum rig_status_e> -> IO CString
+#ccall rig_strmtype , <chan_type_t> -> IO CString
+#ccall rig_parse_mode , CString -> IO <rmode_t>
+#ccall rig_parse_vfo , CString -> IO CInt
+#ccall rig_parse_func , CString -> IO CULong
+#ccall rig_parse_level , CString -> IO CULong
+#ccall rig_parse_parm , CString -> IO CULong
+#ccall rig_parse_vfo_op , CString -> IO <vfo_op_t>
+#ccall rig_parse_scan , CString -> IO <scan_t>
+#ccall rig_parse_rptr_shift , CString -> IO <rptr_shift_t>
+#ccall rig_parse_mtype , CString -> IO <chan_type_t>
diff --git a/src/Bindings/Hamlib/Riglist.c b/src/Bindings/Hamlib/Riglist.c
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Hamlib/Riglist.c
@@ -0,0 +1,37 @@
+#include <hamlib/riglist.h>
+#include <bindings.cmacros.h>
+
+BC_INLINE2(RIG_MAKE_MODEL, int, int, int)
+BC_INLINE1(RIG_BACKEND_NUM, int, int)
+
+// grep define /usr/include/hamlib/riglist.h | sed 's/\/\*.*//g' | grep '"' | awk '{print $2}' | sed 's/^/BC_GLOBALARRAY(/' | sed 's/$/, char)/'
+BC_GLOBALARRAY(RIG_BACKEND_DUMMY, char)
+BC_GLOBALARRAY(RIG_BACKEND_YAESU, char)
+BC_GLOBALARRAY(RIG_BACKEND_KENWOOD, char)
+BC_GLOBALARRAY(RIG_BACKEND_ICOM, char)
+BC_GLOBALARRAY(RIG_BACKEND_PCR, char)
+BC_GLOBALARRAY(RIG_BACKEND_AOR, char)
+BC_GLOBALARRAY(RIG_BACKEND_JRC, char)
+BC_GLOBALARRAY(RIG_BACKEND_RADIOSHACK, char)
+BC_GLOBALARRAY(RIG_BACKEND_UNIDEN, char)
+BC_GLOBALARRAY(RIG_BACKEND_DRAKE, char)
+BC_GLOBALARRAY(RIG_BACKEND_LOWE, char)
+BC_GLOBALARRAY(RIG_BACKEND_RACAL, char)
+BC_GLOBALARRAY(RIG_BACKEND_WJ, char)
+BC_GLOBALARRAY(RIG_BACKEND_EK, char)
+BC_GLOBALARRAY(RIG_BACKEND_SKANTI, char)
+BC_GLOBALARRAY(RIG_BACKEND_WINRADIO, char)
+BC_GLOBALARRAY(RIG_BACKEND_TENTEC, char)
+BC_GLOBALARRAY(RIG_BACKEND_ALINCO, char)
+BC_GLOBALARRAY(RIG_BACKEND_KACHINA, char)
+BC_GLOBALARRAY(RIG_BACKEND_RPC, char)
+BC_GLOBALARRAY(RIG_BACKEND_GNURADIO, char)
+BC_GLOBALARRAY(RIG_BACKEND_MICROTUNE, char)
+BC_GLOBALARRAY(RIG_BACKEND_TAPR, char)
+BC_GLOBALARRAY(RIG_BACKEND_FLEXRADIO, char)
+BC_GLOBALARRAY(RIG_BACKEND_RFT, char)
+BC_GLOBALARRAY(RIG_BACKEND_KIT, char)
+BC_GLOBALARRAY(RIG_BACKEND_TUNER, char)
+BC_GLOBALARRAY(RIG_BACKEND_RS, char)
+BC_GLOBALARRAY(RIG_BACKEND_PRM80, char)
+BC_GLOBALARRAY(RIG_BACKEND_ADAT, char)
diff --git a/src/Bindings/Hamlib/Riglist.hsc b/src/Bindings/Hamlib/Riglist.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/Hamlib/Riglist.hsc
@@ -0,0 +1,350 @@
+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
+#include <bindings.dsl.h>
+#include <bindings.cmacros.h>
+#include <hamlib/riglist.h>
+
+module Bindings.Hamlib.Riglist where
+import Foreign.Ptr
+#strict_import
+
+{- typedef int rig_model_t; -}
+#synonym_t rig_model_t , CInt
+
+#cinline RIG_MAKE_MODEL , CInt -> CInt -> CInt
+#cinline RIG_BACKEND_NUM , CInt -> CInt
+
+-- grep define /usr/include/hamlib/riglist.h | sed 's/\/\*.*//g' | grep -v '"' | awk '{print $2}' | sed 's/^/#num /' | tail -n+5 | head -n-1
+#num RIG_MODEL_NONE
+#num RIG_DUMMY
+#num RIG_MODEL_DUMMY
+#num RIG_MODEL_NETRIGCTL
+#num RIG_MODEL_ARMSTRONG
+#num RIG_YAESU
+#num RIG_MODEL_FT847
+#num RIG_MODEL_FT1000
+#num RIG_MODEL_FT1000D
+#num RIG_MODEL_FT1000MPMKV
+#num RIG_MODEL_FT747
+#num RIG_MODEL_FT757
+#num RIG_MODEL_FT757GXII
+#num RIG_MODEL_FT575
+#num RIG_MODEL_FT767
+#num RIG_MODEL_FT736R
+#num RIG_MODEL_FT840
+#num RIG_MODEL_FT820
+#num RIG_MODEL_FT900
+#num RIG_MODEL_FT920
+#num RIG_MODEL_FT890
+#num RIG_MODEL_FT990
+#num RIG_MODEL_FRG100
+#num RIG_MODEL_FRG9600
+#num RIG_MODEL_FRG8800
+#num RIG_MODEL_FT817
+#num RIG_MODEL_FT100
+#num RIG_MODEL_FT857
+#num RIG_MODEL_FT897
+#num RIG_MODEL_FT1000MP
+#num RIG_MODEL_FT1000MPMKVFLD
+#num RIG_MODEL_VR5000
+#num RIG_MODEL_FT450
+#num RIG_MODEL_FT950
+#num RIG_MODEL_FT2000
+#num RIG_MODEL_FT9000
+#num RIG_MODEL_FT980
+#num RIG_MODEL_FTDX5000
+#num RIG_MODEL_VX1700
+#num RIG_KENWOOD
+#num RIG_MODEL_TS50
+#num RIG_MODEL_TS440
+#num RIG_MODEL_TS450S
+#num RIG_MODEL_TS570D
+#num RIG_MODEL_TS690S
+#num RIG_MODEL_TS711
+#num RIG_MODEL_TS790
+#num RIG_MODEL_TS811
+#num RIG_MODEL_TS850
+#num RIG_MODEL_TS870S
+#num RIG_MODEL_TS940
+#num RIG_MODEL_TS950
+#num RIG_MODEL_TS950SDX
+#num RIG_MODEL_TS2000
+#num RIG_MODEL_R5000
+#num RIG_MODEL_TS570S
+#num RIG_MODEL_THD7A
+#num RIG_MODEL_THD7AG
+#num RIG_MODEL_THF6A
+#num RIG_MODEL_THF7E
+#num RIG_MODEL_K2
+#num RIG_MODEL_TS930
+#num RIG_MODEL_THG71
+#num RIG_MODEL_TS680S
+#num RIG_MODEL_TS140S
+#num RIG_MODEL_TMD700
+#num RIG_MODEL_TMV7
+#num RIG_MODEL_TS480
+#num RIG_MODEL_K3
+#num RIG_MODEL_TRC80
+#num RIG_MODEL_TS590S
+#num RIG_MODEL_TRANSFOX
+#num RIG_MODEL_THD72A
+#num RIG_MODEL_TMD710
+#num RIG_MODEL_TMV71
+#num RIG_ICOM
+#num RIG_MODEL_IC1271
+#num RIG_MODEL_IC1275
+#num RIG_MODEL_IC271
+#num RIG_MODEL_IC275
+#num RIG_MODEL_IC375
+#num RIG_MODEL_IC471
+#num RIG_MODEL_IC475
+#num RIG_MODEL_IC575
+#num RIG_MODEL_IC706
+#num RIG_MODEL_IC706MKII
+#num RIG_MODEL_IC706MKIIG
+#num RIG_MODEL_IC707
+#num RIG_MODEL_IC718
+#num RIG_MODEL_IC725
+#num RIG_MODEL_IC726
+#num RIG_MODEL_IC728
+#num RIG_MODEL_IC729
+#num RIG_MODEL_IC731
+#num RIG_MODEL_IC735
+#num RIG_MODEL_IC736
+#num RIG_MODEL_IC737
+#num RIG_MODEL_IC738
+#num RIG_MODEL_IC746
+#num RIG_MODEL_IC751
+#num RIG_MODEL_IC751A
+#num RIG_MODEL_IC756
+#num RIG_MODEL_IC756PRO
+#num RIG_MODEL_IC761
+#num RIG_MODEL_IC765
+#num RIG_MODEL_IC775
+#num RIG_MODEL_IC781
+#num RIG_MODEL_IC820
+#num RIG_MODEL_IC821
+#num RIG_MODEL_IC821H
+#num RIG_MODEL_IC970
+#num RIG_MODEL_ICR10
+#num RIG_MODEL_ICR71
+#num RIG_MODEL_ICR72
+#num RIG_MODEL_ICR75
+#num RIG_MODEL_ICR7000
+#num RIG_MODEL_ICR7100
+#num RIG_MODEL_ICR8500
+#num RIG_MODEL_ICR9000
+#num RIG_MODEL_IC910
+#num RIG_MODEL_IC78
+#num RIG_MODEL_IC746PRO
+#num RIG_MODEL_IC756PROII
+#num RIG_MODEL_ICID1
+#num RIG_MODEL_IC703
+#num RIG_MODEL_IC7800
+#num RIG_MODEL_IC756PROIII
+#num RIG_MODEL_ICR20
+#num RIG_MODEL_IC7000
+#num RIG_MODEL_IC7200
+#num RIG_MODEL_IC7700
+#num RIG_MODEL_IC7600
+#num RIG_MODEL_IC92D
+#num RIG_MODEL_ICR9500
+#num RIG_MODEL_IC7410
+#num RIG_MODEL_IC9100
+#num RIG_MODEL_ICRX7
+#num RIG_MODEL_MINISCOUT
+#num RIG_MODEL_XPLORER
+#num RIG_MODEL_OS535
+#num RIG_MODEL_OS456
+#num RIG_MODEL_OMNIVI
+#num RIG_MODEL_OMNIVIP
+#num RIG_MODEL_PARAGON2
+#num RIG_MODEL_DELTAII
+#num RIG_PCR
+#num RIG_MODEL_PCR1000
+#num RIG_MODEL_PCR100
+#num RIG_MODEL_PCR1500
+#num RIG_MODEL_PCR2500
+#num RIG_AOR
+#num RIG_MODEL_AR8200
+#num RIG_MODEL_AR8000
+#num RIG_MODEL_AR7030
+#num RIG_MODEL_AR5000
+#num RIG_MODEL_AR3030
+#num RIG_MODEL_AR3000A
+#num RIG_MODEL_AR3000
+#num RIG_MODEL_AR2700
+#num RIG_MODEL_AR2500
+#num RIG_MODEL_AR16
+#num RIG_MODEL_SDU5500
+#num RIG_MODEL_SDU5000
+#num RIG_MODEL_AR8600
+#num RIG_MODEL_AR5000A
+#num RIG_MODEL_AR7030P
+#num RIG_MODEL_SR2200
+#num RIG_JRC
+#num RIG_MODEL_JST145
+#num RIG_MODEL_JST245
+#num RIG_MODEL_CMH530
+#num RIG_MODEL_NRD345
+#num RIG_MODEL_NRD525
+#num RIG_MODEL_NRD535
+#num RIG_MODEL_NRD545
+#num RIG_RADIOSHACK
+#num RIG_MODEL_RS64
+#num RIG_MODEL_RS2005
+#num RIG_MODEL_RS2006
+#num RIG_MODEL_RS2035
+#num RIG_MODEL_RS2042
+#num RIG_MODEL_RS2041
+#num RIG_UNIDEN
+#num RIG_MODEL_BC780
+#num RIG_MODEL_BC245
+#num RIG_MODEL_BC895
+#num RIG_MODEL_PRO2052
+#num RIG_MODEL_BC235
+#num RIG_MODEL_BC250
+#num RIG_MODEL_BC785
+#num RIG_MODEL_BC786
+#num RIG_MODEL_BCT8
+#num RIG_MODEL_BCD396T
+#num RIG_MODEL_BCD996T
+#num RIG_MODEL_BC898
+#num RIG_DRAKE
+#num RIG_MODEL_DKR8
+#num RIG_MODEL_DKR8A
+#num RIG_MODEL_DKR8B
+#num RIG_LOWE
+#num RIG_MODEL_HF150
+#num RIG_MODEL_HF225
+#num RIG_MODEL_HF250
+#num RIG_MODEL_HF235
+#num RIG_RACAL
+#num RIG_MODEL_RA3790
+#num RIG_MODEL_RA3720
+#num RIG_MODEL_RA6790
+#num RIG_MODEL_RA3710
+#num RIG_MODEL_RA3702
+#num RIG_WJ
+#num RIG_MODEL_HF1000
+#num RIG_MODEL_HF1000A
+#num RIG_MODEL_WJ8711
+#num RIG_MODEL_WJ8888
+#num RIG_EK
+#num RIG_MODEL_ESM500
+#num RIG_MODEL_EK890
+#num RIG_MODEL_EK891
+#num RIG_MODEL_EK895
+#num RIG_MODEL_EK070
+#num RIG_SKANTI
+#num RIG_MODEL_TRP7000
+#num RIG_MODEL_TRP8000
+#num RIG_MODEL_TRP9000
+#num RIG_MODEL_TRP8255
+#num RIG_WINRADIO
+#num RIG_MODEL_WR1000
+#num RIG_MODEL_WR1500
+#num RIG_MODEL_WR1550
+#num RIG_MODEL_WR3100
+#num RIG_MODEL_WR3150
+#num RIG_MODEL_WR3500
+#num RIG_MODEL_WR3700
+#num RIG_MODEL_G303
+#num RIG_MODEL_G313
+#num RIG_MODEL_G305
+#num RIG_MODEL_G315
+#num RIG_TENTEC
+#num RIG_MODEL_TT550
+#num RIG_MODEL_TT538
+#num RIG_MODEL_RX320
+#num RIG_MODEL_RX340
+#num RIG_MODEL_RX350
+#num RIG_MODEL_TT526
+#num RIG_MODEL_TT516
+#num RIG_MODEL_TT565
+#num RIG_MODEL_TT585
+#num RIG_MODEL_TT588
+#num RIG_MODEL_RX331
+#num RIG_MODEL_TT599
+#num RIG_ALINCO
+#num RIG_MODEL_DX77
+#num RIG_KACHINA
+#num RIG_MODEL_505DSP
+#num RIG_RPC
+#num RIG_MODEL_RPC
+#num RIG_GNURADIO
+#num RIG_MODEL_GNURADIO
+#num RIG_MODEL_MC4020
+#num RIG_MODEL_GRAUDIO
+#num RIG_MODEL_GRAUDIOIQ
+#num RIG_MODEL_USRP_G
+#num RIG_MICROTUNE
+#num RIG_MODEL_MICROTUNE_4937
+#num RIG_MODEL_MICROTUNE_4702
+#num RIG_MODEL_MICROTUNE_4707
+#num RIG_TAPR
+#num RIG_MODEL_DSP10
+#num RIG_FLEXRADIO
+#num RIG_MODEL_SDR1000
+#num RIG_MODEL_SDR1000RFE
+#num RIG_MODEL_DTTSP
+#num RIG_MODEL_DTTSP_UDP
+#num RIG_RFT
+#num RIG_MODEL_EKD500
+#num RIG_KIT
+#num RIG_MODEL_ELEKTOR304
+#num RIG_MODEL_DRT1
+#num RIG_MODEL_DWT
+#num RIG_MODEL_USRP0
+#num RIG_MODEL_USRP
+#num RIG_MODEL_DDS60
+#num RIG_MODEL_ELEKTOR507
+#num RIG_MODEL_MINIVNA
+#num RIG_MODEL_SI570AVRUSB
+#num RIG_MODEL_PMSDR
+#num RIG_MODEL_SI570PICUSB
+#num RIG_MODEL_FIFISDR
+#num RIG_MODEL_FUNCUBEDONGLE
+#num RIG_MODEL_HIQSDR
+#num RIG_TUNER
+#num RIG_MODEL_V4L
+#num RIG_MODEL_V4L2
+#num RIG_RS
+#num RIG_MODEL_ESMC
+#num RIG_MODEL_EB200
+#num RIG_PRM80
+#num RIG_MODEL_PRM8060
+#num RIG_MODEL_PRM8070
+#num RIG_ADAT
+#num RIG_MODEL_ADT_200A
+
+-- grep define /usr/include/hamlib/riglist.h | sed 's/\/\*.*//g' | grep '"' | awk '{print $2}' | sed 's/^/#globalarray /' | sed 's/$/ , CString/'
+#globalarray RIG_BACKEND_DUMMY , CChar
+#globalarray RIG_BACKEND_YAESU , CChar
+#globalarray RIG_BACKEND_KENWOOD , CChar
+#globalarray RIG_BACKEND_ICOM , CChar
+#globalarray RIG_BACKEND_PCR , CChar
+#globalarray RIG_BACKEND_AOR , CChar
+#globalarray RIG_BACKEND_JRC , CChar
+#globalarray RIG_BACKEND_RADIOSHACK , CChar
+#globalarray RIG_BACKEND_UNIDEN , CChar
+#globalarray RIG_BACKEND_DRAKE , CChar
+#globalarray RIG_BACKEND_LOWE , CChar
+#globalarray RIG_BACKEND_RACAL , CChar
+#globalarray RIG_BACKEND_WJ , CChar
+#globalarray RIG_BACKEND_EK , CChar
+#globalarray RIG_BACKEND_SKANTI , CChar
+#globalarray RIG_BACKEND_WINRADIO , CChar
+#globalarray RIG_BACKEND_TENTEC , CChar
+#globalarray RIG_BACKEND_ALINCO , CChar
+#globalarray RIG_BACKEND_KACHINA , CChar
+#globalarray RIG_BACKEND_RPC , CChar
+#globalarray RIG_BACKEND_GNURADIO , CChar
+#globalarray RIG_BACKEND_MICROTUNE , CChar
+#globalarray RIG_BACKEND_TAPR , CChar
+#globalarray RIG_BACKEND_FLEXRADIO , CChar
+#globalarray RIG_BACKEND_RFT , CChar
+#globalarray RIG_BACKEND_KIT , CChar
+#globalarray RIG_BACKEND_TUNER , CChar
+#globalarray RIG_BACKEND_RS , CChar
+#globalarray RIG_BACKEND_PRM80 , CChar
+#globalarray RIG_BACKEND_ADAT , CChar
diff --git a/src/Demo.hs b/src/Demo.hs
new file mode 100644
--- /dev/null
+++ b/src/Demo.hs
@@ -0,0 +1,22 @@
+module Main where
+
+import Foreign.C.Types
+import Foreign.C.String
+import Foreign.Marshal.Alloc
+import Foreign.Marshal.Array
+import Foreign.Ptr
+import Foreign.Storable
+import Bindings.Hamlib.Rig
+
+main :: IO ()
+main = do
+  rig <- c'rig_init 204
+  pokeArray (p'hamlib_port_t'pathname $ p'rig_state'rigport $ p'rig'state rig) (map castCharToCChar "/dev/ttyUSB0")
+  res <- c'rig_open rig
+  print res
+  dptr <- malloc :: IO (Ptr CDouble)
+  res' <- c'rig_get_freq rig 1 dptr
+  print res'
+  freq <- peek dptr
+  putStrLn $ "CURRENT FREQUENCY: " ++ (show freq)
+  return ()
