Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 58222 - kernel 2.6 + alsa support for slmodem 2.9.9
Summary: kernel 2.6 + alsa support for slmodem 2.9.9
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Daniel Black (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-24 14:11 UTC by Stefan Schweizer (RETIRED)
Modified: 2004-08-05 22:59 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Modified conf.d/slmodem configuration file (slmodem,746 bytes, text/plain)
2004-07-24 15:16 UTC, Matteo Settenvini
Details
Updated init.d/slmodem script for alsa support (slmodem,1.75 KB, text/plain)
2004-07-24 15:19 UTC, Matteo Settenvini
Details
Split of functions in the init script (slmodem,1.95 KB, text/plain)
2004-07-25 03:08 UTC, Matteo Settenvini
Details
Updated init script (slmodem,2.00 KB, text/plain)
2004-07-25 12:06 UTC, Matteo Settenvini
Details
Updated (again) init script (slmodem,2.02 KB, text/plain)
2004-07-25 13:15 UTC, Matteo Settenvini
Details
Updated configuration file for conf.d (slmodem,841 bytes, text/plain)
2004-07-25 13:16 UTC, Matteo Settenvini
Details
ebegin place, init and unload updated (slmodem,2.06 KB, text/plain)
2004-07-25 13:21 UTC, Stefan Schweizer (RETIRED)
Details
init.d/slmodem updated again (slmodem,2.19 KB, text/plain)
2004-07-26 05:04 UTC, Stefan Schweizer (RETIRED)
Details
A patch to deal with "need alsa-sound" and "modprobe -r ${MODULE}" issues (slmodem-2.9.init.patch,532 bytes, patch)
2004-07-27 12:45 UTC, Rouslan Solomakhin
Details | Diff
init.d/slmodem patch applied with modifications (slmodem,2.46 KB, text/plain)
2004-07-27 14:57 UTC, Stefan Schweizer (RETIRED)
Details
change "eend 1" in functions to "return 1" + move "eend $status" to the end of "stop()" (slmodem.status.patch,645 bytes, patch)
2004-08-05 07:51 UTC, Rouslan Solomakhin
Details | Diff
"echo" fixes and enhancements (slmodem.echo.patch,1.22 KB, patch)
2004-08-05 08:38 UTC, Rouslan Solomakhin
Details | Diff
"echo" and "eend + return" patches combined into one (slmodem.echo-slmodem.patch,1.48 KB, patch)
2004-08-05 08:58 UTC, Rouslan Solomakhin
Details | Diff
updated ebuild (slmodem,2.40 KB, text/plain)
2004-08-05 12:04 UTC, Stefan Schweizer (RETIRED)
Details
/etc/init.d/slmodem (slmodem,2.60 KB, text/plain)
2004-08-05 22:59 UTC, Stefan Schweizer (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Schweizer (RETIRED) gentoo-dev 2004-07-24 14:11:05 UTC
Hi,
If I want to emerge the new slmodem ebuild I get following message:

I simply deleted the dependency and it worked ..


Consoleshot:


These are the packages that I would merge, in order:

Calculating dependencies ...done!
[blocks B     ] sys-kernel/linux26-headers ("virtual/os-headers" from pkg sys-kernel/linux-headers-2.4.26)
[ebuild  N    ] sys-kernel/linux-headers-2.4.26   30,051 kB 
[ebuild   R   ] net-dialup/slmodem-2.9.9  +alsa  0 kB
Comment 1 Matteo Settenvini 2004-07-24 15:15:44 UTC
The problem is that this ebuild hasn't probably been tested enough with 2.6 kernels plus alsa support (in fact, the init.d script and the conf.d configuration file lacked of the necessary vars for alsa support).

I modified the init script and the conf file. Now they work also for alsa users. 
I'll post them here, suggestions are welcomed (but quickly, many users use these drivers).

Stefan, could you please modify the summary to something like "kernel 2.6 + alsa support for slmodem 2.9.9 ebuild broken"? so we do everything here without opening another bug.
Comment 2 Matteo Settenvini 2004-07-24 15:16:52 UTC
Created attachment 36094 [details]
Modified conf.d/slmodem configuration file

This includes also the needed vars for alsa support.
Comment 3 Matteo Settenvini 2004-07-24 15:19:20 UTC
Created attachment 36095 [details]
Updated init.d/slmodem script for alsa support

Please test it with both configuration to check if it works. It does for me
with alsa + 2.6.7-gentoo-r11.
Comment 4 Matteo Settenvini 2004-07-24 15:23:30 UTC
As for the ebuild, I ain't sure 100%, but the right correction should be:

--- slmodem-2.9.9.ebuild.old    2004-07-24 23:31:41.000000000 +0200
+++ slmodem-2.9.9.ebuild        2004-07-24 23:32:31.000000000 +0200
@@ -14,7 +14,7 @@

 DEPEND="virtual/libc
        alsa? ( media-libs/alsa-lib )
-       sys-kernel/linux-headers"
+       virtual/os-headers"

 #      sys-kernel/config-kernel

however, I never understood how to use these virtuals...

Hope to have been of help!
Comment 5 Matteo Settenvini 2004-07-24 15:37:18 UTC
Sorry to spam once again, but:

a) the init.d script should depend also on alsa, but I didn't know how to say it, since some systems don't have alsa (and use slamr/slusb), so is it like:

depend {
?alsa
}

dunno. but the script shan't be called after alsa, so we need something like that.

b) in the ebuild, if you want, add a note about "rc-update add slmodem default", some users don't know it, and other pkgs that install init scripts say it.

