The C Source, Patches and (shudder!) Bugs
Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by Josh » 13 Jul 2015, 23:06

O.K. - I didn't do anything to the basic Raspbian install except adding packages "libusb-1.0-0-dev" and "tcl".
Then "make" and "make install" for program and data package (after cutting off that 'libusb_strerror' call).
Just tested with a Huawei E3131 - no problem, works right away.

As to the versions, the file
/usr/lib/arm-linux-gnueabihf/pkgconfig/libusb-1.0.pc
says that libusb1 has version 1.0.11

/etc/issue
says that I'm running "Raspbian GNU/Linux 7"

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

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by Josh » 13 Jul 2015, 23:27

Side note:

A post from Greg Kroah-Hartman, Linux maintainer for USB, referring to USB on the Pi:
http://lists.infradead.org/pipermail/li ... 00214.html

JasonH
Posts: 21
Joined: 05 Jul 2015, 13:54

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by JasonH » 13 Jul 2015, 23:58

Ok. Thanks I will try with those and see if I get better results! Thanks for the info!! :) I'll post back with my results...

Also thanks for the note on the pi USB problem vs e.g. the beaglebones

Thanks!
Jason

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by LOM » 14 Jul 2015, 05:56

Josh wrote:O.K. - I didn't do anything to the basic Raspbian install except adding packages "libusb-1.0-0-dev" and "tcl".
Then "make" and "make install" for program and data package (after cutting off that 'libusb_strerror' call).
Just tested with a Huawei E3131 - no problem, works right away.

As to the versions, the file
/usr/lib/arm-linux-gnueabihf/pkgconfig/libusb-1.0.pc
says that libusb1 has version 1.0.11

/etc/issue
says that I'm running "Raspbian GNU/Linux 7"
There seems to be somewhat less problems on the Pi if the dongle gets switched early
before the usb controller gets clogged with communication to all other devices on the usb bus.
But, this problem will persist until the Raspbian developers gives up on using the dwc_otg
driver (which is nowadays kicked out of mainline linux and substituted with the better dwc2 driver).
Raspbian GNU/Linux 7 (Wheezy) is kernel 3.2 which hasn't got the dwc2 driver,
Raspbian 8 (Jessie) is kernel 3.18 but I'm almost sure that the developers has brought back the old crappy usb driver dwc_otg into it.

Try Arch linux or one of the other Raspberry distros instead..

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by LOM » 14 Jul 2015, 06:12

Josh wrote:
JasonH wrote:It is pretty tricky finding stable / compatible versions.
Hmm - I never ever had any problems in that regard, not even on Android (ARM & x86) tablets; however the USB part of the Raspi (earlier versions) is notorious for being less than stable overall.
Pi2 has the same Designware (now owned by Synopsys) USB controller but may have a later better hardware revision of it.
Difference between old and new Pi is otherwise dual core cpu, higher clkfrequency, which
may affect the mode switching in a positive direction.
I suspect that the mass of interrupts generated by the USB<->Ethernet adapter in the Pi
is one of many reasons for USB problems like mode switching, it can in Pi2 be handled by a
dedicated core.

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

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by Josh » 14 Jul 2015, 22:58

Note that I had to issue a bugfix release due to a more serious problem, so I incorporated the fix for the missing 'libusb_strerror' function as well.

See version 2.2.4.

JasonH
Posts: 21
Joined: 05 Jul 2015, 13:54

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by JasonH » 20 Jul 2015, 09:51

Well getting back to this I had some time this weekend...

I tried a couple of different things. One big thing was upgrading the raspberry pi's firmware from 3.18.16 (last stable on the 3 branch) to 4.0.8. This allowed me to use a USB hub under the included version of usb_modeswitch 1.2.3+repack. So there was progress there.

I tried the combination of libusb-1.0-0-dev + usb-modeswitch-2.2.5.tar.bz2 + usb-modeswitch-data-20150627.tar.bz2 and I get something that looks like it has "installed". But it doesn't connect first time like the 1.2.3+repack is doing. In fact I can't get it to connect. I have EnableLogging=1.

