- dll renamed to LibusbJava
- ant file for compiling on Windows and Linux - use g++ instead of gcc - version string in resource file (should be provided as command line argument, but doesn't work with windres -> bug?) git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@204 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>LibusbWinDll</name>
|
||||
<name>LibusbJava</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Thu Aug 10 13:25:29 CEST 2006
|
||||
#Fri Nov 24 10:21:40 CET 2006
|
||||
eclipse.preferences.version=1
|
||||
indexerId=org.eclipse.cdt.core.domsourceindexer
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include "LibusbWin.h"
|
||||
#include "LibusbJava.h"
|
||||
#include "usb.h"
|
||||
|
||||
//#define DEBUGON
|
||||
@@ -68,54 +68,54 @@ jfieldID usb_epDescFID_bLength, usb_epDescFID_bDescriptorType, \
|
||||
usb_epDescFID_extralen;
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_set_debug
|
||||
* Signature: (B)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_ch_ntb_usb_LibusbWin_usb_1set_1debug
|
||||
JNIEXPORT void JNICALL Java_ch_ntb_usb_LibusbJava_usb_1set_1debug
|
||||
(JNIEnv *env, jclass obj, jint level)
|
||||
{
|
||||
usb_set_debug(level);
|
||||
}
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_init
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_ch_ntb_usb_LibusbWin_usb_1init
|
||||
JNIEXPORT void JNICALL Java_ch_ntb_usb_LibusbJava_usb_1init
|
||||
(JNIEnv *env, jclass obj)
|
||||
{
|
||||
usb_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_find_busses
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1find_1busses
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1find_1busses
|
||||
(JNIEnv *env, jclass obj)
|
||||
{
|
||||
return usb_find_busses();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_find_devices
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1find_1devices
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1find_1devices
|
||||
(JNIEnv *env, jclass obj)
|
||||
{
|
||||
return usb_find_devices();
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_get_busses
|
||||
* Signature: ()Lch/ntb/usb/Usb_Bus;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1busses
|
||||
JNIEXPORT jobject JNICALL Java_ch_ntb_usb_LibusbJava_usb_1get_1busses
|
||||
(JNIEnv *env, jclass obj)
|
||||
{
|
||||
|
||||
@@ -339,7 +339,7 @@ JNIEXPORT jobject JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1busses
|
||||
env->SetObjectField(usb_devObj, usb_devFID_descriptor, usb_devDescObj);
|
||||
// configuration descriptor
|
||||
// Loop through all of the configurations
|
||||
usb_confDescObjArray = env->NewObjectArray(dev->descriptor.bNumConfigurations, usb_confDescClazz, NULL);
|
||||
usb_confDescObjArray = (jobjectArray) env->NewObjectArray(dev->descriptor.bNumConfigurations, usb_confDescClazz, NULL);
|
||||
if (!usb_confDescObjArray) { printf("Error NewObject 6\n"); return NULL; }
|
||||
for (int c = 0; c < dev->descriptor.bNumConfigurations; c++){
|
||||
#ifdef DEBUGON
|
||||
@@ -370,7 +370,7 @@ JNIEXPORT jobject JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1busses
|
||||
printf("Extra descriptors are not passed to java!\n");
|
||||
}
|
||||
// interface
|
||||
usb_intObjArray = env->NewObjectArray(dev->config[c].bNumInterfaces, usb_intClazz, NULL);
|
||||
usb_intObjArray = (jobjectArray) env->NewObjectArray(dev->config[c].bNumInterfaces, usb_intClazz, NULL);
|
||||
if (!usb_intObjArray) { printf("Error NewObject (usb_intObjArray)\n"); return NULL; }
|
||||
for (int i = 0; i < dev->config[c].bNumInterfaces; i++){
|
||||
#ifdef DEBUGON
|
||||
@@ -387,7 +387,7 @@ JNIEXPORT jobject JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1busses
|
||||
env->SetObjectArrayElement(usb_intObjArray, i, usb_intObj);
|
||||
env->SetIntField(usb_intObj, usb_intFID_num_altsetting, dev->config[c].interface[i].num_altsetting);
|
||||
// interface descriptor
|
||||
usb_intDescObjArray = env->NewObjectArray(dev->config[c].interface[i].num_altsetting, usb_intDescClazz, NULL);
|
||||
usb_intDescObjArray = (jobjectArray) env->NewObjectArray(dev->config[c].interface[i].num_altsetting, usb_intDescClazz, NULL);
|
||||
if (!usb_intDescObjArray) { printf("Error NewObject (usb_intDescObjArray)\n"); return NULL; }
|
||||
for (int a = 0; a < dev->config[c].interface[i].num_altsetting; a++){
|
||||
#ifdef DEBUGON
|
||||
@@ -419,7 +419,7 @@ JNIEXPORT jobject JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1busses
|
||||
}
|
||||
env->SetObjectField(usb_intDescObj, usb_intDescFID_extra, NULL);
|
||||
// endpoint descriptor
|
||||
usb_epDescObjArray = env->NewObjectArray(dev->config[c].interface[i].altsetting[a].bNumEndpoints, usb_epDescClazz, NULL);
|
||||
usb_epDescObjArray = (jobjectArray) env->NewObjectArray(dev->config[c].interface[i].altsetting[a].bNumEndpoints, usb_epDescClazz, NULL);
|
||||
if (!usb_epDescObjArray) { printf("Error NewObject (usb_epDescObjArray)\n"); return NULL; }
|
||||
for (int e = 0; e < dev->config[c].interface[i].altsetting[a].bNumEndpoints; e++){
|
||||
#ifdef DEBUGON
|
||||
@@ -478,11 +478,11 @@ JNIEXPORT jobject JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1busses
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_open
|
||||
* Signature: (Lch/ntb/usb/Usb_Device;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1open
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1open
|
||||
(JNIEnv *env, jclass obj, jobject dev)
|
||||
{
|
||||
if (busses == NULL) { return -1; }
|
||||
@@ -502,88 +502,88 @@ JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1open
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_close
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1close
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1close
|
||||
(JNIEnv *env, jclass obj, jint dev_handle)
|
||||
{
|
||||
return (jint) usb_close((usb_dev_handle *) dev_handle);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_set_configuration
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1set_1configuration
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1set_1configuration
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint configuration)
|
||||
{
|
||||
return usb_set_configuration((usb_dev_handle *) dev_handle, configuration);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_set_altinterface
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1set_1altinterface
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1set_1altinterface
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint alternate)
|
||||
{
|
||||
return usb_set_altinterface((usb_dev_handle *) dev_handle, alternate);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_clear_halt
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1clear_1halt
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1clear_1halt
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint ep)
|
||||
{
|
||||
return usb_clear_halt((usb_dev_handle *) dev_handle, (unsigned) ep);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_reset
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1reset
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1reset
|
||||
(JNIEnv *env, jclass obj, jint dev_handle)
|
||||
{
|
||||
return usb_reset((usb_dev_handle *) dev_handle);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_claim_interface
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1claim_1interface
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1claim_1interface
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint interface)
|
||||
{
|
||||
return usb_claim_interface((usb_dev_handle *) dev_handle, interface);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_release_interface
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1release_1interface
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1release_1interface
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint interface)
|
||||
{
|
||||
return usb_release_interface((usb_dev_handle *) dev_handle, interface);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_control_msg
|
||||
* Signature: (IIIII[BII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1control_1msg
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1control_1msg
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint requesttype, jint request, jint value, jint index, jbyteArray jbytes, jint size, jint timeout)
|
||||
{
|
||||
jbyte *bytes = env->GetByteArrayElements(jbytes, NULL);
|
||||
@@ -595,11 +595,11 @@ JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1control_1msg
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_get_string
|
||||
* Signature: (III)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1string
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbJava_usb_1get_1string
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint index, jint langid)
|
||||
{
|
||||
char string[256];
|
||||
@@ -610,11 +610,11 @@ JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1string
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_get_string_simple
|
||||
* Signature: (II)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1string_1simple
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbJava_usb_1get_1string_1simple
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint index)
|
||||
{
|
||||
char string[256];
|
||||
@@ -625,11 +625,11 @@ JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1string_1simple
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_get_descriptor
|
||||
* Signature: (IBBI)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1descriptor
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbJava_usb_1get_1descriptor
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jbyte type, jbyte index, jint size)
|
||||
{
|
||||
char *string = (char *) malloc(size * sizeof(char));
|
||||
@@ -641,11 +641,11 @@ JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1descriptor
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_get_descriptor_by_endpoint
|
||||
* Signature: (IIBBI)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1descriptor_1by_1endpoint
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbJava_usb_1get_1descriptor_1by_1endpoint
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint ep, jbyte type, jbyte index, jint size)
|
||||
{
|
||||
char *string = (char *) malloc(size * sizeof(char));
|
||||
@@ -657,11 +657,11 @@ JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1descriptor_1by_1en
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_bulk_write
|
||||
* Signature: (II[BII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1bulk_1write
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1bulk_1write
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint ep, jbyteArray jbytes, jint size, jint timeout)
|
||||
{
|
||||
jbyte *bytes = env->GetByteArrayElements(jbytes, NULL);
|
||||
@@ -669,11 +669,11 @@ JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1bulk_1write
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_bulk_read
|
||||
* Signature: (II[BII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1bulk_1read
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1bulk_1read
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint ep, jbyteArray jbytes, jint size, jint timeout)
|
||||
{
|
||||
char *bytes = (char *) malloc(size * sizeof(char));
|
||||
@@ -685,11 +685,11 @@ JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1bulk_1read
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_interrupt_write
|
||||
* Signature: (II[BII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1interrupt_1write
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1interrupt_1write
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint ep, jbyteArray jbytes, jint size, jint timeout)
|
||||
{
|
||||
jbyte *bytes = env->GetByteArrayElements(jbytes, NULL);
|
||||
@@ -697,11 +697,11 @@ JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1interrupt_1write
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_interrupt_read
|
||||
* Signature: (II[BII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1interrupt_1read
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1interrupt_1read
|
||||
(JNIEnv *env, jclass obj, jint dev_handle, jint ep, jbyteArray jbytes, jint size, jint timeout)
|
||||
{
|
||||
char *bytes = (char *) malloc(size * sizeof(char));
|
||||
@@ -713,11 +713,11 @@ JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1interrupt_1read
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_strerror
|
||||
* Signature: ()Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1strerror
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbJava_usb_1strerror
|
||||
(JNIEnv *env, jclass obj){
|
||||
|
||||
char *str = usb_strerror();
|
||||
@@ -1,194 +1,194 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class ch_ntb_usb_LibusbWin */
|
||||
/* Header for class ch_ntb_usb_LibusbJava */
|
||||
|
||||
#ifndef _Included_ch_ntb_usb_LibusbWin
|
||||
#define _Included_ch_ntb_usb_LibusbWin
|
||||
#ifndef _Included_ch_ntb_usb_LibusbJava
|
||||
#define _Included_ch_ntb_usb_LibusbJava
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_set_debug
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_ch_ntb_usb_LibusbWin_usb_1set_1debug
|
||||
JNIEXPORT void JNICALL Java_ch_ntb_usb_LibusbJava_usb_1set_1debug
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_init
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_ch_ntb_usb_LibusbWin_usb_1init
|
||||
JNIEXPORT void JNICALL Java_ch_ntb_usb_LibusbJava_usb_1init
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_find_busses
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1find_1busses
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1find_1busses
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_find_devices
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1find_1devices
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1find_1devices
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_get_busses
|
||||
* Signature: ()Lch/ntb/usb/Usb_Bus;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1busses
|
||||
JNIEXPORT jobject JNICALL Java_ch_ntb_usb_LibusbJava_usb_1get_1busses
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_open
|
||||
* Signature: (Lch/ntb/usb/Usb_Device;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1open
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1open
|
||||
(JNIEnv *, jclass, jobject);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_close
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1close
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1close
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_set_configuration
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1set_1configuration
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1set_1configuration
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_set_altinterface
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1set_1altinterface
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1set_1altinterface
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_clear_halt
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1clear_1halt
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1clear_1halt
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_reset
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1reset
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1reset
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_claim_interface
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1claim_1interface
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1claim_1interface
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_release_interface
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1release_1interface
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1release_1interface
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_control_msg
|
||||
* Signature: (IIIII[BII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1control_1msg
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1control_1msg
|
||||
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jbyteArray, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_get_string
|
||||
* Signature: (III)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1string
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbJava_usb_1get_1string
|
||||
(JNIEnv *, jclass, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_get_string_simple
|
||||
* Signature: (II)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1string_1simple
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbJava_usb_1get_1string_1simple
|
||||
(JNIEnv *, jclass, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_get_descriptor
|
||||
* Signature: (IBBI)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1descriptor
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbJava_usb_1get_1descriptor
|
||||
(JNIEnv *, jclass, jint, jbyte, jbyte, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_get_descriptor_by_endpoint
|
||||
* Signature: (IIBBI)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1get_1descriptor_1by_1endpoint
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbJava_usb_1get_1descriptor_1by_1endpoint
|
||||
(JNIEnv *, jclass, jint, jint, jbyte, jbyte, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_bulk_write
|
||||
* Signature: (II[BII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1bulk_1write
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1bulk_1write
|
||||
(JNIEnv *, jclass, jint, jint, jbyteArray, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_bulk_read
|
||||
* Signature: (II[BII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1bulk_1read
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1bulk_1read
|
||||
(JNIEnv *, jclass, jint, jint, jbyteArray, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_interrupt_write
|
||||
* Signature: (II[BII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1interrupt_1write
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1interrupt_1write
|
||||
(JNIEnv *, jclass, jint, jint, jbyteArray, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_interrupt_read
|
||||
* Signature: (II[BII)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbWin_usb_1interrupt_1read
|
||||
JNIEXPORT jint JNICALL Java_ch_ntb_usb_LibusbJava_usb_1interrupt_1read
|
||||
(JNIEnv *, jclass, jint, jint, jbyteArray, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: ch_ntb_usb_LibusbWin
|
||||
* Class: ch_ntb_usb_LibusbJava
|
||||
* Method: usb_strerror
|
||||
* Signature: ()Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbWin_usb_1strerror
|
||||
JNIEXPORT jstring JNICALL Java_ch_ntb_usb_LibusbJava_usb_1strerror
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -6,25 +6,78 @@
|
||||
Build file for LibusbWin Dll
|
||||
|
||||
REQUIREMENTS:
|
||||
gcc and make must be on your PATH
|
||||
winres
|
||||
g++
|
||||
|
||||
schlaepfer
|
||||
====================================================================== -->
|
||||
<project name="LibusbWinDll" default="dll">
|
||||
<description>
|
||||
Build file for LibusbWin Dll
|
||||
<project name="LibusbWinDll" basedir=".">
|
||||
<description>
|
||||
Build file for LibUsb-Win32 Java Wrapper
|
||||
</description>
|
||||
|
||||
<target name="clean" description="--> Clean LibusbWin Dll">
|
||||
<exec executable="make">
|
||||
<arg value="clean"/>
|
||||
</exec>
|
||||
</target>
|
||||
<property file="project.properties" />
|
||||
<property file="version.properties" />
|
||||
<property name="version.win.rc" value="${version.major},${version.minor},${version.micro},${version.nano}" />
|
||||
<property name="version.win.str" value="${version.major}.${version.minor}.${version.micro}.${version.nano}" />
|
||||
<property name="version.linux" value="${version.major}.${version.minor}.${version.micro}" />
|
||||
|
||||
<patternset id="buildfiles">
|
||||
<include name="**/*.o" />
|
||||
<include name="**/*.dll" />
|
||||
<include name="**/*.so" />
|
||||
</patternset>
|
||||
|
||||
<target name="clean" description="--> Clean build files">
|
||||
<delete>
|
||||
<fileset dir=".">
|
||||
<patternset refid="buildfiles" />
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="dll" description="--> Build LibusbWin Dll">
|
||||
<exec executable="make">
|
||||
<arg value="dll"/>
|
||||
</exec>
|
||||
</target>
|
||||
<target name="windows" description="--> Build ${build.shlib.win.shlibname}">
|
||||
<!-- The RC_VERSION_STR string is not recognized by windres as command line argument.
|
||||
I think this is a bug. The only (nasty) workaround I found is to write it directly to the file. -->
|
||||
<!--
|
||||
<exec dir="." executable="${build.win.windres}">
|
||||
<arg value="-o${build.win.resource.obj}" />
|
||||
<arg value="${build.win.resource.rc}" />
|
||||
<arg value="-DRC_VERSION=${version.rc}" />
|
||||
<arg value="-DRC_VERSION_STR='\"${version.str}\"'" />
|
||||
</exec>
|
||||
-->
|
||||
<echo level="warning" message="WARNING: If the version has changed -> change the RC_VERSION_STR define in resource.rc to "${version.str}"" />
|
||||
<exec dir="." executable="${build.win.windres}">
|
||||
<arg value="-o${build.win.resource.obj}" />
|
||||
<arg value="${build.win.resource.rc}" />
|
||||
<arg value="-DRC_VERSION=${version.win.rc}" />
|
||||
</exec>
|
||||
<exec executable="${build.win.compiler}">
|
||||
<arg value="-Wall" />
|
||||
<arg value="-D_JNI_IMPLEMENTATION_" />
|
||||
<arg value="-Wl,--kill-at" />
|
||||
<arg value="-mwindows" />
|
||||
<arg value="-shared" />
|
||||
<arg value="-I${user.dir}" />
|
||||
<arg value="${build.shlib.srcname}" />
|
||||
<arg value="-o${build.shlib.win.shlibname}" />
|
||||
<arg value="${build.win.resource.obj}" />
|
||||
<arg value="${build.lib.libusb}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="linux" depends="clean" description="--> Build ${build.shlib.linux.shlibname}">
|
||||
<exec dir="." executable="${build.win.compiler}">
|
||||
<arg value="-shared" />
|
||||
<arg value="-Wl,-soname,lib${build.shlib.linux.shlibname}" />
|
||||
<arg value="-I${build.linux.includes}" />
|
||||
<arg value="-mwindows" />
|
||||
<arg value="-shared" />
|
||||
<arg value="-o${build.shlib.linux.shlibname}.${version.linux}" />
|
||||
<arg value="${build.linux.includes}/${build.lib.libusb}" />
|
||||
<arg value="${build.linux.includes}/${build.lib.libusbpp}" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
||||
29
LibusbWinDll/project.properties
Normal file
29
LibusbWinDll/project.properties
Normal file
@@ -0,0 +1,29 @@
|
||||
############################
|
||||
# common build properties #
|
||||
############################
|
||||
# folders
|
||||
build.dir.src=src
|
||||
build.dir.bin=bin
|
||||
|
||||
# filenames
|
||||
build.lib.libusb=libusb.a
|
||||
build.lib.libusbpp=libusbpp.a
|
||||
build.shlib.srcname=LibusbJava.cpp
|
||||
build.shlib.win.shlibname=LibusbJava.dll
|
||||
build.shlib.linux.shlibname=libusbJava.so
|
||||
build.test.srcname=LibusbTest
|
||||
build.test.execname=LibusbTest
|
||||
|
||||
#####################################
|
||||
# Windows specific build properties #
|
||||
#####################################
|
||||
build.win.compiler=g++
|
||||
build.win.windres=windres
|
||||
build.win.resource.rc=resource.rc
|
||||
build.win.resource.obj=resource.o
|
||||
|
||||
####################################
|
||||
# Linux specific build properties #
|
||||
####################################
|
||||
build.linux.compiler=g++
|
||||
build.linux.includes=/usr/lib
|
||||
@@ -1,8 +1,7 @@
|
||||
#define RC_FILE_TYPE VFT_DLL
|
||||
#define RC_FILE_SUB_TYPE VFT2_UNKNOWN
|
||||
#define RC_PRODUCT_STR "Java LibUsb-Win32 wrapper - DLL"
|
||||
#define RC_FILE_NAME_STR "LibusbWin.dll"
|
||||
#define RC_FILE_NAME_STR "LibusbJava.dll"
|
||||
#define RC_VERSION_STR "0.1.0.0"
|
||||
|
||||
#include "common.rc"
|
||||
|
||||
|
||||
|
||||
5
LibusbWinDll/version.properties
Normal file
5
LibusbWinDll/version.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
# NOTE: if the version is changed -> change the define in resource.rc"
|
||||
version.major=0
|
||||
version.minor=1
|
||||
version.micro=0
|
||||
version.nano=0
|
||||
Reference in New Issue
Block a user