Skip to content

Commit 15342fa

Browse files
committed
Initial support for T5.
1 parent e57fba0 commit 15342fa

File tree

3 files changed

+47
-13
lines changed

3 files changed

+47
-13
lines changed

README

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Exodriver: Linux (kernel 2.6+) and Mac OS X low-level LabJack U12, U3, U6, UE9,
2-
Digit, T4, and T7 USB library 2.0 and C examples
2+
Digit, T4, T5, and T7 USB library 2.06 and C examples
33
04/01/2014
44
55

6-
This package contains the liblabjackusb 2.0 USB library for low-level U3, U6,
7-
UE9, Digit, T4, and T7 USB communications and C examples for select LabJack
6+
This package contains the liblabjackusb 2.06 USB library for low-level U3, U6,
7+
UE9, Digit, T4, T5, and T7 USB communications and C examples for select LabJack
88
devices.
99

1010
Refer to the INSTALL.Linux or INSTALL.MacOSX file for library requirements,
@@ -15,7 +15,7 @@ Library source code files are located in the liblabjackusb directory.
1515

1616
C examples are provided for the LabJack U12, U3, U6, and UE9 in the examples
1717
directory. They demonstrate basic open/write/read/close operations using
18-
the liblabjackusb library and low-level function command/responses. Low-level
18+
the liblabjackusb library and low-level function command-response. Low-level
1919
function documentation can be found in Section 5 of the LabJack U12, U3, U6,
2020
and UE9 User Guides. The u3.h/u6.h/ue9.h, and u3.c/u6.h/ue9.c files contain
2121
helpful functions for opening/closing USB connections, calculate checksums,
@@ -24,13 +24,13 @@ functions (eAIN, eDAC, eDI, eDO, eTCConfig and eTCValues) that are similar to
2424
our Windows LabJackUD driver's "easy" functions. All other .c files are
2525
examples.
2626

27-
USB command/response times for the U3, U6 and UE9 can be found in section 3.1
27+
USB command-response times for the U3, U6 and UE9 can be found in section 3.1
2828
of their User's Guide and were tested with the Feedback low-level function. USB
2929
Stream times are in Section 3.2. These times were measured in Windows and are
30-
similar in Linux and Mac OS X.
30+
similar in Linux and Mac OS X.
3131

32-
Examples are not provided for Digit, T4, or T7 devices in this package. Please
33-
refer to the LJM library package and documentation for their API.
32+
Examples are not provided for Digit, T4, T5, or T7 devices in this package.
33+
Please refer to the LJM library package and documentation for their API.
3434

3535
The U12 also has a high-level library, which requires this library
3636
(liblabjackusb), that provides the same API as the U12 Windows driver. It can

liblabjackusb/labjackusb.c

