Tiny Core Linux

dCore Import Debian Packages to Mountable SCE extensions => dCore X86 => dCore x86 Imported Extensions => Topic started by: Onyarian on March 20, 2015, 12:19:18 PM

Title: usb-modeswitch
Post by: Onyarian on March 20, 2015, 12:19:18 PM
Hi,

I sce-load usb-modeswitch for a dongle with modem 3g, that previously worked OK with TC4.7, but with ub-dcore-trusty 3.16.6 and 3.8.13 don't work with the message in dmesg:
Quote
usb 1-2: new high-speed USB device number 5 using ehci-pci
usb-storage 1-2:1.0: USB Mass Storage device detected
scsi5 : usb-storage 1-2:1.0
usb_modeswitch_[20912]: segfault at 0 ip b75a7891 sp bfc0732c error 4 in libc-2.19.so[b752c000+1a9000]
scsi 5:0:0:0: CD-ROM            USBModem MMC Storage      2.31 PQ: 0 ANSI: 2
sr2: scsi-1 drive
sr 5:0:0:0: Attached scsi CD-ROM sr2
sr 5:0:0:0: Attached scsi generic sg7 type 5

when in TC4.7 was:
Quote
usb 1-2: new high speed USB device number 5 using ehci_hcd
scsi5 : usb-storage 1-2:1.0
scsi 5:0:0:0: CD-ROM            USBModem MMC Storage      2.31 PQ: 0 ANSI: 2
sr2: scsi-1 drive
sr 5:0:0:0: Attached scsi CD-ROM sr2
sr 5:0:0:0: Attached scsi generic sg7 type 5
usb 1-2: USB disconnect, device number 5
usb 1-2: new high speed USB device number 6 using ehci_hcd
scsi6 : usb-storage 1-2:1.2
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for GSM modem (1-port)
option 1-2:1.0: GSM modem (1-port) converter detected
usb 1-2: GSM modem (1-port) converter now attached to ttyUSB0
option 1-2:1.1: GSM modem (1-port) converter detected
usb 1-2: GSM modem (1-port) converter now attached to ttyUSB1
option 1-2:1.3: GSM modem (1-port) converter detected
usb 1-2: GSM modem (1-port) converter now attached to ttyUSB2
usbcore: registered new interface driver option
option: v0.7.2:USB Driver for GSM modems
scsi 6:0:0:0: Direct-Access     USBModem MMC Storage      2.31 PQ: 0 ANSI: 2
sd 6:0:0:0: Attached scsi generic sg7 type 0
sd 6:0:0:0: [sdf] Attached SCSI removable disk

seems that there is a segfault in usb-modeswitch (I have sce-imported it three different times with the same result in 3.8.13 and 3.16.6)

Title: Re: usb-modeswitch
Post by: Jason W on March 20, 2015, 01:16:02 PM
I don't have the hardware to test, but I have googled many bug reports of this segfault issue.  If I find any pointers I will post them.
Title: Re: usb-modeswitch
Post by: Jason W on March 20, 2015, 06:15:18 PM
I see the error mentions the file libc6-2.19.so, libc6 has been updated in trusty since the base has been last packed.

I have updated libc6 in the base image, in release candidates.  Give that a try and see if it was the issue.  My next task is to update the files in the base images of the x86 dCores.
Title: Re: usb-modeswitch
Post by: Onyarian on March 21, 2015, 04:20:24 AM
Hi Jason,

With the new trusty-rc dCore.15.03.20 and re importing usb-modeswitch the dmesg is the same:
Quote
usb 1-2: new high-speed USB device number 5 using ehci-pci
usb-storage 1-2:1.0: USB Mass Storage device detected
scsi5 : usb-storage 1-2:1.0
usb_modeswitch_[16831]: segfault at 0 ip b75f7d51 sp bfd6968c error 4 in libc-2.19.so[b757d000+1a8000]
scsi 5:0:0:0: CD-ROM            USBModem MMC Storage      2.31 PQ: 0 ANSI: 2
sr2: scsi-1 drive
sr 5:0:0:0: Attached scsi CD-ROM sr2
sr 5:0:0:0: Attached scsi generic sg7 type 5