It is a E1750 which now seems to be working without incident on usb_modeswitch 1.2.3+repack

Maybe it is the modem? Maybe it is the libusb version? I really don't know... Maybe it is some of the other installed applications I install: fbi, raspberrypi-ui-mods, python-pip, unclutter, chromium-browser, iceweasel, scrot, x11-xserver-utils, xdotool, wmctrl, bootlogd, autossh, ppp, wvdial, iptraf, iftop?

I am really not sure what to try next to be able to get a version which works from source? Here is the modeswitch log file

Code: Select all

[pi@pi004:/var/log] $ more usb_modeswitch_1-1.4\:1.0 

USB_ModeSwitch log from Mon Jul 20 19:13:30 NZST 2015

Use global config file: /etc/usb_modeswitch.conf
Raw args from udev: 1-1.4/1-1.4:1.0

Use top device dir /sys/bus/usb/devices/1-1.4

----------------
USB values from sysfs:
  manufacturer	HUAWEI Technology
  product	HUAWEI Mobile
  serial	
----------------
bNumConfigurations is 1 - don't check for active configuration
ConfigList: /usr/share/usb_modeswitch/12d1:1446 /usr/share/usb_modeswitch/12d1:#linux
SCSI attributes not needed, move on
Check config: /usr/share/usb_modeswitch/12d1:1446
! matched. Read config data
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1

Unbinding driver
Command to be run:
usb_modeswitch -W -D -u -1 -b 1 -g 7 -v 12d1 -p 1446 -f $flags(config)

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are to be expected in the process)
--------------------------------

Read long config from command line

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.2.5 (C) Josua Dietze 2015
 * Based on libusb1/libusbx

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x1446
TargetVendor=   0x12d1
TargetProductList="1001,1404,1406,140b,140c,1412,1417,141b,1429,1432,1433,1436,14ac,1506,150c,1511"
HuaweiNewMode=1
NeedResponse=0
System integration mode enabled

Use given bus/device number: 001/007 ...
Look for default devices ...
 bus/device number matched
  found USB ID 12d1:1446
   vendor ID matched
   product ID matched
 Found devices in default mode (1)
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: HUAWEI Technology
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
Using standard Huawei switching message
Looking for active driver ...
 No active driver found. Detached before or never attached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Reset response endpoint 0x81
Reset message endpoint 0x01
ok:busdev
--------------------------------
(end of usb_modeswitch output)

Check success of mode switch for max. 20 seconds ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...

Target config not matching - current values are
    1-1.4:1.0/bInterfaceClass: 08
    bConfigurationValue:       1
    bNumConfigurations:        1
    busnum:                    1
    devnum:                    7
    idProduct:                 1446
    idVendor:                  12d1
    manufacturer:              HUAWEI Technology
    product:                   HUAWEI Mobile
    serial:                    

Mode switching may have failed. Exit

JasonH
Posts: 21
Joined: 05 Jul 2015, 13:54

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by JasonH » 20 Jul 2015, 09:51

Well getting back to this I had some time this weekend...

I tried a couple of different things. One big thing was upgrading the raspberry pi's firmware from 3.18.16 (last stable on the 3 branch) to 4.0.8. This allowed me to use a USB hub under the included version of usb_modeswitch 1.2.3+repack. So there was progress there.

I tried the combination of libusb-1.0-0-dev + usb-modeswitch-2.2.5.tar.bz2 + usb-modeswitch-data-20150627.tar.bz2 and I get something that looks like it has "installed". But it doesn't connect first time like the 1.2.3+repack is doing. In fact I can't get it to connect. I have EnableLogging=1.

It is a E1750 which now seems to be working without incident on usb_modeswitch 1.2.3+repack

