Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
aleks_grey
Posts: 4
Joined: 09 Mar 2010, 13:43
Contact:

OpenBSD + usb_modeswitch + libusb-0.1.12

Post by aleks_grey » 09 Mar 2010, 13:49

Hello!
Sorry for my english, gentlemans, but i need help.

I have OpenBSD 4.6 system + libusb-0.1.12 + usb-modeswitch-1.1.0 whith a Huawei E1550 device.

When i trying to install usb-modeswitch i got next messages:

========
# cd usb-modeswitch-1.1.0
# make install
gcc -O2 -pipe -Wall -l usb -o usb_modeswitch usb_modeswitch.c
usb_modeswitch.c:66:17: usb.h: No such file or directory
In file included from usb_modeswitch.c:67:
usb_modeswitch.h:30:17: usb.h: No such file or directory
usb_modeswitch.c: In function `main':
usb_modeswitch.c:343: warning: implicit declaration of function `usb_init'
usb_modeswitch.c:346: warning: implicit declaration of function `usb_set_debug'
usb_modeswitch.c:348: warning: implicit declaration of function `usb_find_busses'
usb_modeswitch.c:349: warning: implicit declaration of function `usb_find_devices'
usb_modeswitch.c:397: error: dereferencing pointer to incomplete type
usb_modeswitch.c:398: error: dereferencing pointer to incomplete type
usb_modeswitch.c:400: warning: implicit declaration of function `usb_open'
usb_modeswitch.c:400: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c:407: error: dereferencing pointer to incomplete type
usb_modeswitch.c:409: error: dereferencing pointer to incomplete type
usb_modeswitch.c:411: error: dereferencing pointer to incomplete type
usb_modeswitch.c:561: warning: implicit declaration of function `usb_close'
usb_modeswitch.c: In function `deviceDescription':
usb_modeswitch.c:576: error: dereferencing pointer to incomplete type
usb_modeswitch.c:577: warning: implicit declaration of function `usb_get_string_simple'
usb_modeswitch.c:577: error: dereferencing pointer to incomplete type
usb_modeswitch.c:586: error: dereferencing pointer to incomplete type
usb_modeswitch.c:587: error: dereferencing pointer to incomplete type
usb_modeswitch.c:596: error: dereferencing pointer to incomplete type
usb_modeswitch.c:597: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function `deviceInquire':
usb_modeswitch.c:629: warning: implicit declaration of function `usb_claim_interface'
usb_modeswitch.c:634: warning: implicit declaration of function `usb_clear_halt'
usb_modeswitch.c:636: warning: implicit declaration of function `usb_bulk_write'
usb_modeswitch.c:642: warning: implicit declaration of function `usb_bulk_read'
usb_modeswitch.c:669: warning: implicit declaration of function `usb_release_interface'
usb_modeswitch.c: In function `resetUSB':
usb_modeswitch.c:685: warning: implicit declaration of function `sleep'
usb_modeswitch.c:687: warning: implicit declaration of function `usb_reset'
usb_modeswitch.c: In function `switchConfiguration':
usb_modeswitch.c:753: warning: implicit declaration of function `usb_set_configuration'
usb_modeswitch.c: In function `switchAltSetting':
usb_modeswitch.c:769: warning: implicit declaration of function `usb_set_altinterface'
usb_modeswitch.c: In function `switchHuaweiMode':
usb_modeswitch.c:786: warning: implicit declaration of function `usb_control_msg'
usb_modeswitch.c:786: error: `USB_TYPE_STANDARD' undeclared (first use in this function)
usb_modeswitch.c:786: error: (Each undeclared identifier is reported only once
usb_modeswitch.c:786: error: for each function it appears in.)
usb_modeswitch.c:786: error: `USB_RECIP_DEVICE' undeclared (first use in this function)
usb_modeswitch.c:786: error: `USB_REQ_SET_FEATURE' undeclared (first use in this function)
usb_modeswitch.c: In function `switchSonyMode':
usb_modeswitch.c:872: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c: In function `detachDriver':
usb_modeswitch.c:909: warning: implicit declaration of function `usb_get_driver_np'
usb_modeswitch.c:926: warning: implicit declaration of function `usb_detach_kernel_driver_np'
usb_modeswitch.c: In function `checkSuccess':
usb_modeswitch.c:982: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c:986: error: dereferencing pointer to incomplete type
usb_modeswitch.c:986: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function `search_devices':
usb_modeswitch.c:1093: warning: implicit declaration of function `usb_get_busses'
usb_modeswitch.c:1093: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c:1093: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1095: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1095: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1097: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1097: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1098: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1119: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1126: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1126: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1128: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1138: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1142: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1144: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1146: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1147: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1153: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1153: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function `find_first_bulk_output_endpoint':
usb_modeswitch.c:1176: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1179: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1180: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1181: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1181: error: `USB_ENDPOINT_TYPE_MASK' undeclared (first use in this function)
usb_modeswitch.c:1181: error: `USB_ENDPOINT_TYPE_BULK' undeclared (first use in this function)
usb_modeswitch.c:1182: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1182: error: `USB_ENDPOINT_DIR_MASK' undeclared (first use in this function)
usb_modeswitch.c:1183: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function `find_first_bulk_input_endpoint':
usb_modeswitch.c:1194: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1197: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1198: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1199: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1199: error: `USB_ENDPOINT_TYPE_MASK' undeclared (first use in this function)
usb_modeswitch.c:1199: error: `USB_ENDPOINT_TYPE_BULK' undeclared (first use in this function)
usb_modeswitch.c:1200: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1200: error: `USB_ENDPOINT_DIR_MASK' undeclared (first use in this function)
usb_modeswitch.c:1201: error: dereferencing pointer to incomplete type
*** Error code 1