Can I do anything else?
Title: Re: usb-modeswitch
Post by: Rich on March 21, 2015, 07:15:07 AM
Code: [Select]
usb_modeswitch_[16831]: segfault at 0That sounds like something in the  usb-modeswitch  extension is passing a  NULL  pointer to  libc.
Title: Re: usb-modeswitch
Post by: Jason W on March 21, 2015, 09:39:11 AM
Onyarian-
Could you try with the current Core 6.x and the 3.16.6 kernel and see if it works there?

That could help isolate it to being a userland issue.
Title: Re: usb-modeswitch
Post by: Jason W on March 21, 2015, 03:25:27 PM
Also, could you try this in dCore-jessie or dCore-wheezy as to compare different builds of usb-modeswitch with the same kernel?

Thanks.
Title: Re: usb-modeswitch
Post by: Onyarian on March 22, 2015, 03:08:36 AM
Hi,

The first prove with CorePlus-6.1: usb-modeswitch don't make the switch mode to modem:
tce-load usb-modeswitch-data.tcz, who loads usb-modeswitch.tcz

dmesg:
Quote
usb 1-2: new high-speed USB device number 5 using ehci-pci
usb-storage 1-2:1.0: USB Mass Storage device detected
scsi5 : usb-storage 1-2:1.0
scsi 5:0:0:0: CD-ROM            USBModem MMC Storage      2.31 PQ: 0 ANSI: 2
sr2: scsi-1 drive
sr 5:0:0:0: Attached scsi CD-ROM sr2
sr 5:0:0:0: Attached scsi generic sg7 type 5

Next prove with dCore-jessie
Title: Re: usb-modeswitch
Post by: jls on March 22, 2015, 06:11:39 AM
Hi
if I remember well the extension should be loaded at boot time and the device already plugged.
U could also try to use the tczs in dCore since they are the same format as sce.
build scripts for core:
https://code.google.com/p/tc-ext-tools/source/browse/packages/usb-modeswitch (https://code.google.com/p/tc-ext-tools/source/browse/packages/usb-modeswitch)
and
https://code.google.com/p/tc-ext-tools/source/browse/packages/usb-modeswitch-data (https://code.google.com/p/tc-ext-tools/source/browse/packages/usb-modeswitch-data)
but should be adjusted for tc6.x
Title: Re: usb-modeswitch
Post by: Onyarian on March 22, 2015, 06:15:22 AM
Hi,

The second prove with dCore-jessie rc: sce-import usb-modeswitch, same result as CorePlus-6.1, don't make the switch to modem, but isn't the segfault from trusty

dmesg:
Quote
usb 1-2: new high-speed USB device number 5 using ehci-pci
[  112.917711] usb-storage 1-2:1.0: USB Mass Storage device detected
[  112.917860] scsi5 : usb-storage 1-2:1.0
[  113.922050] scsi 5:0:0:0: CD-ROM            USBModem MMC Storage      2.31 PQ: 0 ANSI: 2
[  113.924776] sr2: scsi-1 drive
[  113.925125] sr 5:0:0:0: Attached scsi CD-ROM sr2
[  113.925319] sr 5:0:0:0: Attached scsi generic sg7 type 5

Title: Re: usb-modeswitch
Post by: jls on March 22, 2015, 06:18:14 AM
try
Code: [Select]
sudo udevadm trigger
Title: Re: usb-modeswitch
Post by: Onyarian on March 22, 2015, 06:21:19 AM
Hi jls_legalize,

Quote
if I remember well the extension should be loaded at boot time and the device already plugged.

In TC4.7 is not necessary to have it at boot and you can plug it after load usb-modeswitch

I will prove what you say at boot and plugged in CorePlus6.1, and "sudo udevadm trigger", and in dCore-jessie too.


Title: Re: usb-modeswitch
Post by: Onyarian on March 22, 2015, 08:36:06 AM
Hi,

There are no differences with loading at boot and dongle plugged, and nothing happens in dmesg after "sudo udevadm trigger", by Core6.1 or by dCore-jessie.

