Permalink
Browse files

Add comment about pkg-config.

  • Loading branch information...
hanwen committed Feb 17, 2013
1 parent 6588350 commit fc6b2b42bbece15febc3d6faf7e6cf33c9399d83
Showing with 34 additions and 17 deletions.
  1. +8 −1 README
  2. +26 −16 usb/usb.go
View
9 README
@@ -23,7 +23,7 @@ COMPILATION
* Install libmtp header files
sudo apt-get install libusb1-devel
-
+
* Then run
mkdir /tmp/go
@@ -32,6 +32,13 @@ COMPILATION
/tmp/go/bin/go-mtpfs will then contain the program binary.
+* You may need some tweaking to get libusb to compile. See the
+ comment near the top of usb/usb.go, ie.
+
+ # edit to suit libusb installation:
+ vi /tmp/go/src/github.com/hanwen/go-mtpfs/usb/usb.go
+ go install github.com/hanwen/go-mtpfs
+
* A 32 and 64-bit linux x86 binaries are at
http://hanwen.home.xs4all.nl/public/software/go-mtpfs/
View
@@ -4,6 +4,17 @@
package usb
+/* the following flags may need adjusting for your system. Use
+pkg-config to find out the right values.
+
+$ pkg-config --cflags libusb-1.0
+-I/usr/include/libusb-1.0
+
+$ pkg-config --libs libusb-1.0
+-L/lib64 -lusb-1.0
+
+*/
+
// #cgo LDFLAGS: -L/lib64 -lusb-1.0
// #cgo CFLAGS: -I/usr/include/libusb-1.0
// #include <libusb.h>
@@ -22,10 +33,10 @@ const SPEED_SUPER = C.LIBUSB_SPEED_SUPER
var SPEED_names = map[byte]string{
byte(C.LIBUSB_SPEED_UNKNOWN): "UNKNOWN",
- byte(C.LIBUSB_SPEED_LOW): "LOW",
- byte(C.LIBUSB_SPEED_FULL): "FULL",
- byte(C.LIBUSB_SPEED_HIGH): "HIGH",
- byte(C.LIBUSB_SPEED_SUPER): "SUPER",
+ byte(C.LIBUSB_SPEED_LOW): "LOW",
+ byte(C.LIBUSB_SPEED_FULL): "FULL",
+ byte(C.LIBUSB_SPEED_HIGH): "HIGH",
+ byte(C.LIBUSB_SPEED_SUPER): "SUPER",
}
type ControlSetup C.struct_libusb_control_setup
@@ -53,16 +64,16 @@ const CLASS_VENDOR_SPEC = 0xff
// Device and/or interface class codes.
var CLASS_names = map[byte]string{
- 0: "PER_INTERFACE",
- 1: "AUDIO",
- 2: "COMM",
- 3: "HID",
- 5: "PHYSICAL",
- 7: "PRINTER",
- 6: "IMAGE",
- 8: "MASS_STORAGE",
- 9: "HUB",
- 10: "DATA",
+ 0: "PER_INTERFACE",
+ 1: "AUDIO",
+ 2: "COMM",
+ 3: "HID",
+ 5: "PHYSICAL",
+ 7: "PRINTER",
+ 6: "IMAGE",
+ 8: "MASS_STORAGE",
+ 9: "HUB",
+ 10: "DATA",
0x0b: "SMART_CARD",
0x0d: "CONTENT_SECURITY",
0x0e: "VIDEO",
@@ -115,7 +126,6 @@ const REQUEST_SET_INTERFACE = 0x0B
// Set then report an endpoint's synchronization frame
const REQUEST_SYNCH_FRAME = 0x0C
-
// The error codes returned by libusb.
type Error int
@@ -595,7 +605,7 @@ func (d *Device) GetConfigDescriptorByValue(value byte) (*ConfigDescriptor, erro
func (h *DeviceHandle) GetConfiguration() (byte, error) {
var r C.int
err := C.libusb_get_configuration(h.me(), &r)
- return byte(r), toErr(err)
+ return byte(r), toErr(err)
}
// Set the active configuration for a device. The argument should be

0 comments on commit fc6b2b4

Please sign in to comment.