• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 328
  • Last Modified:

usb communicatioons

I would like to write a java routine to send and receive from a usb port.  I have been looking at several sites and it appears to more than a trivial task.  I did run into this response to the question on a site and am curious about the statement concerning mounting it and writing to it like a drive.  Anyone have any insite on this approach and maybe a little explanation as to how to do it?

The following is the posting from the other site:

if you are looking to directly build something in low level you can see http://www.beyondlogic.org/ for information about specs...

If you want some examples of code you can look at http://www.libusb.org/wiki/libusb-1.0 ... It's in C though.

If you just want to communicate with the USB in linux, you can just have linux mount it and write to it as a regular drive without having to deal with all the other stuff...
0
sargent240
Asked:
sargent240
  • 5
  • 3
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
USB is a network interface, not just a port.  Most devices require low level drivers.  Generally speaking, I don't believe java is suited to that.  So for most devices, you need to talk to the driver and not the USB 'port'.  If it 'looks' like a disk drive to Linux, you can address it that way.
0
 
sargent240Author Commented:
Your saying it does not look like a disk drive, right?
0
 
sargent240Author Commented:
I'm trying to control a music keyboard with a computer and can do it with the rs232 port.  When I plug in the usb to midi cable "midi1" appears in the dev directory.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
sargent240Author Commented:
Can you tell me what value there is in the "midi1" entry in the /dev directory when I plug in the usb to midi cable if any?
0
 
Dave BaldwinFixer of ProblemsCommented:
I suggest you try to send your data to the 'midi1' device like you would a file.  That would be standard practice in Linux.  Open, read, write.  You should get the same responses as from your RS-232 version I would think.  Just a different interface.
0
 
sargent240Author Commented:
Again Thanks.
0
 
sargent240Author Commented:
I have one other question and I will open a new question if you like, but how is the baud rate controlled if it is handled like a file?
0
 
Dave BaldwinFixer of ProblemsCommented:
Midi only operates at 31.5 kBaud as far as I know.  You don't have to set it for a USB MIDI interface.  This http://www.faqs.org/docs/Linux-HOWTO/MIDI-HOWTO.html seems to be the best Linux MIDI resource I can find at the moment.  Many older links for this subject are dead.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now