Maybe it is the modem? Maybe it is the libusb version? I really don't know... Maybe it is some of the other installed applications I install: fbi, raspberrypi-ui-mods, python-pip, unclutter, chromium-browser, iceweasel, scrot, x11-xserver-utils, xdotool, wmctrl, bootlogd, autossh, ppp, wvdial, iptraf, iftop?

I am really not sure what to try next to be able to get a version which works from source? Here is the modeswitch log file

Code: Select all

[pi@pi004:/var/log] $ more usb_modeswitch_1-1.4\:1.0 

USB_ModeSwitch log from Mon Jul 20 19:13:30 NZST 2015

Use global config file: /etc/usb_modeswitch.conf
Raw args from udev: 1-1.4/1-1.4:1.0

Use top device dir /sys/bus/usb/devices/1-1.4

----------------
USB values from sysfs:
  manufacturer	HUAWEI Technology
  product	HUAWEI Mobile
  serial	
----------------
bNumConfigurations is 1 - don't check for active configuration
ConfigList: /usr/share/usb_modeswitch/12d1:1446 /usr/share/usb_modeswitch/12d1:#linux
SCSI attributes not needed, move on
Check config: /usr/share/usb_modeswitch/12d1:1446
! matched. Read config data
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1

Unbinding driver
Command to be run:
usb_modeswitch -W -D -u -1 -b 1 -g 7 -v 12d1 -p 1446 -f $flags(config)

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are to be expected in the process)
--------------------------------

Read long config from command line

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.2.5 (C) Josua Dietze 2015
 * Based on libusb1/libusbx

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x1446
TargetVendor=   0x12d1
TargetProductList="1001,1404,1406,140b,140c,1412,1417,141b,1429,1432,1433,1436,14ac,1506,150c,1511"
HuaweiNewMode=1
NeedResponse=0
System integration mode enabled

Use given bus/device number: 001/007 ...
Look for default devices ...
 bus/device number matched
  found USB ID 12d1:1446
   vendor ID matched
   product ID matched
 Found devices in default mode (1)
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: HUAWEI Technology
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
Using standard Huawei switching message
Looking for active driver ...
 No active driver found. Detached before or never attached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Reset response endpoint 0x81
Reset message endpoint 0x01
ok:busdev
--------------------------------
(end of usb_modeswitch output)

Check success of mode switch for max. 20 seconds ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...
 Read attributes ...

Target config not matching - current values are
    1-1.4:1.0/bInterfaceClass: 08
    bConfigurationValue:       1
    bNumConfigurations:        1
    busnum:                    1
    devnum:                    7
    idProduct:                 1446
    idVendor:                  12d1
    manufacturer:              HUAWEI Technology
    product:                   HUAWEI Mobile
    serial:                    

Mode switching may have failed. Exit

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by LOM » 20 Jul 2015, 20:18

This is the Raspberry Pi usb controller problem which we have seen so many times before, usb_modeswitch showing switch message being received by the usb subsystem for delivery to the dongle but either it doesn't get delivered or the usb subsys does not notice the device change when the dongle switches.
Look in your system log (dmesg) which driver the usb host controller uses, I bet it is still dwc_otg.

JasonH
Posts: 21
Joined: 05 Jul 2015, 13:54

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by JasonH » 20 Jul 2015, 20:38

Yes the controller is dwc_otg from
dmesg | grep usb
The full output is below, butttt this is working on the exact same set up with usb_modeswtich 1.2.3+repack that is shipped with latest raspberrian. Is there any way to get those changes (the repack bits) or something and include them in the latest version of usb_modeswitch? Should I not be bothering? Is there another forum where I should be asking this? Is there anything else I can do to get a later version of modeswtich which I had presumed to be more stable, with bug fixes etc? Or really should i just stick to the version of the usb_modeswitch 1.2.3+repack

Thanks for any insights!

Code: Select all

