Re: [Libphidget-devel] libphidget newbie post...
Status: Alpha
Brought to you by:
jstrohm
|
From: Jack S. <js...@ja...> - 2003-06-29 14:24:28
|
I'm still adding the new protocol to the code, I hope to have a test
version checked in tonight, wasn't feeling good yesterday so didn't make
much progress.
Yep, the input buffer has gone from 7 to 8 bytes. Here is the protocol
that chester sent me:
PhidgetInterfaceKit 8.0 Protocol
For PhidgetInterfaceKit 8/8/8
-------------------------------------------------------------------
PhidgetInterfaceKit 8/8/8, 8.0 PID: 0x06C2
PhidgetInterfaceKit 8.0 Protocol
For PhidgetInterfaceKit 8/8/8
-------------------------------------------------------------------
PhidgetInterfaceKit 8/8/8, 8.0 PID: 0x06C2
VID: 0x0045
-------------------------------------------------------------------
Output Packet
Output Packet
Length: 4 Bytes
Byte 0 = m_output_value;
Byte 1 = 0
Byte 2 = 0
Byte 3 = 0
Outputs 1-8 map onto m_output_value bits 0-7; a set bit indicates a CMOS
high (+5V),
a clear bit indicates a CMOS low (gnd)
-------------------------------------------------------------------
Input Packet
Length: 8 Bytes
The current state of this PhidgetInterfaceKit is too large to fit into a
single packet.
So Bit 1 of Byte 0 indicates whether this is a Packet.0 or Packet.1
In the case of Packet.0 (!(Byte_0 & 0x01)), this is the assignments.
Input_State 0-7 map onto Byte 1, bits 0-7, as shown.
m_inputvalue = Data[1];
12-Bit Sensor values are constructed from the packet as described:
newSensor[0] = ((unsigned char)Data[2] + ((unsigned char)Data[3] & 0x0f)
*
256);
newSensor[1] = ((unsigned char)Data[4] + ((unsigned char)Data[3] & 0xf0)
*
16);
newSensor[2] = ((unsigned char)Data[5] + ((unsigned char)Data[6] & 0x0f)
*
256);
newSensor[3] = ((unsigned char)Data[7] + ((unsigned char)Data[6] & 0xf0)
*
16);
In the case of Packet.1 (Byte_0 & 0x01), this is the assignments.
Input_State 0-7 map onto Byte 1, bits 0-7, as shown.
m_inputvalue = Data[1];
12-Bit Sensor values are constructed from the packet as described:
newSensor[4] = ((unsigned char)Data[2] + ((unsigned char)Data[3] & 0x0f)
*
256) * 4;
newSensor[5] = ((unsigned char)Data[4] + ((unsigned char)Data[3] & 0xf0)
*
16) * 4;
newSensor[6] = ((unsigned char)Data[5] + ((unsigned char)Data[6] & 0x0f)
*
256) * 4;
newSensor[7] = ((unsigned char)Data[7] + ((unsigned char)Data[6] & 0xf0)
*
16) * 4;
On Sun, 2003-06-29 at 05:18, Tom Brown wrote:
> On Thu, 26 Jun 2003, Tom Brown wrote:
>
> >
> > sorry, missed some items that may be relevent... linux "dmesg" shows the
> > following:
> >
> > usb.c: usbdevfs driver claimed interface caa63380
> > usb.c: ignoring set_interface for dev 9, iface 0, alt 0
> > usb.c: usbdevfs driver claimed interface caa63380
> > usb.c: ignoring set_interface for dev 9, iface 0, alt 0
> > usb_control/bulk_msg: timeout
> > usbdevfs: USBDEVFS_BULK failed dev 9 ep 0x81 len 7 ret -110
>
> OK, I'm stuck. I can't get past the above. I've turned on all the
> debugging in libusb and it's just saying the same thing. There
> are some issues in the code (talking the endpoint 1 when it's
> really 0x81), but libusb is correcting it with |= 0x80 .... It
> took me a while to figure out why the kernel was reporting 0x81
> when 0x01 was being specified. I added a usb_resetep after the
> timeout, without it my mouse was locking up... which is _really_
> wierd hhmm, maybe that is the problem... (I don't think so, the
> absence or presence of hid and friends doesn't seem to be
> relevent when things are working)
>
> OK, after FAR too much messing around, it seems the buffer
> lengths have to match the USB packet sizes perfectly... changing
> the buffer from 7 to 8 chars in phidgetInterfaceKit488Read (which
> I've hijacked) makes the code run... yeah! (I had already a 14 or
> 16 byte buffer...)
>
> enum ELPError phidgetInterfaceKit488Read
> {
> // char buffer[7];
> char buffer[8];
>
> ... that's _definately_ enough for tonight... (3am... yuck)
>
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
> _______________________________________________
> Libphidget-devel mailing list
> Lib...@li...
> https://lists.sourceforge.net/lists/listinfo/libphidget-devel
--
Jack Strohm <js...@ja...>
|