blob: 53d2e75610d17c085f0d28c9f7bb4dc1b91ce9bb [file] [log] [blame]
Linus Walleij7beba572006-11-29 08:56:12 +00001This file was created by Farooq Zaman <emotional_keats2h@hotmail.com>
2as a guide to practical Windows porting of libmtp using MSVC (Microsoft
3Visual C++). Some details may have changed, e.g. the things that could be
4fixed in libmtp sources by #ifdef __WIN32__ macros have been folded back
5in. This has been tested on Windows 2000.
6
7
8libmtp.c
9========
10 1. Include <io.h> file.
11 2. Comment out <sys/mman.h> file.
12 3. Line# 2115 replace "open" with "_open" and replace "S_IRWXU|S_IRGRP" with "_S_IREAD".
13 4. Line# 2126 replace "close" with "_close".
14 5. Line# 2283 replace "open" with "_open" and add one more closing ")" at the end of _open API.
15 6. Line# 2294 replace "close" with "_close".
16 7. Line# 2502 and Line# 2513 repeat steps 5 and 6.
17libmtp.h
18========
19 1. replace <usb.h> and <stdint.h> with "usb.h" and "stdint.h" respectively.
20
21libusb-glue.c
22=============
23 1. Comment out <getopt.h>, <unistd.h>, <utime.h> and <sys/mman.h> includes.
24 2. Replace <usb.h> with "usb.h"
25 3. Line# 537 Add usb_set_configuration(device_handle, dev->config->bConfigurationValue); before claiming USB interface.
26
27ptp.c
28======
29 1. Comment out <config.h> and <unistd.h> include macro.
30 2. Include "libmtp.h" file.
31 3. Line# 484 remove "inline" keyword from the function.
32
33ptp.h
34=====
35 1. replace <iconv.h> with "iconv.h".
36
37ptp-pack.c
38==========
39 1. replace <iconv.h> with "iconv.h".
40 2. Include "stdint.h" and "ptp.h" files. Windows C doesn't have "stdint.h" file. I took this file from Cygwin.
41 3. Remove "inline" keyword with all the functions in this file.
42
43gphoto2-endian.h
44================
45 1. replace <arpa/inet.h> with <winsock.h> .
46
47
48stdint.h
49========
50 1. MSVC doesn't have stdint.h file as part of its C. Get this file from someother source(e.g Cygwin in my case). And replace "long long" with "__int64".
51
52byteswap.h
53==========
54 1. MSVC doesn't have this file too. I created this file myself by just copying bswap_16(), bswap_32() and bswap_64() macros from Linux /usr/include/bits/byteswap.h file.
55
56
57
58Libraries
59=========
60 You will need two libraries for windows "libusb" and "libiconv".
61 1. You can download libusb from
62 http://libusb-win32.sourceforge.net/#downloads
63 Download the Device driver version, unpack the archive and get libusb.lib and libusb0.dll files.
64 Place libusb.lib in the libs folder and libusb0.dll file in the debug folder of MSVC project.
65 Also get libusb.h file and add it to your project.
66
67 2. You can Download libiconv-2.dll file from
68 http://sourceforge.net/project/showfiles.php?group_id=114505&package_id=147572&release_id=356820
69 and libiconv.lib file from
70 http://gnuwin32.sourceforge.net/packages/libiconv.htm
71 Download Developer files and get libiconv.lib file.
72 Place libiconv.lib in the libs folder and libicon-2.dll in debug folder of MSVC project.
73 Also get libiconv.h file and add it to your project.
74
75
76 3. Goto Project->settings. In the "link" tab and "General" category, add "libusb.lib" and "libiconv.lib" to
77 "Object/library modules".
78
79 4. Change Category to Input and add your libs folder Path to "Additional Library Path".
80
81libusb filter Driver
82====================
83 You will need libusb driver for libusb to function properly.
84 Get libusb filter driver version from this link
85 http://libusb-win32.sourceforge.net/#downloads
86 Download the filter version and install it.