[pi@pi004:~] $ dmesg | grep usb
[    0.289973] usbcore: registered new interface driver usbfs
[    0.290078] usbcore: registered new interface driver hub
[    0.290231] usbcore: registered new device driver usb
[    0.453235] usbcore: registered new interface driver smsc95xx
[    0.854833] dwc_otg 3f980000.usb: DWC OTG Controller
[    0.854884] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[    0.854931] dwc_otg 3f980000.usb: irq 32, io mem 0x00000000
[    0.855300] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    0.855321] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.855337] usb usb1: Product: DWC OTG Controller
[    0.855353] usb usb1: Manufacturer: Linux 4.0.8-v7+ dwc_otg_hcd
[    0.855369] usb usb1: SerialNumber: 3f980000.usb
[    0.857295] usbcore: registered new interface driver usb-storage
[    0.894812] usbcore: registered new interface driver usbhid
[    0.894826] usbhid: USB HID core driver
[    1.232369] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    1.432834] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    1.432871] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.712412] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    1.812646] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    1.812669] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    1.876424] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:9d:3c:2c
[    1.952409] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[    2.060143] usb 1-1.2: New USB device found, idVendor=046d, idProduct=c52b
[    2.060165] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.060181] usb 1-1.2: Product: USB Receiver
[    2.060197] usb 1-1.2: Manufacturer: Logitech
[    2.070065] input: Logitech USB Receiver as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/0003:046D:C52B.0001/input/input0
[    2.122628] hid-generic 0003:046D:C52B.0001: input,hidraw0: USB HID v1.11 Keyboard [Logitech USB Receiver] on usb-3f980000.usb-1.2/input0
[    2.131373] input: Logitech USB Receiver as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.1/0003:046D:C52B.0002/input/input1
[    2.183055] hid-generic 0003:046D:C52B.0002: input,hiddev0,hidraw1: USB HID v1.11 Mouse [Logitech USB Receiver] on usb-3f980000usb-1.2/input1
[    2.191350] hid-generic 0003:046D:C52B.0003: hiddev0,hidraw2: USB HID v1.11 Device [Logitech USB Receiver] on usb-3f980000.usb-1.2/input2
[    2.422405] usb 1-1.3: new high-speed USB device number 5 using dwc_otg
[    2.531004] usb 1-1.3: New USB device found, idVendor=05ac, idProduct=1006
[    2.531026] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    2.531043] usb 1-1.3: Product: Keyboard Hub
[    2.531059] usb 1-1.3: Manufacturer: Apple, Inc.
[    2.531074] usb 1-1.3: SerialNumber: 000000000000
[    2.812399] usb 1-1.3.2: new low-speed USB device number 6 using dwc_otg
[    2.936885] usb 1-1.3.2: New USB device found, idVendor=05ac, idProduct=0220
[    2.936906] usb 1-1.3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.936923] usb 1-1.3.2: Product: Apple Keyboard
[    2.936938] usb 1-1.3.2: Manufacturer: Apple, Inc
[    5.452387] usb 1-1.4: new high-speed USB device number 7 using dwc_otg
[    5.554478] usb 1-1.4: New USB device found, idVendor=12d1, idProduct=1446
[    5.554501] usb 1-1.4: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[    5.554517] usb 1-1.4: Product: HUAWEI Mobile
[    5.554532] usb 1-1.4: Manufacturer: HUAWEI Technology
[    5.557065] usb-storage 1-1.4:1.0: USB Mass Storage device detected
[    5.557553] scsi host0: usb-storage 1-1.4:1.0
[    5.558443] usb-storage 1-1.4:1.1: USB Mass Storage device detected
[    5.558987] scsi host1: usb-storage 1-1.4:1.1
[   10.805684] input: Apple, Inc Apple Keyboard as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3.2/1-1.3.2:1.0/0003:05AC:0220.0004/input/input2
[   10.862931] apple 0003:05AC:0220.0004: input,hidraw3: USB HID v1.11 Keyboard [Apple, Inc Apple Keyboard] on usb-3f980000.usb-1.3.2/input0
[   10.869828] input: Apple, Inc Apple Keyboard as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3.2/1-1.3.2:1.1/0003:05AC:0220.0005/input/input3
[   10.923202] apple 0003:05AC:0220.0005: input,hidraw4: USB HID v1.11 Device [Apple, Inc Apple Keyboard] on usb-3f980000.usb-1.3.2/input1

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by LOM » 21 Jul 2015, 04:14

