1. Open Device from USB Port

Hello,

Is there anyway to open a device from a USB port? I see there are ways to open a device such as a printer or a serial port, but no USB port.

new topic     » topic index » view message » categorize

2. Re: Open Device from USB Port

Lone_EverGreen_Ranger said...

Hello,

Is there anyway to open a device from a USB port? I see there are ways to open a device such as a printer or a serial port, but no USB port.

Hi

Not really. This goes way back to the ancient times of computing, the 8088 / 80826 / 80286 processors, which predominantly used DOS as the os, and were closely linked to the electronics on the motherboard, iirc the uart, serial and parallel chips which could be accessed directly for reading and writing.

Nowadays there's a layer of programming between the i/o ports, the device drivers, though you can still, in some cases access the setial and parallel ports for direct access.

However, the USB ports are highly specialised serial devices, almost exclusively needing specific drivers for specicic devices. There are 'universal' usb drivers, but you need to know how to program them, and as as I am aware, they aren't cheap, mostly used for commercial development.

If you want an usb interface to the outside world, accessible programmatically, then you probably don't nee to look further than arduinos and their ilk, which I am sure with a bit of fiddling could be eu programmable.

Chris

new topic     » goto parent     » topic index » view message » categorize

3. Re: Open Device from USB Port

Lone_EverGreen_Ranger said...

Hello,

Is there anyway to open a device from a USB port? I see there are ways to open a device such as a printer or a serial port, but no USB port.

It's possible, but probably not very easy. I've never tried it, but it sounds like libusb is what you want.

http://sf.net/projects/libusb/

new topic     » goto parent     » topic index » view message » categorize

4. Re: Open Device from USB Port

This is interesting to me. There are sometimes when I would like to handle more than one joy-stick or mouse on the same computer as separately.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Open Device from USB Port

USB devices come in so many different flavors, and they are handled in different ways by the operating system, that the real answer is "it depends". Some USB devices allow themselves to be mapped to a COM: port, so standard serial port functionality can be applied. Those USB devices that have flash storage are often mapped automatically to a drive letter. Those that contain imaging or sound devices will generally be accessible via the standard OS routines for that kind of device.

If you are looking for more hardware level control over the device, your best bet would be libusb, as suggested above. These days, however, hardware level control is often restricted by the operating system, which means having to run the program as a root or admin user. This is usually fine for personal use, but you definitely want to reconsider your methodology for more general use.

new topic     » goto parent     » topic index » view message » categorize

6. Re: Open Device from USB Port

Well that libUSB lib looks useful. The only problem is I'm working under a windows OS.

new topic     » goto parent     » topic index » view message » categorize

7. Re: Open Device from USB Port

Lone_EverGreen_Ranger said...

Well that libUSB lib looks useful. The only problem is I'm working under a windows OS.

It would probably help if you specified what you were actually trying to do.

In the mean time, maybe this will be useful:

http://msdn.microsoft.com/en-us/windows/hardware/gg487341

There also appears to be a windows version of libusb:

http://sourceforge.net/apps/trac/libusb-win32/wiki

Matt

new topic     » goto parent     » topic index » view message » categorize

8. Re: Open Device from USB Port

Lone_EverGreen_Ranger said...

Well that libUSB lib looks useful. The only problem is I'm working under a windows OS.

libusb-win32 works on Windows. Again, I haven't tried it.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Open Device from USB Port

jimcbrown said...
Lone_EverGreen_Ranger said...

Well that libUSB lib looks useful. The only problem is I'm working under a windows OS.

libusb-win32 works on Windows. Again, I haven't tried it.

Alright, thanks for the help guys.

new topic     » goto parent     » topic index » view message » categorize

10. Re: Open Device from USB Port

Lone_EverGreen_Ranger said...
jimcbrown said...
Lone_EverGreen_Ranger said...

Well that libUSB lib looks useful. The only problem is I'm working under a windows OS.

libusb-win32 works on Windows. Again, I haven't tried it.

Alright, thanks for the help guys.

If you are consediring controlling motors, switches , sensors, etc from windows, the simplest way I knows in these days of USB ruling is phidgets interfaces kits Phidgets are great because they support windows, linux, OSX and many programming languages, C#,C/CPP,java, etc. All the supporting libraries are free. An if you want to program it with euphoria, the simplest way it to wrap the C library API.

I presently work on a project using a phidget servo-motor controller and a picaxe 08M2 PIC controller. I work under linux mint, and program in C. Phidgets use standard USB A/B cable and the picaxe use a USB/RS-232 converter.

I don't know libusb but I will check it.

Jacques

new topic     » goto parent     » topic index » view message » categorize

11. Re: Open Device from USB Port

Did anybody ever wrap the libusb API?

I am looking for an easy way of generating a cross platform app to read data from a USB device.

I've rediscovered Euphoria after my involvement some 15 years ago (!) in 1997.

Any help appreciated.

Thanks,
Matt

new topic     » goto parent     » topic index » view message » categorize

12. Re: Open Device from USB Port

matt said...

Did anybody ever wrap the libusb API?

I am looking for an easy way of generating a cross platform app to read data from a USB device.

I've rediscovered Euphoria after my involvement some 15 years ago (!) in 1997.

Any help appreciated.

Thanks,
Matt

Maybe you don't have to give you all that trouble. Many USB dongle emulate standard USB device like serial port or mouse, keyboard,mass storage, etc and the system (linux or windows) use standard drivers for them. For exemple I have a USB GPS dongle that in fact present itself has a serial port to the OS. I programmed it using euphoria on linux and windows by simply using serial port library. Check if your system enumerate a new known device when you plug your USB device. If it is the case you won't need any special driver to use it.

Jacques

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu