The way to install Windows games on Ubuntu is to install WineHQ. WineHQ is a program built for Ubuntu to handle.EXE files instead of.JAR.
IMPORTANT: NEC/Renesas uPD720200/uPD720200A USB 3.0 users, please upgrade your drivers to version 2.1.16.0 or later.uPD720201/uPD720202 users should use version 3.x (3.0.23 or later preferred). Older versions of the driver have a bug that prevents libusb from accessing devices.
|
Overview
About
This project adds Windows platform support to the libusb Open Source library, in order to help developers easily communicate with USB devices on Windows.Currently it supports the WinUSB and HID drivers for generic USB device access as well as the libusb-win32 and libusbK drivers.
Take note libusb-win32 and libusbK are separated projects. libusb-win32 is a Windows only project which provide libusb-0.1 API compatible library for Windows and the kernel driver libusb0.sys. libusbK is a Windows only project which provides a new set of API for Windows and kernel driver libusbK.sys.
Binary Snapshots
Pre-built binary snapshots are provided in the Sourceforge files directory along with the source code archive. For later versions like 1.0.21 release, they are also in github release page
The pre-built Windows binaries are provided AS IS for your convenience, generated for the following environments:
- Microsoft Visual Studio and DDK/WDK → MS32(32 bit) and MS64 (64 bit) directories
- MinGW -> MinGW32 (32 bit) and MinGW64 (64 bit) directories
7z
format so you may have to install 7-zip.Supported Environments
Supported systems are all Windows platforms, starting with Windows XP, and including 64 bit versions, with the following exceptions:
- Windows 2003 (Microsoft does not support WinUSB on 32bit/64bit Windows 2003)
- Windows XP 64 bit (Microsoft does not officially support WinUSB on 64bit Windows XP)
USB 3.0 Support
libusb supports USB 3.0 controllers and devices on Windows. Proprietary vendor controller drivers for Windows 7 and earlier as well as the Microsoft controller xHCI driver for Windows 8 are supported. If you are not using Windows 8 or later, you will be using vendor driver. Make sure you upgrade to the latest version of the driver if you encounter problems.
If you are using a NEC/Renesas USB 3.0 controller, such as the fairly widespread uPD720200
/uPD720200A
, remember to make sure that your controller drivers are version 2.1.16.0 or later. Older versions of the drivers are known to have a bug that prevents access to USB devices.
Windows 8.x/10 Support
libusb was tested under Windows 8 and Windows 8.1, for both 32 and 64 bit, and no issues were found.
.NET support
A .NET
version of libusb, called LibUsbDotNet, based on libusb 1.0, has been developed by Travis Lee Robinson. If you plan to use libusb in a .NET
project, make sure you check http://libusbdotnet.sourceforge.net or http://sourceforge.net/projects/libusbdotnet/, but be aware that LibUsbDotNet's most recent version is v2.2.8, which was released on 2010-10-29.
Travis Lee Robinson also created the libusbK project, which has C# wrappers for its 'libusbK.dll'. The latest (v3.0.7, 2014-04-27) binaries, source code and wrapper classes can be downloaded from its SourceForge directory.
How to use libusb on Windows
Driver Installation
If your target device is not HID, you must install a driver before you can communicate with it using libusb. Currently, this means installing one of Microsoft's WinUSB
, libusb-win32 or libusbK drivers. Two options are available:
- Recommended: Use the most recent version of Zadig, an Automated Driver Installer GUI application for
WinUSB
,libusb-win32
andlibusbK
... - Alternatively, if you are only interested in
WinUSB
, you can download the WinUSB driver files and customize theinf
file for your device. - For version 1.0.21 or later, you can also use usbdk backend. usbdk provides another driver option for libusb Windows backend. For 1.0.21, usbdk is a compile-time option, but it becomes a runtime option from version 1.0.22 onwards, so you need to specify the usbdk backend using something like the following.
Development Considerations
The handling of composite devices under Windows is done with multiple drivers, that are children of the usbccgp.sys
driver (Composite Generic Parent), as this is the default for the OS. For more info, see '2. How Windows handles a composite device' at http://forum.silabs.com/ubbthreads.php?ubb=showflat&Number=39797. If needed, it is also possible to replace the composite parent driver to access the device.
Because Windows does not provide a native poll()
function, and cygwin is the only development environment that provides such a call, the use of libusb file descriptors with poll()
on cygwin is NOT supported. In a future version of libusb, we should provide better handling of native Windows events, but this will require a redesign of the libusb API, so it probably won't occur before libusb 2.0.
Known Restrictions
WinUSB
cannot be used to send an actual reset command to an USB device. This is a limitation of WinUSB.WinUSB
andlibusbK
cannot be used to set a device configuration that is different from the first one. This is a limitation of KMDF USB I/O Target.WinUSB
does not support multiple concurrent applications (as per the MSDN documentation).WinUSB
does not support isochronous transfers under Windows XP/Vista/7/8. WinUSB under Windows 8.1 or later supports isochronous transfer. Take note as of now libusb Windows only supports isochronous transfer using the usbdk backend (version 1.0.21 and later). libusb-1.0.22 adds isochronous support using libsubK driver. Future version will add isochronous transfer for WinUSB (Windows 8.1/10 or later).- With
WinUSB
, whenLIBUSB_RECIPIENT_INTERFACE
is used for the transfer, theWinUSB
DLL forces the low byte ofwIndex
to the interface number, regardless of what you set it to.- This is not a real limitation though, please refer to the OSR threads. From Tim Roberts answer in that thread:
- One can also argue that this is a security measure. The USB spec requires that the low byte of wIndex be set to the interface number when the recipient is set to 'interface'. Devices that use that field for other purposes are broken.
- HID keyboards and mice cannot be accessed using the native HID driver as Windows reserves exclusive access to them.
- Multiple HID top level collections are currently not supported (only the first top level collection will be used).
- The HID Report Descriptors provided by libusb are recomposed and may present minor differences from the actual ones, as the Windows HID API does not allow to read them directly from the device.
- Because there is no native
poll()
on Windows, the ability to return externally pollable file descriptors on Windowslibusb_get_pollfd()
returns an error. - If you use a composite device, and plan to install a libusb compatible driver for any of the interfaces, you should ensure that your driver package adds a Device Interface GUID in the registry, as proper enumeration of composite devices in libusb depends on it. This is typically achieved by adding something like the following in your inf:
HKR,DeviceInterfaceGUIDs,0x00010000,{12345678-1234-1234-1234-123456789ABC}
This is in particular a problem with libusb-win32's inf-wizard which will be deprecated by libusb-win32 project. Please use Zadig instead. libusb0.sys and libusbk.sys
access is done through the libusbK DLL, therefore, if you plan to use the libusb-win32/libusb0.sys or libusbK/libusbk.sys driver in libusb, you must have that library installed. If using a recent version of Zadig, you should not have to do anything, at it will install the library for you. However the support of libusb0.sys is not ready, therefore you should not use libusb-win32/libusb0.sys for now.
Development Links
- How to Use WinUSB to Communicate with a USB Device & WinUSB (Winusb.sys) Installation.
Note that the inf file given in the howto has a typo. If you don't changeSourceDisksFiles.NTamd64
toSourceDisksFiles.amd64
, the driver installation will fail to copy the required DLLs on 64 bit systems... - Microsoft's USB Core Team Blog (including resources on instrumenting the USB stack in Windows 7)
- additionalinformation about Windows Co-Installers
Modern android 3.0 3.1 and 4.0, 4.1 and 4.2 tablets and smartphones don't use the USB mass storage protocol anymore. They're using the GVFS protocol so they don't need to unmount the SD-card internaly.
Fot that it is a problem getting it hooked up to my Ubuntu machine.
This is because Google has moved away from the USB mass storage protocol, which was used up till Android 2.3, to the MTP (Media Transfer Protocol). As such, any phone or tablet with Android 3.0 and above will use the MTP protocol – something which doesn’t work too well with Ubuntu out of the box.
Upgrade Gvfs in Ubuntu 12.10 and 12.04 to get Android 4.0 support for devices which don't support USB Mass Storage interface
1.To add the Gvfs (and libmtp) PPA created by the Gvfs MTP backend developer in Ubuntu 12.04 or 12.10, use the following commands:
2. Then, launch Software Updater (previously known as Update Manager) and install the available updates.
Revert the changes (purge the PPA)
Then, purge the PPA using the following command:
Old methods for the case this solution doesn't work:
It takes some tweaking to connect a MTP protocol using phone, but it works.
Read the long story here, or read on for the short solution.
There are 2 ways of connecting ubuntu using the MTP protocol.
The first one is relatively easy, but doesn't use the normal file browsers
gMTP
Ubuntu doesn’t come pre-installed with support for MTP, that’s why you can’t get your computer to see the phone after you have plugged it into the USB port.
gMTP is a simple MP3 and Media player client for MTP-based device. It provides a GUI for you to mount your Galaxy Nexus and transfer files in/out of it. We will need to compile some code in the process. Follow the steps below and you will be fine.
1. Open a terminal. Install libusb-dev
2. We are going to need a copy of the libmtp file. The version in the Ubuntu repo is outdated, so we need to download the latest version of libmtp here. (For your info, I am using libmtp-1.1.2.tar.gz).
3. Extract the libmtp file to your Home folder. Back to the terminal:
This will compile and install the libmtp file.
4. Lastly, install gMTP
Now, plug in your Galaxy Nexus and open gMTP. Press the Connect button. If successful, you should see the SD card folder of your Galaxy Nexus. You can now transfer files using the Add/Download button.
Note:
1. Even if it is connected in gMTP, your device won’t appear in the File Manager nautilus. You can manage your files transfer only in the gMTP GUI.
2. When attempting to download files from your phone, it will return an error saying the file is not found. This is because the default Download path has been to set to “/” (root) and you have no permission to write to the root folder. To change this, simply open the Preferences and change the Download path to “/home/username” or any other path that you desire.
The second method is more complex to install:
Connecting your Ice Cream Sandwich phone or tablet to Ubuntu for file accessBefore you begin, try plugging your phone in and see if it works straight away. At the time of writing, the only official Android Ice Cream Sandwich phone is the Galaxy Nexus, and mine doesn’t work. But future ICS phones might work, depending on whether they have an SD card slot or not, and whether they support exporting the card as USB mass storage. If it works, you should be good to go.
First up, install the necessary tools:
sudo apt-get install mtp-tools mtpfs
Now, connect your Galaxy Nexus to your computer. On your phone, open up the notification drawer, and click on “USB Connection type”. Make sure that MTP is selected.
Then, run these commands:
Ubuntu Libusb Install
mtp-detect | grep idVendor
mtp-detect | grep idProduct
Libusb Compat
You shall get an output with two ID's.
Note down the numbers written in front of idVenfor and idProduct, you’ll need those later on.
Now, run this commands:
gksu gedit /etc/udev/rules.d/51-android.rules
A gedit window should open up. Type this text in it, all in a single line:
SUBSYSTEM'usb', ATTR{idVendor}'VENDORID', ATTR{idProduct}'PRODUCTID', MODE='0666'
Replace VENDORID with the idVendor you had noted down earlier. Similarly, replace PRODUCTID with the idProduct you had noted down. In my case, they were 04e8 and 685c respectively on my GalaxyNexus and 18d1 and 4e41 on my Nexus 7, but they might have been different for you.
Also, remember to re-type the quotes in the line after you’ve copied and pasted it, otherwise udev may output an error.
Save and close the file. Then, disconnect your phone and run these commands:
sudo service udev restart
sudo mkdir /media/Nexus7
sudo chmod a+rwx /media/Nexus7
sudo adduser YOURUSERNAME fuse
Replace YOURUSERNAME with your Ubuntu user name. Now, run this command:
gksu gedit /etc/fuse.conf
In the Gedit window, remove the # at the beginning of the last line (the one that begins with “#user_allow_other”) like this:
You’re almost done! Now, restart your computer, and then run these three commands :
echo 'alias android-connect='mtpfs -o allow_other /media/Nexus7' >> ~/.bashrc
echo 'alias android-disconnect='fusermount -u /media/Nexus7' >> ~/.bashrc
source ~/.bashrc
Again, do re-type the quotes in each command after you’ve copied, otherwise the command won’t work.
Connect your phone again, and then make sure your phone is using MTP, then run this command:
android-connect
Voila! You can now browse your Android phone contents using Nautilus.
To safely remove the phone, just run the command:
android-disconnect
The connection is not a fast one. On my Nexus 7 I only get a data rate of abou 150 kb/s.