Stop in /opt/usb-modeswitch-1.1.0 (line 20 of Makefile).
#
======

May be problem with tclsh?
==
# tclsh
ksh: tclsh: not found
# tclsh8.5
% exit
# pkg_info
bzip2-1.0.5 block-sorting file compressor, unencumbered
ee-1.4.6p1 easy to use text editor
gettext-0.17p0 GNU gettext
glib2-2.18.4p3 general-purpose utility library
libiconv-1.13 character set conversion library
libusb-0.1.12 USB access library
mc-4.6.1p1 free Norton Commander clone with many useful features
pcre-7.9 perl-compatible regular expression library
tcl-8.5.7 Tool Command Language
unzip-5.52p0 extract, list & test files in a ZIP archive
wget-1.11.4 retrieve files from the web via HTTP, HTTPS and FTP
zip-3.0 create/update ZIP files compatible with PKZip(tm)
#
===


Very gratefully for any help.

Josh
Site Admin
Posts: 6579
Joined: 03 Nov 2007, 00:30

Post by Josh » 09 Mar 2010, 15:08

You need libusb-devel too.

aleks_grey
Posts: 4
Joined: 09 Mar 2010, 13:43
Contact:

Post by aleks_grey » 09 Mar 2010, 15:20

Josh wrote:You need libusb-devel too.
OK. Can you give me direct link on it 4 OpenBSD, plz?
I failed to find it on
http://sourceforge.net/projects/libusb/files/

