1. Open Device from USB Port
- Posted by Lone_EverGreen_Ranger Dec 04, 2011
- 2211 views
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.
2. Re: Open Device from USB Port
- Posted by ChrisB (moderator) Dec 05, 2011
- 2109 views
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
3. Re: Open Device from USB Port
- Posted by jimcbrown (admin) Dec 05, 2011
- 2156 views
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.
4. Re: Open Device from USB Port
- Posted by SDPringle Dec 05, 2011
- 2125 views
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.
5. Re: Open Device from USB Port
- Posted by m_sabal Dec 05, 2011
- 2130 views
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.
6. Re: Open Device from USB Port
- Posted by Lone_EverGreen_Ranger Dec 05, 2011
- 2091 views
Well that libUSB lib looks useful. The only problem is I'm working under a windows OS.
7. Re: Open Device from USB Port
- Posted by mattlewis (admin) Dec 05, 2011
- 2096 views
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
8. Re: Open Device from USB Port
- Posted by jimcbrown (admin) Dec 05, 2011
- 2060 views
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.
9. Re: Open Device from USB Port
- Posted by Lone_EverGreen_Ranger Dec 05, 2011
- 2059 views
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.
10. Re: Open Device from USB Port
- Posted by coconut Dec 05, 2011
- 2119 views
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
11. Re: Open Device from USB Port
- Posted by matt Sep 27, 2012
- 1549 views
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
12. Re: Open Device from USB Port
- Posted by coconut Sep 27, 2012
- 1557 views
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