No segfault but don't work either.

Title: Re: usb-modeswitch
Post by: Onyarian on March 22, 2015, 02:14:10 PM
Hi,

the problem is in usb-modeswitch.sce

I have converted and make the fusion of usb-modeswich.tcz and usb-modeswitch-data.tcz from the Core5.x repository to an usb-modeswitch5.sce and an usb-modeswitch5.sce.dep with:
Quote
usb-serial-3.16.6-tinycore
usbutils
wvdial
tk

Then the sce-import of usb-serial-3.16.6-tinycore, usbutils, wvdial and tk

then sce-load usb-modeswitch5.sce
plug the dongle, and the results of dmesg:
Quote
usb 1-2: new high-speed USB device number 5 using ehci-pci
usb-storage 1-2:1.0: USB Mass Storage device detected
scsi5 : usb-storage 1-2:1.0
usb 1-2: USB disconnect, device number 5
usb 1-2: new high-speed USB device number 6 using ehci-pci
usb-storage 1-2:1.2: USB Mass Storage device detected
scsi6 : usb-storage 1-2:1.2
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver option
usbserial: USB Serial support registered for GSM modem (1-port)
option 1-2:1.0: GSM modem (1-port) converter detected
usb 1-2: GSM modem (1-port) converter now attached to ttyUSB0
option 1-2:1.1: GSM modem (1-port) converter detected
usb 1-2: GSM modem (1-port) converter now attached to ttyUSB1
option 1-2:1.3: GSM modem (1-port) converter detected
usb 1-2: GSM modem (1-port) converter now attached to ttyUSB2
scsi 6:0:0:0: Direct-Access     USBModem MMC Storage      2.31 PQ: 0 ANSI: 2
sd 6:0:0:0: Attached scsi generic sg7 type 0
sd 6:0:0:0: [sdf] Attached SCSI removable disk

and... Got it!

Of course this is not a very polite system to make or import an .sce but it says that the problem is in usb-modeswitch.sce from the ubuntu repository and that perhaps it is necessary adding some dependencies like tk (tcl and tk in Core5.x) and others that perhaps are not in the original .sce and probably in dCore-jessie too. That is the next prove.

At least, perhaps, it can be make a script to create this usb-modeswitch.

Title: Re: usb-modeswitch
Post by: Jason W on March 22, 2015, 04:38:57 PM
Thanks for the testing, I will add the dependencies tk, usbutils, and wvdial to the usb-modeswitch dependency list for starters.
Title: Re: usb-modeswitch
Post by: Onyarian on March 26, 2015, 01:33:35 PM
Hi Jason,

I can confirm that this dependencies with the modificated usb-modeswitch coming from TC5.x works in dCore-jessie also.

If you want I can send you this usb-modeswitch5.sce so you can see the differences with the actual usb-modeswitch comming from debian
Title: Re: usb-modeswitch
Post by: Jason W on March 26, 2015, 02:51:36 PM
Ok, great.  And if needed we can make usb-modeswitch a premade package to avoid the Debian/Ubuntu one if we can't get them to work in dCore.
Title: Re: usb-modeswitch
Post by: Onyarian on March 26, 2015, 03:00:51 PM
Here is the file. I named it as usb-modeswitch5.sce because is coming from TC5.x

Title: Re: usb-modeswitch
Post by: Jason W on March 26, 2015, 04:02:21 PM
Thanks, made into a prebuilt package, being from TC 5.x it should work with all dCore x86 ports.  Please re-import and test.
Title: Re: usb-modeswitch
Post by: Onyarian on March 27, 2015, 09:19:28 AM
Hi Jason,

Perfect!
works OK in ub-dCore-trusty and in dCore-jessie, with only to sce-load usb-modeswitch and sce-load usb-serial-3.16.6-tinycore

the dongle is recognize and I can connect to internet
(Now I am writing this thru the dongle)