dwc_otg_hcd - there's no such driver in mainline linux kernel. We cannot support you.
You need to ask help from the Raspbian maintainers or use a different distro, there are many to choose from that uses the dwc2 (USB 2.0) driver.

JasonH
Posts: 21
Joined: 05 Jul 2015, 13:54

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by JasonH » 21 Jul 2015, 19:24

If the later versions of usb_modeswitch don't work with the latest raspberian that at least explains it. It would be nice to document this somewhere though since a lot of people are trying to use Pi's for IOT type of things so they need GPS and 3G.

Going from Joshs comment's here: http://www.draisberghof.de/usb_modeswit ... 291#p15291
Hmm, I tested 2.2.2 on Pi 2 with current Raspbian and did not encounter problems. However, I did not try all of my 10+ modems. I will do so and see if the problem pops up.
It indicated that basically the latest usb_modeswitch was working with the raspberry pi 2. It would be good to confirm it one way or another and at least I could take that to the raspberry pi mailing lists. Right now I am not even sure the problem is not my own (although I have tested it with fresh installs and various modems...) It takes a bit of time to do a clean wipe and test each configuration...)

So Josh, just to confirm are the latest sources working for you on the raspberry pi 2 with several different modems?

Thanks!
Jas

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

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by Josh » 24 Jul 2015, 22:43

Here you go - again: unchanged Raspberry 7 with default dwc_otg ... just added usb_modeswitch 1.2.5.

Huawei E303 - fine with boot and hotplug
Huawei E1550 - fine with boot (if logging disabled) and hotplug
Huawei E369 - fine with boot and hotplug
Huawei E173u-1 - fine with boot and hotplug
Huawei E161 - fine with boot and hotplug
Huawei E3131s-2 - fine with boot and hotplug
Huawei E398 - fine with boot and hotplug
ZTE MF110 - fine with boot and hotplug
XS Stick W14 (Omega) - no switch at all
XS Stick P14 (Omega) - no switch at all
D-Link DWM-156 - fine with boot and hotplug
Alcatel X230L - fine with boot and hotplug
Alcatel X602D - fine with boot and hotplug
Option GI0225 - fine with boot and hotplug
Option Globesurfer Icon - fine with boot and hotplug

Cisco AM10 (Wifi) - fine with boot and hotplug

JasonH
Posts: 21
Joined: 05 Jul 2015, 13:54

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by JasonH » 24 Jul 2015, 23:51

Thanks Josh!

Buttttt... this is with usb_modeswitch 1.2.5 or 2.2.5? (Ie was that a typo or the early version of usb_modeswtich? I am guessing a typo... since this whole thread is about compiling with latest sources)

So that is a fresh installed raspberian? (Or at least up to date right? Ie you have run

Code: Select all

apt-get update
apt-get upgrade
apt-get dist-upgrade
So you are fully up to date right? Additionally have you run

Code: Select all

rip-update
recently? If not that can I get you to run

Code: Select all

/opt/vc/bin/vcgencmd version
and tell me the result? Thanks!

I'll order a couple of these modems and see if I can reproduce... Thanks!

Jason

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

Re: Compiling from source on Raspberry Pi 2 on latest raspbi

Post by Josh » 25 Jul 2015, 08:59

Yes, the usb_modeswitch version is 2.2.5 - the night was old ...

Raspbian state: I have installed the version offered by NOOBS on a SD card. No "dist-upgrade", just normal "upgrade".

The vcgencmd output:

Code: Select all

Apr 21 2015 14:42:19
Copyright (c) 2012 Broadcom
version 2d5ad04b63af4233440c3f7c8587108223201102 (clean) (release)

Post Reply