Bye (please, do not hate me too much... :),
Matteo
Comment 6 Daniel Black (RETIRED) gentoo-dev 2004-07-24 16:53:33 UTC
Kernel headers fixed - well spotted and Matteo your fix is correct.

Init script conditional dependancy on alsa added.

Note b as per comment 6 added.

No I don't hate you. Fixes are good.

I don't think alsa stuff should belong in the slmodem script. If alsa is used it should form part of the alsa init scripts/startup. As such if you provide a /etc/modules.d/slmodem-alsa template I will include it. If I'm wrong tell me how.

Also while your coding minds are going I'm after a src_test function that can test the compile. Basic principles are that its called before the src_install and probably should run modem_test somehow. Constraints are that it is run as the user portage.

Also should modem_test be installed into /usr/sbin?
Comment 7 Matteo Settenvini 2004-07-25 02:57:44 UTC
>I don't think alsa stuff should belong in the slmodem script. If alsa is used it should form part of the alsa init scripts/startup. As such if you provide a /etc/modules.d/slmodem-alsa template I will include it. If I'm wrong tell me how.

We can of course do that, but  we'll need to do some more checks when loading alsa, and the alsa init script will become a little complicated. I'd keep the alsa part of the init script into the slmodem one, imho. Else, we could test for the alsa modem module (snd-intel8x0m), for the slmodem executable (not everyone has it installed) and if succesful start it. 

Creating another alsa-slmodem init script would be overpopulating the init.d dir, and I read somewhere while surfing bugs.gentoo.org or reading weeklies that we don't want it.

If you want, I can clean the init script splitting the two part in separate functions, it'll improve readability.

As for "/etc/modules.d/slmodem-alsa template", it would be one line long, as suggested in your ebuil:
alias snd-card-1 snd-intel8x0m
(where "1" changes, obviously). 
Moreover, it would work also without this line, I guess.