+29-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// labjackusb.c
44
//
5-
// Library for accessing U3, U6, UE9, SkyMote bridge, T4, T7, and Digit
5+
// Library for accessing U3, U6, UE9, SkyMote bridge, T4, T5, T7, and Digit
66
// devices over USB.
77
//
88
@@ -455,6 +455,8 @@ static bool LJUSB_isMinFirmware(HANDLE hDevice, unsigned long ProductID)
455455
return true;
456456
case T4_PRODUCT_ID:
457457
return true;
458+
case T5_PRODUCT_ID:
459+
return true;
458460
case T7_PRODUCT_ID:
459461
return true;
460462
case DIGIT_PRODUCT_ID:
@@ -886,6 +888,23 @@ static unsigned long LJUSB_SetupTransfer(HANDLE hDevice, BYTE *pBuff, unsigned l
886888
return 0;
887889
}
888890
break;
891+
case T5_PRODUCT_ID:
892+
isBulk = true;
893+
switch (operation) {
894+
case LJUSB_WRITE:
895+
endpoint = T5_PIPE_EP1_OUT;
896+
break;
897+
case LJUSB_READ:
898+
endpoint = T5_PIPE_EP2_IN;
899+
break;
900+
case LJUSB_STREAM:
901+
endpoint = T5_PIPE_EP3_IN;
902+
break;
903+
default:
904+
errno = EINVAL;
905+
return 0;
906+
}
907+
break;
889908
case T7_PRODUCT_ID:
890909
isBulk = true;
891910
switch (operation) {
@@ -1096,7 +1115,7 @@ unsigned int LJUSB_GetDevCounts(UINT *productCounts, UINT * productIds, UINT n)
10961115
unsigned int ue9ProductCount = 0, u12ProductCount = 0;
10971116
unsigned int bridgeProductCount = 0, t7ProductCount = 0;
10981117
unsigned int digitProductCount = 0, t4ProductCount = 0;
1099-
unsigned int allProductCount = 0;
1118+
unsigned int t5ProductCount = 0, allProductCount = 0;
11001119

11011120
if (!gIsLibUSBInitialized) {
11021121
r = libusb_init(&gLJContext);
@@ -1147,6 +1166,9 @@ unsigned int LJUSB_GetDevCounts(UINT *productCounts, UINT * productIds, UINT n)
11471166
case T4_PRODUCT_ID:
11481167
t4ProductCount++;
11491168
break;
1169+
case T5_PRODUCT_ID:
1170+
t5ProductCount++;
1171+
break;
11501172
case T7_PRODUCT_ID:
11511173
t7ProductCount++;
11521174
break;
@@ -1200,6 +1222,11 @@ unsigned int LJUSB_GetDevCounts(UINT *productCounts, UINT * productIds, UINT n)
12001222
productIds[i] = T4_PRODUCT_ID;
12011223
allProductCount += t4ProductCount;
12021224
break;
1225+
case 8:
1226+
productCounts[i] = t5ProductCount;
1227+
productIds[i] = T5_PRODUCT_ID;
1228+
allProductCount += t5ProductCount;
1229+
break;
12031230
}
12041231
}
12051232

liblabjackusb/labjackusb.h

+10-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
// - libusb error prints are silenced when LJ_DEBUG is not enabled.
6767
// - Added revision number to library version number. The float version
6868
// number 2.0503 is equivalent to 2.5.3 (major.minor.revision).
69-
// 2.0600 - Initial T4 support
69+
// 2.0600 - Initial T4 and T5 support
7070
//-----------------------------------------------------------------------------
7171
//
7272

@@ -91,6 +91,7 @@ typedef unsigned char BYTE;
9191
#define U12_PRODUCT_ID 1
9292
#define BRIDGE_PRODUCT_ID 1000
9393
#define T4_PRODUCT_ID 4
94+
#define T5_PRODUCT_ID 5
9495
#define T7_PRODUCT_ID 7
9596
#define DIGIT_PRODUCT_ID 200
9697
#define UNUSED_PRODUCT_ID -1
@@ -125,6 +126,11 @@ typedef unsigned char BYTE;
125126
#define T4_PIPE_EP2_IN 0x82
126127
#define T4_PIPE_EP3_IN 0x83 //Stream Endpoint
127128

129+
//T5 pipes to read/write through
130+
#define T5_PIPE_EP1_OUT 1
131+
#define T5_PIPE_EP2_IN 0x82
132+
#define T5_PIPE_EP3_IN 0x83 //Stream Endpoint
133+
128134
//T7 pipes to read/write through
129135
#define T7_PIPE_EP1_OUT 1
130136
#define T7_PIPE_EP2_IN 0x82
@@ -156,8 +162,8 @@ unsigned int LJUSB_GetDevCounts(UINT *productCounts, UINT * productIds, UINT n);
156162
// uint productCounts[10], productIds[10];
157163
// r = LJUSB_GetDevCounts(productCounts, productIds, 10);
158164
// would return arrays that may look like
159-
// {1, 2, 3, 4, 5, 6, 7, 8, 0, 0}
160-
// {3, 6, 9, 1, 1000, 7, 200, 4, 0, 0}
165+
// {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}
166+
// {3, 6, 9, 1, 1000, 7, 200, 4, 5, 0}
161167
// which means there are
162168
// 1 U3
163169
// 2 U6s
@@ -167,6 +173,7 @@ unsigned int LJUSB_GetDevCounts(UINT *productCounts, UINT * productIds, UINT n);
167173
// 6 T7s
168174
// 7 Digits
169175
// 8 T4s
176+
// 9 T5s
170177
// connected.
171178

172179
int LJUSB_OpenAllDevices(HANDLE* devHandles, UINT* productIds, UINT maxDevices);

0 commit comments

Comments
 (0)