[Gambas-user] Help binding to /dev/usbtmc0?

Randall Morgan rmorgan62 at ...626...
Sat Jun 29 22:13:30 CEST 2013


Sorry to jump in here but I was wondering if this could be caused the mode
the usb connection is opened in? The OS is not required to send the data to
usb devices at the time your program talks to the usb port. The data is
often cached for some time before being sent to the usb device. There is a
usb mode know as interrupt mode. It is anything but a true interrupt mode.
It does however ask the OS to ensure that the data is sent to the usb
device within a particular time frame, 100ms for example. So using usb
interrupt mode you can at least request that your data be sent with a
certain time frame. But I have found that Windows 7 still does not always
cooperate in interrupt mode. My work with CNC stepper controllers resulted
in needing a polling routine and a buffer on the controller board. The
controller board also had to be able to handle real-time errors which meant
it had to deal with the sensors itself and simply report that status back
to the PC software (EMC2 and MACH3).  So in short, I wonder if you are
using the USB port in standard mode or interrupt mode and are you taking
into account the delay that the communications might experience?

Just some thoughts




On Sat, Jun 29, 2013 at 11:03 AM, Tobias Boege <taboege at ...626...> wrote:

> On Fri, 28 Jun 2013, dr.diesel wrote:
> > Thanks for the help.  That is basically what I've done, expect all I get:
> >
> > "System error #110: Connection Timed out"
> >
> > I get the same when I cat and echo, but I get the proper response then
> get
> > the error:
> >
> > [root at ...2809... andy]# echo *IDN?>/dev/usbtmc0
> > [root at ...2809... andy]# cat /dev/usbtmc0
> > Rigol Technologies,DSA815,DSA8A151449181,00.01.06.00.05
> > ***10 second pause ****
> > cat: /dev/usbtmc0: Connection timed out
> > [root at ...2809... andy]#
> >
> > It appears that it is waiting for more, how to I read only what's there
> then
> > exit?
> >
> > I've tried a simple Read #hDevice and a While not EOF:
> >
> >
> > Public hDevice As File
> > Public sLine As String
> >
> >
> > Public Sub Form_Open()
> >  hDevice = Open "/dev/usbtmc0" For Input Output Watch
> > End
> >
> > Public Sub File_Read()
> >   Dim iByte As Byte
> >
> >   'Read #hDevice, iByte
> >   'Print "Got one byte: "; iByte
> >   '
> >   While Not Eof(hDevice)
> >     Line Input #hDevice, sLine
> >     Print sLine
> >   Wend
> > End
> >
> > Many thanks, any other suggestions?
> >
>
> I have never seen this error with cat. At least we know for sure that this
> is not a Gambas problem. Did you read [0]?
>
> Regards,
> Tobi
>
> [0] http://www.spinics.net/lists/linux-usb/msg21894.html
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
If you ask me if it can be done. The answer is YES, it can always be done.
The correct questions however are... What will it cost, and how long will
it take?



More information about the User mailing list