It should stay in /etc/modules.d/alsa, or eventually in /etc/modules.d/slmodem (the latter doesn't seem to harm for alsa, but is it necessary?).

>Also while your coding minds are going I'm after a src_test function that can test the compile. Basic principles are that its called before the src_install and probably should run modem_test somehow. Constraints are that it is run as the user portage.

Don't know, maybe it should be better it would require a user action to start. Someone compiles for other hosts, and since we need to bring up slmodemd, i don't know if the user "portage" has the right permissions to do that. Anyway, if there's a way, it would be great to do a test. (the problem is, the user need to configure the pkg in conf.d before testing, or modem_test is independent?)

> Also should modem_test be installed into /usr/sbin?
Better rename it, something like "slmodem_test". Just an opinion, though.
Comment 8 Matteo Settenvini 2004-07-25 03:08:41 UTC
Created attachment 36106 [details]
Split of functions in the init script
Comment 9 Stefan Schweizer (RETIRED) gentoo-dev 2004-07-25 10:15:08 UTC
The init script does not work very good here:
(I use alsa because of suspend-to-ram not working in snd-intel8x0m)
tail -f /var/log/messages -f

/ # /etc/init.d/slmodem stop 
 * Shutting down slmodemd...
FATAL: Module slamr is in use.                                                                                                                                      [ ok ]
/ # rmmod slamr
/ # /etc/init.d/slmodem start
 * Waiting for driver initialisation
Jul 25 19:08:01 laptop slamr: SmartLink AMRMO modem.
Jul 25 19:08:01 laptop slamr: probe 8086:2446 ICH card...
Jul 25 19:08:01 laptop ACPI: PCI interrupt 0000:00:1f.6[B] -> GSI 11 (level, low) -> IRQ 11
Jul 25 19:08:01 laptop PCI: Setting latency timer of device 0000:00:1f.6 to 64
Jul 25 19:08:01 laptop slamr: mc97 codec is SIL22
Jul 25 19:08:01 laptop slamr: slamr0 is ICH card.
 * Waiting for driver initialisation
 * Waiting for driver initialisation
 * Waiting for driver initialisation
 * Module - slamr failed to initialise device                                                                                                                       [ !! ]

 * Starting slmodemd for /dev/slamr0...                                                                                                                             [ ok ]
/ # Jul 25 19:08:02 laptop rc-scripts: Module - slamr failed to initialise device 





It is obvious for me that the device initialisation code does not work, but I do not know why. The other thing is I would print out the "starting slmodemd" when the slmodemd is started and not when the script is started. The rmmod slamr does not work, so why include it? Perhabs you know a better solution than just deleting the code that is not working.
Comment 10 Matteo Settenvini 2004-07-25 12:06:37 UTC
Created attachment 36139 [details]
Updated init script

You said you're using alsa. Have you tried with the configuration and init
script attached to this bug?

The "modprobe -r" command is non blocking, and just annoying (that "FATAL:
Module slamr is in use."). Anyway, I did a small modification to the script
(plus the unlinking of /dev/modem), so you shouldn't see it anymore.

I tried both with slamr module and alsa mode, and the init script attached here
worked good. If you cannot dial up after, check of being in the dialout group
(or change group in /conf.d/slmodem).
Comment 11 Matteo Settenvini 2004-07-25 13:14:17 UTC
Ok, I investigated further: the problem you probably were experiencing laid in the fact that the script was waiting for the wrong device to set up.

Now I corrected both the scripts, and here they are. I apologize for all this chaos, but unfortunately I'm still a newbie, and maybe a little too zealant. :(

Notes: I also forgot the group ("dialout") for the daemon running with alsa support. It is now fixed.

In your /etc/modules.d/alsa, you need also another line more than what stated in the ebuild (I though it was pretty clear, but if you're in a hurry you could miss it):
alias sound-slot-1 snd-card-1

Could someone please make it clear also in the ebuild? Else we'll need a separate template as Daniel said.
Comment 12 Matteo Settenvini 2004-07-25 13:15:49 UTC
Created attachment 36144 [details]
Updated (again) init script
Comment 13 Matteo Settenvini 2004-07-25 13:16:33 UTC
Created attachment 36145 [details]
Updated configuration file for conf.d
Comment 14 Stefan Schweizer (RETIRED) gentoo-dev 2004-07-25 13:21:34 UTC
Created attachment 36146 [details]
ebegin place, init and unload updated

I wanted to point out, that I cannot use alsa, sorry for the confusion.

Your new script is not better for me in any point. Btw, the error occurs only
if the module is unloaded. But it has an easy fix, the timeout is too short. I
made it bigger( 0.5 secs) and let the unload go to the background so that the
module gets really unloaded.
Restarting is still fast because the module has not time to unload then ;)
Comment 15 Matteo Settenvini 2004-07-25 13:32:34 UTC
I updated the script because while slmodemd has to be started with /dev/slamr0 (for example), the link /dev/modem has to be set to /dev/ttySL0, which is created from slmodemd from a free pts.

If you try to do a test with, let's say, KPPP, probably it won't be able to open /dev/modem since it points to the wrong device. Hence the two variables : "MDEV" and "DEV".
Comment 16 Stefan Schweizer (RETIRED) gentoo-dev 2004-07-26 05:04:14 UTC
Created attachment 36190 [details]
init.d/slmodem updated again

Merged our 2 versions it now has improved eyecandy and sleep indication with
dots.
I hope you like it :)
Comment 17 Simon Bühler 2004-07-26 06:56:40 UTC
Hey good job guys,
now the modem (intel based, alsa config,2.6.7-gentoo-r11) on my inspiron 8200  works at last!!!
ebuild 2.9.9 plus the init.d/conf.d scripts does the job, unmask it pls cause the other ebuilds are painful!

thx again!
Comment 18 Matteo Settenvini 2004-07-26 08:22:41 UTC
Comment on attachment 36144 [details]
Updated (again) init script

Ok, we should really be there! The new script looks good. Thanks Stefan.

Now, the last thing to check is the ebuild...
is it enough "prolix", especially about /etc/modules.d/alsa?
Comment 19 Simon Bühler 2004-07-26 08:53:59 UTC
oh well, 

i get the modem device and everything but also a nasty
NO DIALTONE
Error, and no solution after 3hours of try & lots of errors : 

...
Jul 26 17:41:32 d-partment codec_semaphore: semaphore is not ready [0x1][0x300300]
Jul 26 17:41:32 d-partment codec_write 1: semaphore is not ready for register 0x54
...

seems to be some alsa stuff though ...




Comment 20 Matteo Settenvini 2004-07-26 09:52:11 UTC
From the alsa intel8x0m update (http://www.mail-archive.com/alsa-cvslog%40lists.sourceforge.net/msg04267.html):

/* access to some forbidden (non existant) ac97 registers will not
         * reset the semaphore. So even if you don't get the semaphore, still
         * continue the access. We don't need the semaphore anyway. */
        snd_printk("codec_semaphore: semaphore is not ready [0x%x][0x%x]\n",
                        igetbyte(chip, ICHREG(ACC_SEMA)), igetdword(chip, 
ICHREG(GLOB_STA)));

So this is not probably related to the bug. I noticed the NO CARRIER / NO DIALTONE problem, if you use kppp try to disable "Wait for dial tone before dialing". Also check if you do ATX3 when initializing the modem. It should go.

However, I had some issues with pppd that exited with status 19 after composing (unable to authenticate). My ISP said to retry in 24h from the account activation, though, and I'll give it another try this evening.
Comment 21 Daniel Black (RETIRED) gentoo-dev 2004-07-26 14:14:24 UTC
I think I saw somehting about nodial tone in the wvdial docs. Maybe it doesn't generate one. Just speculation. Good point about the complexity of slmodem-alsa. - One script it fine. Was hoping it could use just the ordinary alsa-sound but I guess not.

Going to wait until I get a bit more concesses on the init scripts - won't be too long though.
Comment 22 Rouslan Solomakhin 2004-07-27 12:45:50 UTC
Created attachment 36278 [details, diff]
A patch to deal with "need alsa-sound" and "modprobe -r ${MODULE}" issues

In the init script /etc/init.d/slmodem, function depend() states "need
alsa-sound". However, the init script for starting ALSA sound is called
/etc/init.d/alsasound, and has a line "provide alsa-modules". Thus, the "need"
line for slmodem init script should be either "need alsasound" (no dash), or
"need alsa-modules".
Failure to remove the module can be solved if we wait a few seconds before
removing the module. Thus, "modprobe -r ${MODULE}" should be changed to
"modprobe -r ${MODULE} || (einfo "Retrying..."; sleep 3; modprobe -r
${MODULE})".
Hope this will is useful. :)
Comment 23 Stefan Schweizer (RETIRED) gentoo-dev 2004-07-27 14:57:48 UTC
Created attachment 36286 [details]
init.d/slmodem patch applied with modifications

