Skip to main content
Submitted by echochen on Tue, 07/21/2015 - 17:39

Under ubuntu 14.04
I use python ctypes to call libgclib.so and test.

The functions that defined in gclib.h can call by ctypes, as below:
GOpen (GCStringIn address, GCon *g)
GClose (GCon g)
GRead (GCon g, GBufOut buffer, GSize buffer_len, GSize *bytes_read)
GWrite (GCon g, GBufIn buffer, GSize buffer_len)
GCommand (GCon g, GCStringIn command, GBufOut buffer, GSize buffer_len, GSize *bytes_returned)
GProgramDownload (GCon g, GCStringIn program, GCStringIn preprocessor)
GProgramUpload (GCon g, GBufOut buffer, GSize buffer_len)
GArrayDownload (GCon g, const GCStringIn array_name, GOption first, GOption last, GCStringIn buffer)
GArrayUpload (GCon g, const GCStringIn array_name, GOption first, GOption last, GOption delim, GBufOut buffer, GSize buffer_len)
GRecord (GCon g, union GDataRecord *record, GOption method)
GMessage (GCon g, GCStringOut buffer, GSize buffer_len)
GInterrupt (GCon g, GStatus *status_byte)
GFirmwareDownload (GCon g, GCStringIn filepath)
GUtility (GCon g, GOption request, GMemory memory1, GMemory memory2)

In these functions, test success on GOpen GClose GCommand GProgramDownload and GProgramUpload, all return rc=0.
But test GUtility failure, do any effort that i can do.

I come here for help, if anyone have done something like that, would you like to share python code with me?

Comments 2

echochen on 07/22/2015 - 22:58

i do it by myself.
in python, post below code

improt ctypes
from ctypes import *
galil=cdll.LoadLibrary('libgclib.so')

buf=create_string_buffer(1024)
buf_len=c_ulong(1024)

rc=galil.GUtility(0, 128, buf, pointer(buf_len))

#############then test rc and buf to see return
rc=0
buf.value='115.93.212'