usb4java | USB library for Java based on libusb | Change Data Capture library
kandi X-RAY | usb4java Summary
kandi X-RAY | usb4java Summary
USB library for Java based on libusb
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Loads the native wrapper library
- Extract a single library
- Creates a temporary directory for USB native libraries
- Get the shared library extension name
- Gets the required fields of a control transfer
- Sets the data buffer
- Compares this object with the specified object
- Equals interface
- Compares two versions
- Compare two URIs
- Compare two SsUsabilityDescriptors
- Compares two SsEndpointCompanions
- Compares this context to another
- Compares two devices
- Compares this object to another object
- Compares two objects
- Compares two Transfer objects
- Create a control setup packet
- Set the polling for a context
- Retrieve the position of an Isochronous packet
- Populates the required fields for an interrupt transfer
- Compares this object to another
- Populates an Isochronous transfer fields
- Registers a hotplug callback function
usb4java Key Features
usb4java Examples and Code Snippets
Community Discussions
Trending Discussions on usb4java
QUESTION
My Java program needs to get a list of the drive letters of connected USB devices, but only those that support USB 3.0 (both the device and the USB port it is plugged into, so that it works with high speed).
Currently I try to use WMI through a PowerShell command my Java programm executes.
I already found this: Powershell: Grab USB Drive letter. But it would also list USB 2.0 devices.
Regarding version detection I found this: How to check the version of the available USB ports? - The PowerShell command I tried is Get-WmiObject Win32_USBHub
. This brings up several problems. First: It lists far more stuff than only USB drives (I think also all the USB hubs of my PC). Second: Even though there is a field USBVersion for all items in the list it is always empty.
The essence of my research over the last days is, that there are 2 realms of information I need to connect.
- Drives / Logical Drives
- Drive Letter
- BusType (is equal to "USB" for my matter)
- USB devices
- Vendor ID and Product ID (VID&PID)
- bcdUSB (value within the usb device descriptor, indicating USB Version)
For a given drive letter I need to find the bcdUSB value. But I haven't found a way to get the drive corresponding to a USB device.
What I tried so farWMI over PowerShell
Relevant commands I found are
...ANSWER
Answered 2021-Mar-15 at 07:53Maybe this is what you are looking for: Find Windows Drive Letter of a removable disk from USB VID/PID At least someone marked the answer as working... :-)
QUESTION
the command line is
...ANSWER
Answered 2020-Jul-20 at 05:41openssl pkeyutl -sign
with an RSA private key and -pkeyopt digest:$alg
does steps 2-5 of EMSA-PKCS1-v1_5 plus the private modexp (i.e. 8.2.1 step 2 using RSASP1 from 5.2.1); without that -pkeyopt
it does not do step 2, which encodes the hash value in a simple ASN.1 structure.
The Java Signature
algorithms that include a hash like SHA1withRSA
do all steps of EMSA-PKCS1-v1_5 plus modexp, while the scheme NONEwithRSA
does only steps 3-5 plus modexp, and neither of these matches what you want. If you can't supply the data to let Signature
do the hashing, you'll need to do step 2 yourself and then NONEwithRSA
. Although ASN.1 encoding in general can be complicated (and decoding even more so), this case can be done simply by concatenating a prefix determined entirely by the hash algorithm to the hash value; see note 1 on page 47.
Meta: there have been lots of Qs about the differences in RSA v1_5 signatures between openssl rsautl
, pkeyutl
with and without -pkeyopt digest
, or dgst -sign
and other systems like Java, all to do with the issue of including or not including the ASN.1 encoding step (and many of them older than rfc8017!) but I can't find any that is a good dupe for this Q.
QUESTION
So i have a build.gradle file like the following. And for each time i refresh gradle it downloads all dependencies again and also compiles them again..... Pls help this is getting really frustrating....
...ANSWER
Answered 2019-May-21 at 13:13You can try to configure the Gradle build environment, gradle.properties in project root directory.
QUESTION
I want to use Java to get access to smart card by Omnikey reader. I found couple solutions like a smartcardio, but it didn't help enough. Basically I connected with reader, but it uses APDU when I don't need it. I have an idea to open stream to my reader by USB and by stream put binary commands to device and then get answer the same way, but technically how can I write it in Java?
I also found libraries like a usb4java, but also bad opinion about that. Maybe someone had any experience with this device and could give me some tips?
On the internet there aren't many tutorials about programming smart cards. I tried also use pyApduTool or HID Omnikey Sync API V2.0., but that only for test. I have to write simple requests to get information from card.
...ANSWER
Answered 2019-Mar-04 at 20:11There are basically two ways around your issue:
don't use the PC/SC interface used by
java.smartcardio
but use native, proprietary libraries from the card reader manufacturer, for instance using a wrapper (JNI based, but there are better / higher level alternatives out there);keep using APDU's, but use CLA byte set to
FF
hex, opening a connection to the reader.FF
is reserved, but it is generally reserved for this kind of card reader access, e.g. to access memory cards without ISO/IEC 7816-4 layer that are supported by the reader manufacturer.out of two (for completeness only): many card readers have been created using a USB to serial interface chip, which means that you can directly connect to the (virtual) serial interface; needless to say, you will have to know what commands to send and program everything yourself, if this interface is present at all (Omnikey 3121 is relatively new, so I would be surprised).
Both options rely on card reader specific functions, so you will have find the information for the reader to see what is possible. To my knowledge there is no way to request what functionality is provided. Don't expect too much from standardization for this kind of functionality.
Did you check your card reader specific documentation?
QUESTION
I'm trying to update received ByteBuffer
data (converted to String
) to JTextField
, but text field is printing output data along with junk values, even after trimming the string.
But in output console it is printing proper data, when it comes to text field in GUI it's printing junk data along with proper data.
...ANSWER
Answered 2018-Sep-24 at 09:14Most probably you are receiving a C-String as a response. So the String is terminated by a NUL ('\0') character. Try getting the value using:
QUESTION
System:
- Windows 10 64-bit
- Eclipse Photon
Problem:
Trying to use usb4java
package in my project to select correct usb port and start moving information through it. I downloaded the package from usb4java.org, unzipped and added it to the references from java build path.
ANSWER
Answered 2018-Sep-21 at 15:59Included the file lib/libusb-1.0-windows-x86_64.jar
in the classpath.
QUESTION
Need your help here.
I'm currently developing Java application that can communicate with a ingenico iWL220 device, using usb4java from libusb Library. I installed the driver and it can be read from Device Manager just fine. I mainly follows the code at
http://www.mets-blog.com/java-usb-communication-usb4java/ for the Low API.
http://www.mets-blog.com/java-usb-communication-usb4java-high-api/ for the High API.
The first one i tried is the Low API, my Main Class is as follows:
...ANSWER
Answered 2018-Aug-07 at 03:21It's solved, i used Java Serial Connection instead for it, and it works just fine!
QUESTION
Im having issues with this line of code. I was able to successfully open the device and send .
Sending:
...ANSWER
Answered 2018-May-15 at 21:03sometimes it is -9 when I disconnect
Should always be -9, as a disconnect clears the USB handle inside the kernel.
For Sending, I got a response of 0 but in receiving, I got -7.
That is the regular ERROR_TIMEOUT
, which may or may not be an error at all.
The basic meaning is just: The USB device did not send any data on the endpoint during the timeout
period.
In the (example) case of an USB2UART chip, the ERROR_TIMEOUT
would just mean that there were no bytes received on the UART RX line.
Fun fact: LibUsb.bulkTransfer() can receive zero bytes from a USB device, and would not return an error code in this case. USB bulk endpoints actually allow that (and it is different from the "no data at all" case).
QUESTION
Code Snippet
...ANSWER
Answered 2018-May-07 at 15:25The issue seems to be that I did not trigger LibUsb.freeDeviceList(devs, unref_devices); , I figured it out when I disconnected the USB device manually and successfully connected it when it is freshly connected.
QUESTION
I've been trying to:
- detect a live mounted usb stick
- read its files.
Using usb4java, I was able to fulfill part 1. However usb4Java returns devices and I don't see how I could access the device's files.
This is the code that allows the detection (You can find the complete example on: HotPlug example)
...ANSWER
Answered 2017-Jun-26 at 07:56For reading files (part 2),
1 - First read the interface and endpoint details which you are already doing
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install usb4java
You can use usb4java like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the usb4java component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page