Thanks.
Title: Re: usb-modeswitch
Post by: Jason W on April 12, 2015, 06:04:02 PM
Glad to hear!  I like to get the upstream packages to work if possible but when needed, we will usurp Debian/Ubuntu with custom built packages.
Title: Re: usb-modeswitch
Post by: hiro on August 13, 2015, 04:45:21 AM
Guys, can you clarify please on what exactly works? you plug in the device and it switches mode automatically? Or did you have to change the rules files or run usb_modeswitch binary manually?

I don't seem to understand how this works. What is running ./lib/udev/usb_modeswitch ? and what is running the dispatcher?
In the .rules file it seems like usb_modeswitch is run. But is it not using the PATH, is udev first looking in /lib/udev?
Title: Re: usb-modeswitch
Post by: hiro on August 13, 2015, 05:14:01 AM
Ok. Found the bug (which was really hard, had to guess as it wouldn't error visibly anywhere!)

You have to make sure that /usr/local/tce.installed/usb-modeswitch is compatible to you tcl package
I changed ln -s /usr/local/bin/tclsh /usr/bin/ to ln -s /usr/local/bin/tclsh8.5 /usr/bin/tclsh

Should be fixed at least in tc 6.x
Title: Re: usb-modeswitch
Post by: Jason W on August 13, 2015, 06:29:31 AM
I fixed the startup script in tcl8.5, the affected package, so should work now in all dCore ports.
Title: Re: usb-modeswitch
Post by: hiro on August 13, 2015, 11:45:07 AM
please also fix http://distro.ibiblio.org/tinycorelinux/6.x/x86/tcz/tcl.tcz
Title: Re: usb-modeswitch
Post by: Jason W on August 13, 2015, 01:55:45 PM
hiro, were you having this issue while running dCore or Core? 

The tcl package in Core is maintained by bmarkus.  I would be happy to update it but it would be best to report the issue with the tcl.tcz extension in the TCE Bugs.  That is where folks are going to look for extension bugs and then there is a record of the problem and the fix regarding the Core package.  As I don't use tcl or usb-modeswitch in Core if you would open a bug report there it would be great.

Thanks for finding the problem and the fix for it!
Title: Re: usb-modeswitch
Post by: hiro on August 14, 2015, 02:53:32 AM
Sure, only reported here cause it's exactly the same extension and jls_legalize also told me he doesn't follow core stuff any more :)
But I'll post a link to here in the core forum. Until yesterday I didn't realize how many of you guys are using dcore only now. It became a bit fragmented ;)
Title: Re: usb-modeswitch
Post by: Jason W on August 14, 2015, 06:20:12 PM
Evidently this package is working in dCore, but not in Core.  Bugs found while running Core should be reported in the Core area, dCore in the dCore area, AllwinnerA10 in the AllwinnerA10 area.  That is not fragmentation, but organization.  As using one of those forum areas to have a discussion of a package when one is for example using Core and others are using dCore and each are having different issues is just going to be confusing.   I hope you understand.
Title: Re: usb-modeswitch
Post by: hiro on August 15, 2015, 02:03:54 AM
Oh, then I must have misunderstood this:
I fixed the startup script in tcl8.5, the affected package, so should work now in all dCore ports.
Sorry, still figuring out what dcore is about :)
Title: Re: usb-modeswitch
Post by: Jason W on August 15, 2015, 04:19:06 AM
It's all good.  Mostly, I don't want anyone to hesitate to report issues here or in Core.  And thanks again for finding the bug. 

I will ping bmarkus about the tcl issue.

Title: Re: usb-modeswitch
Post by: hiro on August 26, 2015, 03:44:10 AM
I haven't gotten an answer in the tc 6 forums yet :(
http://forum.tinycorelinux.net/index.php/topic,18725.msg114988.html#msg114988
Title: Re: usb-modeswitch
Post by: sm8ps on August 26, 2015, 12:24:51 PM
Sorry, still figuring out what dcore is about :)
Hiro, you may want to check out the wiki section about dCore (http://wiki.tinycorelinux.net/dcore:welcome).
Title: Re: usb-modeswitch
Post by: Jason W on August 27, 2015, 07:24:48 AM
Hiro, I have spoke to bmarkus about the tcl package and he will fix it, lets be patient.  :-)