Again status indication with dots on unloading but i think the code is a little
bit bloated. For me it always unloads after 0.25secs. Imo we would not need the
loop if you all need only 0.25secs too.
Comment 24 Stefan Schweizer (RETIRED) gentoo-dev 2004-08-01 13:12:07 UTC
As noone complains i think this should be added to portage now, or is anything still missing, Daniel? I hope there is enough concensus now.
Comment 25 Daniel Black (RETIRED) gentoo-dev 2004-08-01 19:51:25 UTC
Fixed. Thanks Stefan much appreciate it. Any suggestions for src_test?
Comment 26 Daniel Black (RETIRED) gentoo-dev 2004-08-03 16:51:15 UTC
Any comments on bug #59244
Comment 27 Rouslan Solomakhin 2004-08-05 07:51:02 UTC
Created attachment 36816 [details, diff]
change "eend 1" in functions to "return 1" + move "eend $status" to the end of "stop()"

Functions "loadsalsa" and "loadsmodule" should not have "eend 1" statements.
Those	only show "[!!]" and do not stop the execution of code. Instead, those
functions should have "return 1" statements.

Also, the last statement in functions "start()" and "stop()" should be "eend
*", because the script gets the status of last executed command. Right now,
there is an "unlink *" statement at the end of "stop()".
Result: script thinks that it is still on even after the modules are unloaded
and "slmodemd" is stopped.
Fix: move "eend $result" to the end of function "stop()"
Comment 28 Rouslan Solomakhin 2004-08-05 08:38:53 UTC
Created attachment 36817 [details, diff]
"echo" fixes and enhancements