=(

Josh
Site Admin
Posts: 6579
Joined: 03 Nov 2007, 00:30

Post by Josh » 09 Mar 2010, 16:55

I know nothing about packaging in OpenBSD. How did you install libusb? From source?

aleks_grey
Posts: 4
Joined: 09 Mar 2010, 13:43
Contact:

Post by aleks_grey » 09 Mar 2010, 17:53

Josh wrote:I know nothing about packaging in OpenBSD. How did you install libusb? From source?
pkg_add <path_to_ftp_with_libusb>.
Official OpenBSD package.

Josh
Site Admin
Posts: 6579
Joined: 03 Nov 2007, 00:30

Post by Josh » 09 Mar 2010, 18:47

OK. Is there no package named "libusb-dev" or "libusb-devel" where you got the "libusb" package from?

On your system, the "usb.h" file is obviously missing which is part of the development package of "libusb".

aleks_grey
Posts: 4
Joined: 09 Mar 2010, 13:43
Contact:

Post by aleks_grey » 09 Mar 2010, 22:20

Josh wrote:OK. Is there no package named "libusb-dev" or "libusb-devel" where you got the "libusb" package from?

On your system, the "usb.h" file is obviously missing which is part of the development package of "libusb".
No, there is no such named package. I installed it from
ftp://ftp.openbsd.org/pub/OpenBSD/4.6/packages/i386/

Hmmm... Thanks for idea, tomorrow i want to google for "usb.h" file...

Partizanen
Posts: 1
Joined: 10 Mar 2010, 04:35

Post by Partizanen » 10 Mar 2010, 04:47

Good day, everybody! Actually, this problem first is mine (aleks_grey and me are tuning my server this time).

usb. h in OpenBSD is located in /usr/include/dev/usb/usb.h so I've changed "include" path and tried to make again. that's the output:

make
gcc -O2 -pipe -Wall -l usb -o usb_modeswitch usb_modeswitch.c
usb_modeswitch.c: In function `main':
usb_modeswitch.c:343: warning: implicit declaration of function `usb_init'
usb_modeswitch.c:346: warning: implicit declaration of function `usb_set_debug'
usb_modeswitch.c:348: warning: implicit declaration of function `usb_find_busses'
usb_modeswitch.c:349: warning: implicit declaration of function `usb_find_devices'
usb_modeswitch.c:397: error: dereferencing pointer to incomplete type
usb_modeswitch.c:398: error: dereferencing pointer to incomplete type
usb_modeswitch.c:400: warning: implicit declaration of function `usb_open'
usb_modeswitch.c:400: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c:407: error: dereferencing pointer to incomplete type
usb_modeswitch.c:409: error: dereferencing pointer to incomplete type
usb_modeswitch.c:411: error: dereferencing pointer to incomplete type
usb_modeswitch.c:561: warning: implicit declaration of function `usb_close'
usb_modeswitch.c: In function `deviceDescription':
usb_modeswitch.c:576: error: dereferencing pointer to incomplete type
usb_modeswitch.c:577: warning: implicit declaration of function `usb_get_string_simple'
usb_modeswitch.c:577: error: dereferencing pointer to incomplete type
usb_modeswitch.c:586: error: dereferencing pointer to incomplete type
usb_modeswitch.c:587: error: dereferencing pointer to incomplete type
usb_modeswitch.c:596: error: dereferencing pointer to incomplete type
usb_modeswitch.c:597: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function `deviceInquire':
usb_modeswitch.c:629: warning: implicit declaration of function `usb_claim_interface'
usb_modeswitch.c:634: warning: implicit declaration of function `usb_clear_halt'
usb_modeswitch.c:636: warning: implicit declaration of function `usb_bulk_write'
usb_modeswitch.c:642: warning: implicit declaration of function `usb_bulk_read'
usb_modeswitch.c:669: warning: implicit declaration of function `usb_release_interface'
usb_modeswitch.c: In function `resetUSB':
usb_modeswitch.c:685: warning: implicit declaration of function `sleep'
usb_modeswitch.c:687: warning: implicit declaration of function `usb_reset'
usb_modeswitch.c: In function `switchConfiguration':
usb_modeswitch.c:753: warning: implicit declaration of function `usb_set_configuration'
usb_modeswitch.c: In function `switchAltSetting':
usb_modeswitch.c:769: warning: implicit declaration of function `usb_set_altinterface'
usb_modeswitch.c: In function `switchHuaweiMode':
usb_modeswitch.c:786: warning: implicit declaration of function `usb_control_msg'
usb_modeswitch.c:786: error: `USB_TYPE_STANDARD' undeclared (first use in this function)
usb_modeswitch.c:786: error: (Each undeclared identifier is reported only once
usb_modeswitch.c:786: error: for each function it appears in.)
usb_modeswitch.c:786: error: `USB_RECIP_DEVICE' undeclared (first use in this function)
usb_modeswitch.c:786: error: `USB_REQ_SET_FEATURE' undeclared (first use in this function)
usb_modeswitch.c: In function `switchSonyMode':
usb_modeswitch.c:872: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c: In function `detachDriver':
usb_modeswitch.c:909: warning: implicit declaration of function `usb_get_driver_np'
usb_modeswitch.c:926: warning: implicit declaration of function `usb_detach_kernel_driver_np'
usb_modeswitch.c: In function `checkSuccess':
usb_modeswitch.c:982: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c:986: error: dereferencing pointer to incomplete type
usb_modeswitch.c:986: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function `search_devices':
usb_modeswitch.c:1093: warning: implicit declaration of function `usb_get_busses'
usb_modeswitch.c:1093: warning: assignment makes pointer from integer without a cast
usb_modeswitch.c:1093: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1095: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1095: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1097: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1097: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1098: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1119: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1126: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1126: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1128: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1138: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1142: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1144: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1146: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1147: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1153: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1153: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function `find_first_bulk_output_endpoint':
usb_modeswitch.c:1176: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1179: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1180: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1181: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1181: error: `USB_ENDPOINT_TYPE_MASK' undeclared (first use in this function)
usb_modeswitch.c:1181: error: `USB_ENDPOINT_TYPE_BULK' undeclared (first use in this function)
usb_modeswitch.c:1182: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1182: error: `USB_ENDPOINT_DIR_MASK' undeclared (first use in this function)
usb_modeswitch.c:1183: error: dereferencing pointer to incomplete type
usb_modeswitch.c: In function `find_first_bulk_input_endpoint':
usb_modeswitch.c:1194: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1197: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1198: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1199: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1199: error: `USB_ENDPOINT_TYPE_MASK' undeclared (first use in this function)
usb_modeswitch.c:1199: error: `USB_ENDPOINT_TYPE_BULK' undeclared (first use in this function)
usb_modeswitch.c:1200: error: dereferencing pointer to incomplete type
usb_modeswitch.c:1200: error: `USB_ENDPOINT_DIR_MASK' undeclared (first use in this function)
usb_modeswitch.c:1201: error: dereferencing pointer to incomplete type
*** Error code 1

Stop in /opt/usb-modeswitch-1.1.0 (line 20 of Makefile).

For now I've noticed another thing. In the Makefile there is a string
UDEVDIR = $(DESTDIR)/lib/udev. There is no such directory also.

Josh
Site Admin
Posts: 6579
Joined: 03 Nov 2007, 00:30

Post by Josh » 10 Mar 2010, 10:24

I had a look at the package aleks_grey pointed to. It contains the library and the include files. "usb.h" is in there.

So you have to look for it on your systems, and if it is not found by the compiler, add the include search path to your CFLAGS. If the path is the on that Partizanen pointed out, the CFLAGS line in the Makefile should read:

Code: Select all

CFLAGS += -Wall -l usb -I /usr/include/dev/usb
But it may be that this is the wrong file. In Linux there is a "usb.h" file for kernel development which is different from the one coming with libusb. Have a look into the file if you are unsure; the right one has a copyright line near the top that says:
"Copyright (c) 2000-2003 Johannes Erdfelt"

Folks, I am afraid you are on your own here. I don't have a BSD system to test and no experience whatsoever with these.
You have to build your own manual setup anyway, because the automatic part of usb_modeswitch relies heavily on the Linux sysfs and usbfs trees, and the udev setup that is found in the major Linux distributions.


Post Reply