The part of the script that draws dots for counter should check whether or not
$RC_NOCOLOR is set to yes. functions.sh sets $NORMAL depending on $RC_NOCOLOR,
but it sets it to "\E[0m" which does not do the desired task (go to the end of
"Starting something..." string). Instead we should do "echo -ne \e[A\e[52G".
"\e[A" goes to the line above. "\e[52G" moves right by 52 characters (52 should
be the number of characters in ebegin statement after which we want to have the
counter + 7).

We do not need "-e" option when outputting ".". "-e" is only needed when we
need to interpret backslash combinations like "\e[A", "\b", or "\n".

"echo -ne '\n'" is the same thing as "echo".
Comment 29 Rouslan Solomakhin 2004-08-05 08:58:55 UTC
Created attachment 36823 [details, diff]
"echo" and "eend + return" patches combined into one

If one tries to patch slmodem script with "Attachment 36816 [details, diff]" first and
"Attachment 36817 [details, diff]", `patch` reject some changes. This is the two patches
combined. If you need both patches, apply this one to the original instead.
Comment 30 Stefan Schweizer (RETIRED) gentoo-dev 2004-08-05 12:04:45 UTC
Created attachment 36833 [details]
updated ebuild

Rouslan, but there is no ${result} when you use alsa, I think it would be
better to move the unlink right after the start-stop-daemon. Look in the
attached initscript for details.

Daniel, I saw that you replaced "\e[A\e[43G" with ${NORMAL} but that does not
work and in fact it is not the same as my one moves me above one line and to
the position 43. Is it not allowed to have \e statements in ebuilds?
Comment 31 Daniel Black (RETIRED) gentoo-dev 2004-08-05 14:01:24 UTC
thanks will look at it soon.
Comment 32 Rouslan Solomakhin 2004-08-05 22:01:36 UTC
Stefan, you are right about moving the unlink statement.
What is your opinion on the proposed patch from <a href="http://bugs.gentoo.org/attachment.cgi?id=36817&action=view">Attachemnt 36817</a>?
Comment 33 Stefan Schweizer (RETIRED) gentoo-dev 2004-08-05 22:59:29 UTC
Created attachment 36865 [details]
/etc/init.d/slmodem

Rouslan, the first line with \e[A clears all the dots and the second one moves
us to the point where the dots where cleaned, but I clean only so much dots,
that I see 3 dots when I started slmodem, so I leave 2 dots in case of
stopping, because only one is added, and I want to have 3. I added your nocolor
thoughts to the attached initscript, can you please look if it meets your
needs? You can check the output with:
/etc/init.d/slmodem --nocolor restart > file
and the output is in "file" :)

Daniel, I added a line that makes the configuration of MDEV unnecessary:
if [ -z "${MDEV}" ]; then MDEV="/dev/${MODULE}0"; fi
Do you think this way is good, or should we still configure it in the config
file? I think the config file should be as easy as possible. I do not have the
usb-modem, but I think it would be possible to start it on hotplug, and
concentrate on slamr in the initscript. Someone has the usb-device-id of lsusb?