text:
Brenner Children's pediatric emergency department has moved back to its original location. Learn more
In order to help protect patients, family members and health care workers from the spread of COVID-19, no visitors are allowed at any of Wake Forest Baptist Health's outpatient or inpatient facilities, except in certain situations.Learn moreMore COVID-19 Updates
Shelly just knew. When her dad took her to their favorite coffee shop for what he called a "very important talk," Shelly's instincts told her that he was getting married again. After he broke the news to her, though, Shelly's dad surprised her by asking how she felt about having a stepmother.
Shelly didn't have an immediate answer. Her dad's announcement triggered a range of emotions — a little jealousy about his new wife, lingering sadness over her parents' divorce 3 years before, and feelings of insecurity over just where she fit into her dad's new life. Shelly realized she hadn't really thought about the day-to-day realities of having a stepmom — or being a stepdaughter, for that matter.
Lots of Shelly's ninth-grade friends have stepparents. After all, statistics show that one third of all children are likely to spend some time in a stepfamily while growing up. Like anyone with a TV, Shelly had seen her share of pop culture stereotypes, ranging from the disinterested, self-absorbed stepmother to the overeager one who tries too hard. She wondered how it would be for her.
In some families, new adults and kids seem to slip in effortlessly, as though they have been there all along. Everyone gets along well — one big happy family.
But some families brought together through marriage can be so different that the best everyone can do is grit their teeth and work extremely hard to get through a weekend together.
Building a relationship with a stepparent can be quite different from building other new relationships. After all, when you meet a new friend or love interest, you are the one deciding if that person will have a role in your life. You get to introduce these new people into your life gradually, taking time to decide how they fit and how you really feel about them.
A stepparent is different; he or she is someone your mom or dad has invited into the family. Sometimes a stepparent can feel like a stranger who is suddenly inserted into the most personal aspects of your life. The pressure to get along can be intense.
Because everyone's situation is different, there are no easy answers to accepting a stepparent. Some people find themselves with new stepparents after a parent has died, others after parents have divorced. Some parents take years to meet and marry other people; some remarry almost immediately.
When a parent remarries, you may find yourself with an instant family of stepsiblings or, eventually, with younger half-brothers or half-sisters.
Although every family is different, there are some things that can help you deal with a new stepparent.
One of the most important things you can do for yourself is to recognize that you'll have plenty of feelings about your new situation, and some of these may conflict. For example, even when someone likes a new stepparent, it's natural to feel some pangs that this new person is "replacing" a beloved parent in some way.
Change — good or bad — is difficult. Even if you don't have negative feelings about the new person in your family, you may have very strong feelings about the changes a stepparent is creating.
At some point, you're probably going to feel confused, conflicted about your loyalties, angry, and possibly sad. Here are a couple of things to try that may help put your feelings into focus:
If your parent seems overly involved in the new relationship and you don't feel comfortable talking to him or her, then look for a group at school or in your community where you can vent. Or talk to a teacher or a guidance counselor about what's going on in your life. Mental health professionals, such as social workers or therapists, are trained to help people sort out the conflicting mix of feelings that can accompany a parent's remarriage.
Entering a stepparent situation can be particularly challenging for teens. Feeling like your family life has been disrupted can be especially difficult because of all the other changes that take place during the teenage years — everything from the emotional growth involved in becoming an adult to the hormonal changes triggered by puberty. If you find that your new situation has left you feeling sad most of the time or you just can't shake the blues, you may want to talk to a doctor or therapist.
So what can you do to adjust to the daily realities of living with a stepparent? Instead of worrying about the "what ifs" and the inevitable changes, talk to your mom or dad about what to expect before your new stepparent joins the family. That way, you can be prepared for what lies ahead. For example, figure out ahead of time what to call your stepparent. Ask about stepsiblings and things like if you have to share a room now. Ask about holiday plans and who's giving presents to whom. If your house is about to explode with new people, find out how this affects you and that spare room where you listen to music.
Don't be afraid to ask questions as they come to mind. Your parents and new stepparent might not have thought about the things you're asking either, so there's an opportunity to explore options together. And if there's something you absolutely don't want to change, try to negotiate. For example, if you and your dad always go fishing over Thanksgiving but your mom made plans for you to spend the holiday with her new husband's family, she might not realize how important the fishing trip is to you.
What about those times when you flat out disagree with a stepparent? You'll have a better chance of getting what you want if you disagree without disrespect.
Explain your feelings calmly and rationally. For example, if you have a new half-brother or -sister and you feel like you're constantly being expected to babysit at the last minute, talk it over with your stepparent before the situation gets to the stage where you feel taken advantage of. Present your side — maybe you have to study for a test or you already made plans with friends and they're relying on you. Then listen to the other person's perspective. Include your parent in the discussion, too.
If you're particularly mad about something, it can feel hard not to lose control. But managing your anger and taking extra care to choose respectful language will help your stepparent see you for the mature person you are, not as a child.
Find a way to get to know the new stepparent in your life. Suggest a bike ride or go to a movie together. It may not be easy, but you can use the same relationship and communication skills you would use to make anyone feel welcome. It may help to remember that your stepparent is walking into a new situation, too. He or she could feel just as nervous and confused as you do.
Expect some rough spots. You know that establishing a good relationship takes time. Your new life won't always be smooth, so be ready to make some compromises. The good thing is, the ups and downs of adjusting to a new family situation can offer some really great life lessons. Many people look back on their experiences getting to know new family members and realize they learned some great relationship (and negotiating!) skills in the process.
Remind yourself that every situation is different. There's no real script for a new family that's being pulled together from all sorts of directions. Be open to lots of possibilities. And savor the good moments. Although change is often difficult, it can be good, too.
Three months after her dad remarried, Shelly was beginning to enjoy the time she spent with her father and stepmother. She couldn't help but see how happy her dad was — especially when the three of them did things together. And when she needed some alone time for just the two of them, she and her dad headed to the coffee shop. Despite all the changes in their lives, some things didn't change between Shelly and her dad — like the fact he thought there was way too much sugar and caffeine in the frozen mocha cappuccino and always made her pick something else.
Reviewed by: Jennifer Shroff Pendley, PhD
Date reviewed: August 2012
© 2019 Brenner | Site Policies & Statements
The information on this Website is for general informational purposes only and SHOULD NOT be relied upon as a substitute for sound professional medical advice, evaluation or care from your physician or other qualified healthcare provider. If you have a medical problem or a health-related question, consult your physician or call Health On-Call at 336-716-2255 or 1-800-446-2255.


text:
|Equetech Adults Polka Dot Show Zipper Tie
|Product Label
UK & Ireland on all orders over £100*
Standard 48hr delivery from £3.95
Next day delivery from £5.95 - simply choose next day delivery at checkout.
*Saddles, some stable equipment, heavy & bulky items excluded.
Delivery cost will be calculated at checkout.
European delivery
Estimated delivery 5-7 days
Rest of the World
Estimated delivery 7-10 days
Hassle Free Returns and Exchanges
Simply post your item back to us for a hassle free refund or exchange.

subset: commoncrawl


text:
KDE on Windows?
I was browsing SourceForge today and stumbled across the KDE on Cygwin project. Apparently, they have ported Qt 2.3.0 for X11, Qt 1.45 and KDE 1.1.2 to use the CygWin tools and CygWin/XFree86, respectively ports of the popular GNU platform and XFree86 to Windows. Although this is a big step towards making KDE applications useable on Windows machines, it might be interesting to get rid of the X server requirements as Simon Haussman has done with Konqueror/Embedded. It seems to me that a free desktop infrastructure of KDE's caliber that runs on both Windows and UNIX, and perhaps even embedded devices runing Qt/Embedded, would increase the number and quality of KDE programs, and open the door to KDE for many more users. What do you think?
I suppose that Trolltech would not like the X11 version of Qt ported to Windows, since they have a non-free Windows version already.
This could get rid of one of their ways to make $$$.
It would be nice to see KDE running on Windows though. I think Gtk already has a free Windows version, so...
By AC at Thu, 2001/05/17 - 5:00am
Re: Trolltech?
Gtk on Windows is hardly functional though.
By ac at Thu, 2001/05/17 - 5:00am
Re: Gtk on Windows is hardly functional though.
Ethereal and GIMP on Windows use the GTK+ library and they work quite well. I wouldn't call that "hardly functional".
By Toastie at Fri, 2001/05/18 - 5:00am
Re: Gtk on Windows is hardly functional though.
Both programs work for me too, to some extent at least. But all GTK widgets just suck very bad on Win32. GTK crashes regularly and the widgets don't even paint themselves correctly most of the time. Edit control is just horrible, and tab control is not much better.
By Kirill at Sat, 2001/05/19 - 5:00am
Re: Trolltech?
Gtk on windows works allright, DnD is flacky as well as non english, but Gtk 2.0 is beinng built to be fully XP.
By ac at Fri, 2001/05/18 - 5:00am
Re: Trolltech?
I am not sure that they will mind actually,
By A Sad Person at Thu, 2001/05/17 - 5:00am
Re: Trolltech?
Well, the way I see it, if they wanted a GPL QT on Windows, they would have licensed one already. They must have reasons for not wanting it, because they have not already done it.
By not me at Thu, 2001/05/17 - 5:00am
Re: Trolltech?
My guess is that lots of companies buy Qt for in-house development. If Qt/Windows went GPL, Trolltech might lose out on a lot of sales.
Re: Trolltech?
The last.fm player is based on Qt AFAIK and they have a Windows version, don't know how they licence Qt for that particular app, but I can tell you that the player itself is released under a BSD licence so it could well be that Qt (the native Windows version, it is a native Win32 app) is GPL'd for Win32 native open source apps...
By GeoNorth at Sat, 2006/05/13 - 5:00am
Re: Trolltech?
This discussion is obsolete. Qt4 is available under the GPL for Linux, Unix, Windows and Mac:
BTW: There's no such thing as "being GPL'd for" a certain group of apps. Either something is under the GPL or not. If you use it with the software you write you have to abide by its rules, though (release your stuff under a compatible license), and I suggest you read the GPL and the GPL FAQ before you start writing that code.
By cm at Sat, 2006/05/13 - 5:00am
Re: Trolltech?
Pls note this is not really a port of Qt to windows, it's a port of Qt to Cygwin which provides Unix-like APIs under Windows.
it is not the same as the native version of Qt for Win32 which I'm sure is way more stable and optimized for that platform.
I think TrollTech can relax.
By Jacek at Fri, 2001/05/18 - 5:00am
Re: Trolltech?
I think it won't be a great idea providing a fully featured KDE system on Windows platforms. The main reason I am against it is that if it will really have a good impact, there are good chances to see many apps ported/using it JUST on Windows. I realize that it will be a GPL'd system, but... who prevents me to use Windows API's together with that product? Example: why isn't FlaskMPEG actually in development for unix platforms? Its source code is GPL'd.
By Massimo Santoro at Sat, 2001/05/19 - 5:00am
Re: KDE on Windows?
II believe it is generally a good idea to make Free Software attractive for daily use for a the largest possible number of people possible. KDE is doing so by making free Unix environments accessible for people whoes computer expriences are largely GUI/Windows based. Porting KDE to Windows is a logical step in that directon,
However I believe it is important not to copy Windows on Linux or create an alternative Windows on Windows. There must be no doubt a
By Diedrich Vorberg at Thu, 2001/05/17 - 5:00am
Re: KDE on Windows?
I'd been thinking for a while that this would be a Good Thing, but in particular having KDE on Windows so that KOffice could be there as well, because I think a lot of Windows users would be receptive to an office suite that doesn't cost a lot (MS, Corel) and doesn't suck (Staroffice). This project (if brought more up to date, and marketed to some degree) could be used to ween Windows users from the interface they know, and gain KDE more attention.
Kudos to the project.
By Joe Theriault at Thu, 2001/05/17 - 5:00am
Re: KDE on Windows?
>> I'd been thinking for a while that this would be a Good Thing, but in particular having KDE on Windows so that KOffice could be there
Another aspect that makes *me* happy is the fact that I have been lobbying (sucessfully) to use Qt for commercial software development so that we can have Linux, Mac and Windows based tools. If KDE, or just kdelibs is ported to OSX and Windows, then it suddenly becomes a fantastic tool for commerical development, which has to worry about such things (We have an even Mac and Windows mixed client base, due to our being in the publishing field, but our current products are all backend servers that run on *nix, and we need GUI admin tools).
And of course, then the Linux version would be KDE, rather than just Qt, resulting in more KDE native apps.
By Evan "JabberWok... at Thu, 2001/05/17 - 5:00am
Re: KDE on Windows?
If the project was "brought more up to date, and marketed to some degree" it would cost the same as MS and Corel.....
Nothing is for free....
By Voice of Reason at Wed, 2006/07/12 - 5:00am
Re: KDE on Windows?
Although a nice attempt, I think it is mainly a proof of concept. Which windows-user would mess around with installing this? One who is really interessted would give linux a try, and the others wouldn't mind.
By Fabi at Thu, 2001/05/17 - 5:00am
Re: KDE on Windows?
>> Which windows-user would mess around with installing this?
One who was interested in installing a KDE app. Maybe a suite of KDE applications. Maybe it will turn into a common library like VBRUNx00.dll.
Even if you are a Linux or BSD fan, and you believe that your OS of choice will take over, someday the tables could be reversed, and the poor guy in the corner running Win2008 while the rest of the company is using KDE on a variety of OSes will need *some* way to read KWord 7.0 files (since they are the business standard).
And if you doubt that, I've got a CP/M machine in the closet with Wordstar and Visicalc that was the "business standard" not *too* long ago.
By Evan "JabberWok... at Thu, 2001/05/17 - 5:00am
Re: KDE on Windows?
actually, the standards used by koffice are open, so it's very easy to add support for .kwd in other office applications (ms will do so in 2008, if they're still around).
By Evandro at Fri, 2001/05/18 - 5:00am
Re: KDE on Windows?
Your comment is the first sane thing that I've seen in this thread. This is nothing more than a proof-of-concept which hasn't been thought through to the end-product. There might be a geek or two that actually implements KDE apps on Windows, but the global population will be in the 2 or 3 digits range -- hardly worth getting up from your chair.
"To a man with a hammer, everything looks like a nail"
By APW at Sat, 2001/05/19 - 5:00am
btw konq/e is doing quite well. I really like this small browser. Go try the latest snapshot (you don't need anything special for it): http://devel-home.kde.org/~hausmann/snapshots/
faq is here:
By Pyretic at Thu, 2001/05/17 - 5:00am
The apps, not the enviroment
I doubt many Windows users have a desire to use KDE's window manager or the like, but might enjoy a few of the apps, like Kmail, Knode, and some of the games.
As much as I enjoy using Konqueror under Linux, I think there would be little motiviation to use it instead of IE on a Windows machine that has IE built-in.
By Karl Garrison at Thu, 2001/05/17 - 5:00am
Re: The apps, not the enviroment
I tried out installing Linux on my machine, and with the crappy computer I have, I couldn't get it past 640x480 in Linux. All the drivers on this computer are for Windoze only, so I'm stuck with it.
By DragonXero at Sun, 2001/05/20 - 5:00am
Re: The apps, not the enviroment
I tend now to favor using applications which can either be multiplatform, like Netscape, or StarOffice, or at least share their files with multiples applications.
In this extent I would use Konqueror on Windows, for two reasons: 1) I like it bettre 2) I could use it on more than one platform.
It is not irrational that MS understand this, Word files are already usable on Windows, and Apple machines, and maybe more.
I am betting on a Linux version of MSOffice.
By -Andre at Mon, 2001/05/21 - 5:00am
Re: The apps, not the enviroment
I tend now to favor using applications which can either be multiplatform, like Netscape, or StarOffice, or at least share their files with multiples applications.
In this extent I would use Konqueror on Windows, for two reasons: 1) I like it bettre 2) I could use it on more than one platform.
It is not irrational that MS understand this, Word files are already usable on Windows, and Apple machines, and maybe more.
I am betting on a Linux version of MSOffice.
By -Andre at Mon, 2001/05/21 - 5:00am
Re: The apps, not the enviroment
Hi Karl,
I would have to disagree withyou on GUI users staying with IE.
Have you tried to reinstall 5.5 or SP6A again after the NT4.0 system crashes? It´s a bag of ****
The problem with SP6A High Encyrption is there isn´t one! You have to rename a dll before reinsatlling a Service Pack, thats nuts!
This is the kind of functionalitiy and control that KDE will bring back to Admins. It will also ease the transition to Linux as this will be a fact soon.
By Michael Goedeker at Sat, 2001/06/02 - 5:00am
Re: The apps, not the enviroment
> I think there would be little motiviation to use it instead of IE on a Windows machine that has IE built-in
Not if you've installed Win98 using the 98lite utility (which makes MSIE & a number of other "embedded" components uninstallable). Sometimes you need to set up a Windows system for friends or family; sometimes Linux is not a good choice at the time, but you'd like to start moving them towards OSS.
By James E. LaBarre at Thu, 2001/06/28 - 5:00am
Enviroment NOT APPS
I would love to see KDE on the win 2k platform because it would give every one and me the ability to run our faverite win 2k games while still have the best GUI.
By !Q! at Thu, 2002/01/10 - 6:00am
Re: Enviroment NOT APPS
I agree! I love KDE's interface, especially the multilpe desktop feature. Such a great idea, I don't know why Micro$oft hasn't implemented this yet. I have to open up 20+ windows when I'm working (I have 23 open right now) and I would be nice to seperate them onto seperate desktops according to their function. Does anyone know of something like this out there for Windows right now?
By Mark at Fri, 2002/06/21 - 5:00am
Re: Enviroment NOT APPS
maybe Lindows will make us happy, that's if mS doesn't kill it first!
By chris at Sat, 2002/06/29 - 5:00am
Re: Enviroment NOT APPS
i have an nVidia card... it can setup multiple desktops under Windows
By nonUSER at Tue, 2003/12/23 - 6:00am
Re: The apps, not the enviroment
When somebody found it available for windoze please let me know. B.t.w. did somebody checked those crystalyze XP Skinz they are in KDE look, very kewl ;)
By [email protected] at Mon, 2002/10/14 - 5:00am
Re: The apps, not the enviroment
This post was so long ago and still very little has happenned :-(
KDE adds a lot to QT and having it availble for application development under windows would be great. Otherwise WXwidgets and GTK are going to lead the way with progressively more support and simpler developer licensing. GTK apps never give the right feel under windows - which gives users an impression of dubious quality. Perhaps people think "is everything this bad under linux - why would you go there?"
If I develop using the best platform choice for linux (KDE) where can my code go right now? Only to linux users. But if KDE is the development platform of choice even under windows we potentially bring many more apps to linux. This has got to be a good thing.
Do not hold back for political reasons! KDE is the platform (not win32 or linux) Get it being used by the largest number of people
By Andrew at Tue, 2006/03/28 - 6:00am
Re: The apps, not the enviroment
Nobody reads these old forums.
By Nobody at Tue, 2006/03/28 - 6:00am
Re: KDE on Windows?
This is a good idea but it has to be done systematically, by creating some X-independent layer including system independent IPC and window manager layer. KDE for Windows will always be a toy, but I would like to see a framebuffer-based KDE.
By Hi at Fri, 2001/05/18 - 5:00am
Re: KDE on Windows?
There is an X-independant layer. Its called Qt.
By Spooq at Fri, 2001/05/18 - 5:00am
Re: KDE on Windows?
But it's not X-independent unless you pay for the commercial version.
By Rakko at Fri, 2001/05/18 - 5:00am
Re: KDE on Windows?
The original poster was talking about a Unix framebuffer version. In that case, Qt/Embedded would do just fine. The license is the same as Qt/X11.
Re: KDE on Windows?
Actually Qt/X11 is licensed under two licenses, QPL and GPL, whereas Qt/Embedded is licensed only under GPL.
By nitpicker at Sun, 2001/05/20 - 5:00am
Re: KDE on Windows?
I think KDE should avoid windows, otherwise we'll just end up with a Mozilla-like "port to all platform"-hell... Spare us!
By Björn Svensson at Fri, 2001/05/18 - 5:00am
Re: KDE on Windows?
Well, let them port.
But there should be no windows compatibility overhead in kde itself in future. Not go back to stone age.
By mg at Fri, 2001/05/18 - 5:00am
Almost useless
Seriously. KDE should never focus on Windows, however it isn't quite so much of a problem if it is handled by someone else without a fork (similar to the Konq/Embedded project).
Still, who would use this? When people talk about OS strengths, it's usually: Windows has applications, Unix is stable. Unix applications on Windows then seems silly. Really, the true problem with Windows is not its GUI. It's the crap underneath. KDE running on Windows will be no more stable since it's running on top of the same crap.
And most users would not be interested in running a completely different desktop on Windows (anyone remember Litestep?). If you're going to do that, you might as well run Linux anyway.
I think a project like this would only help in very niche situations. I can remember times when I've been stuck at a Windows box and I wished I had Konqueror. Or perhaps Licq. But really, they weren't *that* necessary. Light is nice, but if I'm only using this computer for an hour then I'll deal with the bloat.
Maybe this is one of those "I'm bored, let's do something" projects.
Re: Almost useless
Hi you wonderful people!
Sorry if I seem a bit manic, but I've just had my first Linux experience, even if oddly enough, I'm back at XP at the moment posting through Opera.
What I wanted to say regarding KDE on Windows, the only people you'll reach with that (in regards to the Windows masses), are the experimental types. However, those have dual boot anyway. The average MS user is much too scared to use anything Linux, the problem here is psychological. Mental block.
People who do not consider themselves tekkies (Hello!;-) are scared shitless of Linux because they *think* that if they make any mistake, it will create a black hole and swallow the solar system. It really doesn't matter even how smoothly KDE would run on Windows, your average tekkiot would not install it simply because of the fear it would "do something" which was irreversible.
So unless there was a specific need by some prof, I doubt most dozers would even try it because it's all a bit irrational really, myself included. For several years I moved *very slowly* towards the fence, intimidated as hell, to get a whiff of Linux air and wanted to wait until 'I bought the next computer' so I 'can mess up the old one' with Linux. Like I said, irrational.
Even dual boot was a threatning concept to me, the sheer thought brought on fantasies about penguins eating their way crisscross through partitions while grinning evily.
Then, I found out about the Live CD thingy and I must say the concept is just brilliant. Pop in a CD, play with Linux, take out the CD, restart and you're "back to normal". Only that for me, normal suddenly didn't feel quite normal anymore. I'm so impressed. Sure, KDE still "ported Linux to me", but under Linux. While I'm willing to learn, there is just no way I would have been interested in any Unix based system without practical GUI. I think command prompts are scary. This might change with time and who knows where the road will lead, but I'm pretty confident that this Windows box here was the last one I bought. I actually start feeling tricked that most PC's are sold with Windows preslapped, if I had had (had had?) a choice when I bought my PC's with the preinstalled Linux being considerably cheaper, of course I would have opted for Linux. Who dosen't like to save a couple of bucks?
So anyway, sorry for the long post, but it was the 'supersave' 'totally reversible' LiveCD which did it for me (first SLAX then Knoppix).
By Your_average_MS_user at Tue, 2004/04/27 - 5:00am
Native Win32 would be rather easy...
If you look at the sources of Qt, *very* little of it is dependent on Xlib. Once you port QWidget, QPixmap, QFont, and QFontMetrics, virtually everything else is derived from that. 99% of the work will be in those 4 classes. Xlib is used in very little of Qt itself (for obvious reasons since Qt sells a native Windows lib). You can tell TrollTech was very careful to minimize the platform dependent code, because they want to sell the Windows version. Porting the GPL version to Win32 should not be a massive effort, since it's the same sources used in the professional version, just with the Win32 code missing.
There are other classes that would require some work like the sound and network I/O classes, but KDE doesn't use these AFAIK.
KDE is also a lot less X dependent than you'd think (which is why we also have Konq/Embedded ;-) While KWin and KDesktop doesn't make sense on Windows, getting the rest of kdelibs running natively on Windows should also be straightforward with a good Posix compiler.
By Mosfet at Fri, 2001/05/18 - 5:00am
Re: Native Win32 would be rather easy...
This would be an interesting exercise. If someone were to port the free Qt to Windows, even if they did it badly, if it took hold then TrollTech would probably just release their official version using the same dual license scheme that they have for Unix.
Really, they have nothing to lose, and plenty to gain. Qt would become THE definitive way to write cross-platform apps. The community of developers who write free software would have a no-brainer choice when they want to write apps for both the Linux and Windows communities. This would of course cause an avalanche effect of commercial developers doing the same, all paying for their commercial Qt licenses.
It would also have the pleasant side effect of making KDE the de facto standard desktop for Linux, which would also mean more license revenue for TrollTech from ISV's who will finally start releasing Linux apps now that there's a standard set of desktop API's to write to.
Everyone wins. TrollTech, KDE, Linux, and of course the end user. Are you listening, TrollTech? This could be big.
By Art Cancro at Sat, 2001/05/19 - 5:00am
Re: Native Win32 would be rather easy...
Like I said in a post earlier, my guess is that a lot of the Qt/Windows license sales are for in-house development. Trolltech would probably lose a LOT by releasing it as GPL.
Honestly, I can't name any Qt/Windows applications. This may be because it isn't so obvious what toolkit is used in the Windows environment as it is in X. Still, this leads me to theorize that:
1) In-house Unix developers use free Qt/X11
Since the majority of software in this world is in-house, Trolltech's biggest customer base is probably #2.
Let's say 80% of their sales are for in-house work. Would the benefits of a free Qt on all platforms outweigh the obvious drop in license sales? GPL is really not a problem for in-house developers.
By Justin at Sat, 2001/05/19 - 5:00am
Re: Native Win32 would be rather easy...
I'm not talking about TrollTech doing it. I don't work for them, I don't care about their license sales ;-) What I'm talking about is if someone else wanted to take the GPL QT/X11 and port it to Windows, it wouldn't be that hard to do since it's already designed to be run on multiple platforms. Looking at the code it's fairly straightforward.
By Mosfet at Sat, 2001/05/19 - 5:00am
Re: Native Win32 would be rather easy...
He was replying to the comment above his more than your comment, Mosfet.
"I don't work for them, I don't care about their license sales ;-)"
I care about TrollTech's license sales! TrollTech is a good company, they produce a good product which we all benefit from, and if they went out of business it would be a big loss. TrollTech obviously doesn't want a GPL QT on Windows, or else they would have done it already. I agree with Justin, a GPL QT/Win would be disasterous for TrollTech. Do you want Open Source to be seen as poison to companies that might be considering open-sourcing their products? We don't want to kill off companies that open-source their products, we want to encourage them!
Besides, a GPL QT/Win would have questionable benefits. KDE on Windows? Great, all the stability of Windows with the broad application base of KDE! There are really no GPL apps that Windows needs and QT/X has. The only thing I can think of would be increased interest in QT development by open-source types, but I don't think it would be increased very much since most open-source developers use Linux or BSD anyway.
By not me at Sat, 2001/05/19 - 5:00am
Re: Native Win32 would be rather easy...
I would like apps I write for KDE to be able to run on Windows (and Mac, and Beos, and everything else ;-). Windows is irrelevant to me because I can't hack it, but that's just me. All I know is I want as many people to be able to use cool KDE software as possible.
I don't feel any need to discourage porting in order to protect TrollTech, either. If someone wants to port, it's totally within their rights. TrollTech would have to live with commercial application licensing, like everyone else that does GPL libraries. Saying "Okay, we'll use the GPL but please don't use all the rights given in the license!" is crap (which BTW they never said).
By Mosfet at Sun, 2001/05/20 - 5:00am
Re: Native Win32 would be rather easy...
I agree with your statemens Mosfet. It seems like porting QT-Free to Windows could also benefit KDE, since any QT-Free apps created in Windows could easily be ported back to KDE/Linux.
By Timothy R. Butler at Tue, 2001/05/22 - 5:00am


text:
Products Description
Hello friend,
Your order is a digital download magic product,send via email.
Please leave your email after payment.
Sincerely Yours
Switcher by Richard James - download
"The most visual card switch ever"
Switcher Will Blow Their Minds!
Product Reviews
Customers who bought this product also purchased...
New Products For June
Conditions of Use | Shipping | Privacy | Site Map | FAQs |
Copyright © 2020 smithmagicsupply.com All Rights Reserved.


text:
minivosc ALSA driver
For comments and discussion, see: Minivosc entry on Wiki - discuss. Copy of this page also found on Minivosc - AlsaProject.
- Linux Audio Conference LAC2012 (full paper, 8pg) version here:
- Minivosc.pdf (Minivosc - a minimal virtual oscillator driver for ALSA (Advanced Linux Sound Architecture))
- Slides and video of presentation also available from the LAC2012 page (in addition to complete proceedings); please allow JavaScript for
This is a brief documentation/tutorial on creation of snd-minivosc ALSA ( Advanced Linux Sound Architecture ) driver. The name minivosc should stand for minimal virtual oscillator, and aims to be an example of a minimal ALSA driver, that simply represents a soundcard with a single capture interface, which streams a predefined waveform (and thus behaves as an oscillator in music technology terms). Note that playback is not handled in this driver (nor any sort of realtime control of the oscillator, such as pitch).
At the time of writing, there are but a few documents dealing with writing ALSA drivers (some of these are listed under Tutorials and Presentations - AlsaProject):
- Takashi Iwai's Writing an ALSA Driver (writing-an-alsa-driver.pdf)
- Ben Collins: Writing an ALSA driver
- Takashi Iwai's The ALSA Driver API (alsa-driver-api.pdf)
- Stéphan K.'s HowTo Asynchronous Playback - ALSA wiki
Edit: see also following links:
- FramesPeriods - AlsaProject (old version: Official Alsa Wiki for Developers: FramesPeriods)
- (alsa-devel) Questions about writing a new ALSA driver for a very limitted device
- ALSA project - the C library reference: PCM (digital audio) interface
While all these documents certainly provide valuable introductory points, they aren't excesivelly verbose about basic problems inherent in programming soundcard drivers; and they do not provide a full working code example of a driver. Iwai's document discusses an example of a hypothetical PCI device, whereas Collins' tutorial works with a real, though undisclosed device.
Minivosc, on the other hand, is a 'virtual' device driver, in the sense that it does not communicate with real external hardware - and therefore can be used to illustrate problems in soundcard device writing, that exist entirely on the PC side.
Browse the minivosc source here, or check it out from svn:
svn co https://sdaaubckp.svn.sourceforge.net/svnroot/sdaaubckp/alsa-minivosc-src
This tutorial/write-up aims to serve as documentation of the development of
minivosc, and in doing that, to introduce basic problems in soundcard drivers in as simple terms as possible; and as such, to serve as an addition to already existing ALSA driver resources.
The development machine has the following specs at time of writing:
user@mypc:/$ uname -a Linux mypc 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 07:54:58 UTC 2010 i686 GNU/Linux user@mypc:/$ cat /etc/issue Ubuntu 10.04 LTS \n \l user@mypc:/$ gcc -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) user@mypc:/$ gdb -v GNU gdb (GDB) 7.1-ubuntu user@mypc:/$ cat /proc/cpuinfo model name : Intel(R) Atom(TM) CPU N450 @ 1.66GHz user@mypc:/$ sudo lshw -class multimedia *-multimedia description: Audio device product: N10/ICH 7 Family High Definition Audio Controller configuration: driver=HDA Intel latency=0 user@mypc:/$ aplay -l && arecord -l **** List of PLAYBACK Hardware Devices **** card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 **** List of CAPTURE Hardware Devices **** card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0
Starting points
Initially, the search for source code suitable as a starting point, began with looking in the ALSA source files integrated as part of the current linux kernel source (2.6.32 on the development machine at the time). In those, the most obvious place to start is sound/drivers/dummy.c, which produces the snd-dummy driver. It should be a good place to start, because snd-dummy is also a virtual driver (in the sense that it doesn't need external hardware); however, in spite of the name, this example is not trivial at all for a beginner to understand (see below for further discussion on
Additionally, one can go along Ben Collins: Writing an ALSA driver, and produce a minimal driver code that will compile and load. However, such a driver will not do anything in particular when it is 'captured' (read from) or 'played' (written to), and as such it is difficult to use it as an example for gaining further insight into internals of ALSA. In spite of this,
minivosc copies its
snd_pcm_hardware structure (and some other code portions) from it.
alsa-devel mailing list helpfully supplied a pointer in the post: "(alsa-devel) Help with dummy.c (where/how to write?)" to a file present in ALSA sources (but not kernel sources), drivers/aloop-kernel.c, representing a virtual 'loopback soundcard' device. It is this file that is taken as a base for
minivosc - in fact, it can be said that
minivosc.c is a somewhat simplified version of
Source files
As mentioned above, the
minivosc source can be browsed here, or checked out from svn through:
svn co https://sdaaubckp.svn.sourceforge.net/svnroot/sdaaubckp/alsa-minivosc-src
It simply consists of a Makefile and minivosc.c source file. Follow the instructions in 'Building and running' in order to work with it; note that by default it has debug build, and debug statements (viewable in
/var/log/syslog) enabled - see the 'Debugging' section for more.
In addition, ALSA driver beginners may want to take a look at the
bencol source, that can be browsed here, or checked out from svn through:
svn co https://sdaaubckp.svn.sourceforge.net/svnroot/sdaaubckp/alsa-bencol-src
This driver is simply a copy/paste of Ben Collins' tutorial, with minimal changes to make it build. The folder contains a Makefile, and the following files:
- bencol-alsa-orig-comts.c - copypaste of code (+ minimal changes) and relevant text from tutorial as comments
- bencol-alsa-orig-strip.c - same as above, with comments stripped
- bencol-alsa-timer.c - same as above, with timer from
The Makefile contains entries to build any of these source files as
snd-bencol.ko; (un)comment relevant lines before building. Also, note that from the three, only
bencol-alsa-timer.c can produce some sort of a waveform (the others build and can be
insmod-ded, but fail at capturing).
Building and running
One does not need to rebuild the entire linux kernel (which can take up to several hours) in order to build the kernel module for the
minivosc driver. Simply, the build dependencies needed for building the linux kernel need to be installed (see Kernel/Compile - Community Ubuntu Documentation); after this, the files
minivosc.c and a
Makefile can be placed in a folder; and then in a terminal, after
cd-ing to the folder, the following can be issued:
make clean && make
which should result with a kernel module file in the same folder,
snd-minivosc.c (which follows the ALSA naming convention, where related kernel modules are prefixed with '
If this module was built as part of the linux kernel, when one could have used '
modprobe snd_minivosc' to load the module, and '
modprobe -r snd_minivosc' to unload it. However, since in the above example the module is built separately, then we should, instead, use:
sudo insmod ./snd-minivosc.ko # to load the module sudo rmmod snd_minivosc # to inload the module
Note that the
insmod command (unlike
modprobe) demands a relative or absolute path to the
.ko kernel module object.
To check whether the driver has been loaded after
insmod (or unloaded after
rmmod), issue
$ lsmod | grep minivosc snd_minivosc 9028 0 snd_pcm 70662 4 snd_minivosc,snd_hda_intel,snd_hda_codec,snd_pcm_oss snd 54148 14 snd_minivosc,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_seq_oss,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
lsmod lists the currently loaded modules in memory.
Finally, once the driver has been loaded in memory, we can try to use it. First, we need to check whether it is registered as a soundcard by ALSA, so we issue:
$ aplay -l && arecord -l **** List of PLAYBACK Hardware Devices **** card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 **** List of CAPTURE Hardware Devices **** card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: sndminivosc [MySoundCard Audio snd_minivosc], device 0: my_driver-snd_miMySoundCard Audio snd_minivosc [MySoundCard Audio snd_minivosc] Subdevices: 1/1 Subdevice #0: subdevice #0
Note that
snd_minivosc does not show up as a playback device at all - it is shown strictly as a capture device. Also, note that if you run
alsamixer, and try to select the
minivosc card, the program will respond with "
This sound device does not have any controls.", which it indeed doesn't (however, the corresponding mixer controls code sections could be easily copied from
aloop-kernel.c). Note that another great way to inspect audio devices is by using the alsa-info.sh script.
In the device list above,
snd_minivosc is the second soundcard (
card 1), and it has one capture interface (
subdevice #0). Therefore, in order to capture from it, we can issue:
arecord -D hw:1,0 -d 2 foo.wav
-D hw:1,0 would refer to choice of second card, first capture interface. Note that if we do not specify any format parameters,
man arecord states that:
The default is one channel. ... If no format is given U8 is used. ... The default rate is 8000 Hertz.
which means the above command will ask for 2 seconds of 8 KHz mono stream with 8-bit resolution (that is, each sample will be represented by 8 bits - a
byte, or an
unsigned char) - and that is pretty much the only format that
snd-minivosc will accept, as well. If the
arecord command executes succesfully, then we can also use an audio editor like Audacity to record (capture) from the
minivosc soundcard.
Note about pulseaudio
Also, note that in Ubuntu 10.04, PulseAudio is started by default; when it's running, it allows access to the Sound Preferences mixer in Ubuntu. While
pulseaudio is running, one can insert
minivosc driver module without a problem; however, trying to
rmmod the module afterwards will fail. In that case, one can try to shutdown
pulseaudio with
pulseaudio --kill
and then try to remove the module afterwards. To get back access to the Gnome mixer, start
pulseaudio again by using:
pulseaudio --start
However, there is a workaround for the above. Note first, that in Ubuntu 11.04 (Natty), the main volume mixer is
Upon running
pulseaudio --kill, this volume control will get muted (see image above right) - however, after a couple of mouseovers, the applet will "recover" - and then the "Sound Preferences" mixer can be raised again; the
minivosc driver will still be present in "Sound Preferences" under "Input".
However, there is also an additional volume control, which is associated with the
pulseaudio package - this one is known as
pavucontrol (it can be separately installed through
In this
pavucontrol "Volume Control", note that the
minivosc driver should show up in the "Configuration" tab, where by default it is set on the "Analog Mono Input" profile. If you change this profile to "Off", then
pulseaudio will no longer claim the
minivosc driver; and so the driver can be easily
insmod'ded and
rmmod'ded multiple times without a problem, even while
pulseaudio is running.
Understanding ALSA driver architecture
Understanding the ALSA driver architecture can be quite a mouthful, as there are plenty of functions and structs that need to be present in order for a driver to function. Before we review those, let's first revisit the context of use of an ALSA driver, and consider the following diagram:
The diagram represents a simplified abstraction of a mono in, mono out soundcard, connected to a PC through some sort of a bus (PCI, USB, ISA...). Obviously, for each input or output, we need an ADC and DAC device (respectively) present on the soundcard; all the rest of the digital circuitry needed to interface these convertors to the bus (and the rest of the PC) is abstracted in the diagram as "Controller". As the CPU is, ultimately, in control of the bus, we can consider the soundcard driver to be a piece of software running on the CPU, which handles the transfer of data, in each direction (playback or capture), between the soundcard and the rest of the PC (meaning CPU and memory).
In this case, the
minivosc driver will - without actual hardware - present a soundcard with a single mono input to the rest of the system (and thus, the whole playback direction as on the diagram above would not exist for it).
At this point, it is important to mention a few words about the Linux driver model (see Documentation/driver-model/). We can inspect /sys/devices in a bash shell:
$ ls -la /sys/devices/ total 0 drwxr-xr-x 10 root root 0 2010-08-09 17:32 . drwxr-xr-x 12 root root 0 2010-08-09 17:32 .. drwxr-xr-x 3 root root 0 2010-08-10 09:42 isa drwxr-xr-x 15 root root 0 2010-08-09 17:32 LNXSYSTM:00 drwxr-xr-x 19 root root 0 2010-08-09 17:32 pci0000:00 drwxr-xr-x 10 root root 0 2010-08-09 17:32 platform drwxr-xr-x 15 root root 0 2010-08-09 17:32 pnp0 drwxr-xr-x 3 root root 0 2010-08-10 09:42 pnp1 drwxr-xr-x 11 root root 0 2010-08-09 17:32 system drwxr-xr-x 20 root root 0 2010-08-09 17:32 virtual $ for ix in /sys/devices/pci*/0* ; do echo $ix ; ls -la $ix | grep -i usb ; done /sys/devices/pci0000:00/0000:00:00.0 /sys/devices/pci0000:00/0000:00:02.0 ... /sys/devices/pci0000:00/0000:00:1d.0 drwxr-xr-x 6 root root 0 2010-08-09 17:32 usb2 drwxr-xr-x 3 root root 0 2010-08-10 09:11 usbmon /sys/devices/pci0000:00/0000:00:1d.1 drwxr-xr-x 5 root root 0 2010-08-09 17:32 usb3 drwxr-xr-x 3 root root 0 2010-08-10 09:11 usbmon ...
This tells us that the system recognizes 'isa', 'pci', 'platform' etc. devices (with a note, that USB devices show under the 'pci' bus). Now, this is important, because an ALSA driver must receive a pointer to a corresponding driver structure in the _init and _exit functions:
- In Writing an ALSA Driver, a PCI ALSA driver is discussed;
- hence struct pci_driver driver is used, along with pci_register_driver(&driver) in _init
- In usbaudio.c, a USB ALSA driver is given;
- hence struct usb_driver usb_audio_driver is used, along with usb_register(&usb_audio_driver) in _init
However, since
dummy.c and
aloop-kernel.c (as well as minivosc) do not represent any real hardware - they will instead utilize the platform driver model (see /driver-model/platform.txt); that is:
- struct platform_driver XYZ_driver is used, along with platform_driver_register(&XYZ_driver) in _init
Driver / device initialization
Assume now, that the diagram above represents a soundcard connected to the USB bus. Since USB devices are meant to support hot-plugging, the driver should be able to handle the situations where the device is plugged or unplugged while the computer is still on. Hence, the driver must differentiate between the moments when the driver is loaded or unloaded (in our case, that is when
insmod and
rmmod commands are executed); and the moments when the device itself is connected to, or disconnected from, the bus. The Linux kernel (see Anatomy of a kernel module object) and ALSA driver architectures provide several such predefined functions, which in the case of
minivosc are:
// * declare driver functions - linux kernel static int __init alsa_card_minivosc_init(void); static void __exit alsa_card_minivosc_exit(void); // * declare driver device handling functions - ALSA static int __devinit minivosc_probe(struct platform_device *devptr); static int __devexit minivosc_remove(struct platform_device *devptr); // * declare driver pcm operations functions - ALSA static int minivosc_hw_params(struct snd_pcm_substream *ss, struct snd_pcm_hw_params *hw_params); static int minivosc_hw_free(struct snd_pcm_substream *ss); static int minivosc_pcm_open(struct snd_pcm_substream *ss); static int minivosc_pcm_close(struct snd_pcm_substream *ss); static int minivosc_pcm_prepare(struct snd_pcm_substream *ss); static int minivosc_pcm_trigger(struct snd_pcm_substream *ss, int cmd); static snd_pcm_uframes_t minivosc_pcm_pointer(struct snd_pcm_substream *ss); static int minivosc_pcm_dev_free(struct snd_device *device);
Note that this is not the full scope of predefined functions (for more, see Iwai's documents); however they are the necesarry minimum needed for
minivosc to perform. Here is a brief rundown of these functions - first the driver and device initialization functions:
_init- runs when the driver module is loaded (i.e. w/
_exit- runs when the driver module is unloaded (i.e. w/
_probe- runs when the device is attached to bus if hotpluggable (see Re: (linux-usb-devel) use of __devinit in st5481)
_remove- runs when the device is removed from bus if hotpluggable
In this case, once the
minivosc driver is loaded via
insmod, it always runs the
alsa_card_minivosc_init and
minivosc_probe functions one after another; and these two functions are enough to get the ALSA system to recognize and list a soundcard.
In addition, the following structures should be defined for the driver and device initialization functions - in
// specifies what func is called @ snd_card_free // used in snd_device_new static struct snd_device_ops dev_ops = { .dev_free = minivosc_pcm_dev_free, }; // * we need a struct describing the driver: static struct platform_driver minivosc_driver = { .probe = minivosc_probe, .remove = __devexit_p(minivosc_remove), .driver = { .name = SND_minivosc_DRIVER, .owner = THIS_MODULE }, };
Hardware parameters and PCM Interface functions
Now, it needs to be defined what happens when the driver gets used by userland audio software (such as
arecord or
audacity). Typically, audio software will request the driver to play back (or capture) at a given format (number of streams as in mono or stereo, choice of sampling rate and sampling resolution); the driver then should transfer data from userspace memory to the soundcard (in case of playback) or transfer data from the soundcard to userspace memory (in case of capture) at the requested format. These types of operations are handled by so called PCM operations ALSA functions. Note that in the case of ALSA, the 'PCM' doesn't mean specifically pulse-code modulation, as noted in "ALSA project - the C library reference: PCM (digital audio) interface":
Although abbreviation PCM stands for Pulse Code Modulation, we are understanding it as general digital audio processing with volume samples generated in continuous time periods.
The allowed audio formats that the driver will accept, as well as the PCM operations functions, should be defined as structures, which in the case of
minivosc are:
#define MAX_BUFFER (32 * 48) static struct snd_pcm_hardware minivosc_pcm_hw = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_MMAP_VALID), .formats = SNDRV_PCM_FMTBIT_U8, .rates = SNDRV_PCM_RATE_8000, .rate_min = 8000, .rate_max = 8000, .channels_min = 1, .channels_max = 1, .buffer_bytes_max = MAX_BUFFER, //(32 * 48) = 1536, .period_bytes_min = 48, .period_bytes_max = 48, .periods_min = 1, .periods_max = 32, }; static struct snd_pcm_ops minivosc_pcm_ops = { .open = minivosc_pcm_open, .close = minivosc_pcm_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = minivosc_hw_params, .hw_free = minivosc_hw_free, .prepare = minivosc_pcm_prepare, .trigger = minivosc_pcm_trigger, .pointer = minivosc_pcm_pointer, };
Note that
snd_pcm_ops can usually be separate
*_playback_ops and
*_capture_ops structs; however since
minivosc presents only a single capture interface, only the above
minivosc_pcm_ops struct exists.
Next, note that in the
snd_pcm_hardware structure (copied from Ben Collins' tutorial):
rate_max = rate_min = 8000 and
.formats = SNDRV_PCM_FMTBIT_U8, .rates = SNDRV_PCM_RATE_8000,; this means that the driver will accept only 8KHz as a sampling rate, and only 8 bit as sampling resolution - and requesting, say, CD quality (44.1KHz, 16bit) from
minivosc will therefore fail:
$ arecord -f cd -D hw:1,0 -d 2 foo.wav Recording WAVE 'foo.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo arecord: set_params:990: Sample format non available Available formats: - U8
Let us now provide a brief rundown of the PCM operations:
_pcm_open- runs each time a (sub)stream is opened (i.e. when you execute
arecord; or press 'Record' in
_pcm_close- runs each time (sub)stream is closed (i.e. a couple of seconds after:
arecordfinishes executing; or pressing 'Stop' in
audacityduring active recording).
ioctl- special communication with hardware - since we have no actual hardware, we simply specify ALSA's snd_pcm_lib_ioctl
_hw_params- allocates kernel memory for a substream, according to requested format, through use of
_hw_free- frees kernel memory for a substream
_pcm_prepare- "This callback is called when the pcm is 'prepared'. You can set the format type, sample rate, etc. here. The difference from hw_params is that the prepare callback will be called each time snd_pcm_prepare() is called, i.e. when recovering after underruns, etc." (writing-an-alsa-driver.pdf)
_pcm_trigger- "This is called when the pcm is started, stopped or paused. ... At least, the START and STOP commands must be defined in this callback." (writing-an-alsa-driver.pdf)
_pcm_pointer- "This callback is called when the PCM middle layer inquires the current hardware position on the buffer. The position must be returned in frames, ranging from 0 to buffer_size - 1. This is called usually from the buffer-update routine in the pcm middle layer, which is invoked when snd_pcm_period_elapsed() is called in the interrupt routine. Then the pcm middle layer updates the position and calculates the available space, and wakes up the sleeping poll threads, etc." (writing-an-alsa-driver.pdf)
A typical sequence of the basic PCM operations steps, that can be seen in
minivosc debug messages, is:
# at insmod: [48803.808593] ./minivosc.c: alsa_card_mini vosc_init [48803.808821] ./minivosc.c: minivosc_probe : probe [48803.808860] : -- mydev f431a60c # at arecord: [48810.487603] ./minivosc.c: minivosc_pcm_open [48810.488110] ./minivosc.c: minivosc_hw_params [48810.488162] ./minivosc.c: minivosc_pcm_prepare [48810.488170] : bps: 8000; runtime->buffer_size: 1536; mydev->pcm_buffer_size: 1536 [48810.488478] ./minivosc.c: minivosc_pcm_trigger - trig 1 ... [48811.489504] ./minivosc.c: minivosc_pcm_trigger - trig 0 [48811.489527] ./minivosc.c: minivosc_hw_free [48811.489588] ./minivosc.c: minivosc_hw_free [48811.489596] ./minivosc.c: minivosc_pcm_close # at rmmod: [49005.736089] ./minivosc.c: alsa_card_minivosc_exit [49005.736097] ./minivosc.c: minivosc_unregister_all [49005.736146] ./minivosc.c: minivosc_remove [49005.755433] ./minivosc.c: minivosc_pcm_dev_free [49005.755445] ./minivosc.c: minivosc_pcm_free
Note that if one goes along Ben Collins' tutorial, and builds an example out of it,
_pcm_trigger and
_pcm_pointer can be left essentially empty:
static int my_pcm_prepare(struct snd_pcm_substream *ss) { return 0; } static int my_pcm_trigger(struct snd_pcm_substream *ss, int cmd) { int ret = 0; switch (cmd) { case SNDRV_PCM_TRIGGER_START: // Start the hardware capture break; case SNDRV_PCM_TRIGGER_STOP: // Stop the hardware capture break; default: ret = -EINVAL; } return ret; } static snd_pcm_uframes_t my_pcm_pointer(struct snd_pcm_substream *ss) { struct my_device *my_dev = snd_pcm_substream_chip(ss); return my_dev->hw_idx; }
and while the code will compile and the module will load without problems, attempting to use such a driver will result with:
$ arecord -D hw:1,0 -d 2 foo.wav Recording WAVE 'foo.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono arecord: pcm_read:1629: read error: Input/output error
... which means,
_pcm_trigger and
_pcm_pointer cannot be left empty, if we expect the driver to work
Device structure
As different functions of the driver may need access to information at different times, we must provide a structure that can be accessed and modified by these functions. In the case of
minivosc, we use a single structure to represent both the device and the only available substream:
struct minivosc_device { struct snd_card *card; struct snd_pcm *pcm; const struct minivosc_pcm_ops *timer_ops; /* * we have only one substream, so all data in this struct */ /* copied from struct loopback: */ struct mutex cable_lock; /* copied from struct loopback_cable: */ /* PCM parameters */ unsigned int pcm_period_size; unsigned int pcm_bps; /* bytes per second */ /* flags */ unsigned int valid; unsigned int running; unsigned int period_update_pending :1; /* timer stuff */ unsigned int irq_pos; /* fractional IRQ position */ unsigned int period_size_frac; unsigned long last_jiffies; struct timer_list timer; /* copied from struct loopback_pcm: */ struct snd_pcm_substream *substream; unsigned int pcm_buffer_size; unsigned int buf_pos; /* position in buffer */ unsigned int silent_size; /* added for waveform: */ unsigned int wvf_pos; /* position in waveform array */ unsigned int wvf_lift; /* lift of waveform array */ };
Note that in most part, these variables are taken from
aloop-kernel.c; however both
aloop-kernel.c and
dummy.c are capable of handling multiple capture and playback substreams - and thus in those drivers, several structs (instead of a single) are used, because arrays of structs must be implemented so as to represent multiple substreams.
Note also, that the "_open" PCM operation is the first time when the ALSA system makes a real pointer to a
snd_pcm_substream available; hence, it is in this callback where we need to make sure that we set ourselves the pointer
minivosc_device->substream to the real pointer passed by the system; otherwise, the rest of the PCM functions will not have the right pointer to work with (and hence kernel oops and crashes can be expected).
More detailed information about the substream pointer and its use can be found in writing-an-alsa-driver.pdf, under Runtime Pointer - The Chest of PCM Information.
Timing and memory (buffer) management
We now arrive at a slightly more complex part of an ALSA driver. We have already mentioned that
minivosc corresponds to (or simulates the context in) the diagram above - except with only a single DAC (and no ADC); and thus with only the 'Capture' data transfer direction present. Even though this driver can thus, by definition, only support a single direction of data transfer (from the card to the PC), there could be several strategies involved with this:
- The PC repeatedly keeps on asking the card if it has data to supply (polling); if it does it handles the data transfer (copies data from the card to PC memory).
- The soundcard generates a signal when it has data ready for the PC; upon this signal, the PC stops whatever its doing, and it handles the data transfer (copies data from the card to PC memory) (interrupt)
In principle, either of these approaches could be used so that the PC would receive data of one sample (which in
minivosc case is 8 bit, or a byte) at a time - however, that would be inefficient use of computer resources. That is why within ALSA, data transfer encompasses multiple samples - chunks - at a time.
Going back to the Ben Collins tutorial, where capture is discussed, we can already start guessing why the minimal example built from that tutorial will not do anything: "
The buffer I've shown we assume to have been filled during interrupt." (Ben Collins: Writing an ALSA driver: PCM handler callbacks) - seemingly, an interrupt generated by a device; however the interrupt function is in any case not provided.
So we can take a look again at
aloop-kernel.c and
dummy.c, where we can find that:
struct timer_listalong with
add_timer; (linux kernel timer API)
struct timer_list(timer API) in its '_systimer_pcm' part; and a
struct hrtimer(linux kernel high resolution timer API) in its '_hrtimer_pcm' part
- More about Linux kernel timers at Kernel APIs, Part 3: Timers and lists in the 2.6 kernel; Kernel Timer Systems - eLinux.org; The timer API: size or type safety? (LWN.net).
In other words: if there isn't an actual hardware to generate interrupts; then we must set up some sort of a timer, that will repeatedly trigger a function (that would correspond to a polling function) in our virtual soundcard driver. In this case,
minivosc copies the timer API approach from
At this point, let's take a look at which PCM functions get called in
minivosc after it had been triggered for start:
[48810.488478] ./minivosc.c: minivosc_pcm_trigger - trig 1 [48810.488486] : minivosc_timer_start: mydev->period_size_frac: 12000; mydev->ir q_pos: 0 jiffies: 12127621 pcm_bps 8000 [48810.488497] : +minivosc_pointer [48810.488500] : *minivosc_pos_update: running [48810.488505] : * : jiffies 12127621, ->last_jiffies 12127621, delta 0 [48810.488510] : + bytes_to_frames(: 0, mydev->buf_pos: 0 [48810.493135] : minivosc_timer_function: running [48810.493141] : *minivosc_pos_update: running [48810.493147] : * : jiffies 12127623, ->last_jiffies 12127621, delta 2 [48810.493152] : * : last_pos 0, c->irq_pos 16000, count 64 [48810.493157] : >minivosc_xfer_buf: count: 64 [48810.493163] : _ minivosc_fill_capture_buf ss 1536 bs 1536 bytes 64 buf_pos 0 sizeof 1 jiffies 12127623 [48810.493182] : * : mydev->irq_pos >= mydev->period_size_frac 12000 [48810.493188] : minivosc_timer_start: mydev->period_size_frac: 12000; mydev->ir q_pos: 4000 jiffies: 12127623 pcm_bps 8000 [48810.493194] : : calling snd_pcm_period_elapsed [48810.493199] : +minivosc_pointer [48810.493202] : *minivosc_pos_update: running [48810.493207] : * : jiffies 12127623, ->last_jiffies 12127623, delta 0 [48810.493212] : + bytes_to_frames(: 64, mydev->buf_pos: 64 [48810.493324] : +minivosc_pointer
Let's briefly discuss the snippet above:
- The timer is repeatedly activated (set off) by calling
- When the time set for the timer expires, the
_timer_functioncallback function runs, which calls
- If
_pos_updatedetects a difference in
jiffies, it calls
_xfer_bufwhich in turn calls
- in this case, when all is finished,
_timer_startis called again
- in this case, when all is finished,
_pos_updatecan also be called independently by
- in this case, usually there is no difference in
jiffies(delta is 0), in which case
_pos_updatequickly exits, not calling any other function.
- in this case, usually there is no difference in
At this point, lets include an excerpt from Jiffy (time):
In computing, a jiffy is the duration of one tick of the system timer interrupt. It is not an absolute time interval unit, since its duration depends on the clock interrupt frequency of the particular hardware platform.
Within the Linux 2.6 operating system kernel, since release 2.6.13, on the Intel i386 platform a jiffy is by default 4 ms, or 1/250 of a second. The jiffy values for other Linux versions and platforms have typically varied between about 1 ms and 10 ms.
So, to be more precise -
_pos_update actually measures time (in jiffies), elapsed since the last call to
_timer_start, as the variable
delta; only if
delta is more than 0 jiffies, a call to
_xfer_buf is made, requesting a transfer of ammount of samples (data) that corresponds to the elapsed time in jiffies, according to the requested sampling rate, resolution and number of streams. Let's use this for the log above:
- A sampling rate of 8000 KHz, means we have to transfer data for 8000 samples each second for a single (mono) stream.
- A sampling resolution of 8 bits = byte, means we have to transfer 8000 bytes each second.
- And 8000 Bps will be equivalent to (8000 / 250) = 32 bytes per jiffy (given a jiffy is 4ms for a 2.6 kernel)
- Thus, when delta==2, then 2*32 = 64 bytes will be requested for transfer; when delta==1, then 32 bytes will be requested.
On the development machine, a typical pattern of changes of
delta looked like:
* : jiffies 12127837, ->last_jiffies 12127836, delta 1 * : jiffies 12127837, ->last_jiffies 12127837, delta 0 * : jiffies 12127839, ->last_jiffies 12127837, delta 2 * : jiffies 12127839, ->last_jiffies 12127839, delta 0 * : jiffies 12127839, ->last_jiffies 12127839, delta 0 * : jiffies 12127839, ->last_jiffies 12127839, delta 0 * : jiffies 12127839, ->last_jiffies 12127839, delta 0 * : jiffies 12127840, ->last_jiffies 12127839, delta 1 * : jiffies 12127840, ->last_jiffies 12127840, delta 0 * : jiffies 12127842, ->last_jiffies 12127840, delta 2 * : jiffies 12127842, ->last_jiffies 12127842, delta 0 * : jiffies 12127842, ->last_jiffies 12127842, delta 0
which means the requests for byte transfers will repeatedly change between 32 and 64 bytes.
Now, how does the rest of ALSA know that such a requested transfer has been executed succesfully? It does so by asking the driver, what is its current position in the buffer, by calling its
_pcm_pointer function;
_pcm_pointer should return the buffer position in frames (and in our
minivosc case, since we use a mono 8 bit stream, a frame will be equivalent to a size of a single sample, which is a byte). The important thing to remember is that here 'buffer' does not refer to the sizes of these 'individual' transfers of 32 and 64 bytes - it refers to the size of the PCM buffer of the substream, which is determined in
This is why we need to keep a variable for the position within this PCM buffer,
minivosc_device->buf_pos, within our device struct; we can then update this variable for each 'individual' transfer, and return it back whenever the ALSA middle layer asks for it through
_pcm_pointer. (this becomes obvious, if we comment all commands that update
minivosc_device->buf_pos - in that case, running a capture from Audacity will visibly show the record cursor being unable to move, and the process will eventually fail.) Note that in
aloop-kernel.c, the main calculation of
buf_pos occurs in
_xfer_buf (in
minivosc, it depends on the choice of copying algorithm).
Also note that, after how much time after _start does the timer expire and _timer_function runs, is calculated in
_timer_start as:
tick = (mydev->period_size_frac - mydev->irq_pos + mydev->pcm_bps - 1) / mydev->pcm_bps;
mydev->timer.expires = jiffies + tick;
While here, let's also mention
snd_pcm_period_elapsed. The
_timer_function, after calling
_pos_update and
_timer_start, checks if
mydev->period_update_pending is 1 - if so, then it calls
snd_pcm_period_elapsed. The condition of setting
period_update_pending to active is
if (mydev->irq_pos >= mydev->period_size_frac) in
_pos_update, where:
// in include/asm-generic/param.h # define HZ CONFIG_HZ /* Internal kernel timer frequency */ // minivosc #define byte_pos(x) ((x) / HZ) #define frac_pos(x) ((x) * HZ) // _prepare: mydev->pcm_bps = runtime->rate * runtime->channels * snd_pcm_format_width(runtime->format) / 8; mydev->pcm_buffer_size = frames_to_bytes(runtime, runtime->buffer_size); mydev->pcm_period_size = frames_to_bytes(runtime, runtime->period_size); mydev->period_size_frac = frac_pos(mydev->pcm_period_size); // _pos_update: mydev->irq_pos += delta * mydev->pcm_bps; // typical values - arecord: bps: 8000; runtime->buffer_size: 1536; mydev->pcm_buffer_size: 1536 mydev->pcm_period_size: 48; mydev->period_size_frac: 12000
This tells us that we must differentiate between size of PCM buffer,
pcm_buffer_size (1536 bytes) - and
pcm_period_size (48 bytes). In simple terms, we could understand this as: as soon as a new batch of 48 bytes have been written in the PCM buffer, the ALSA middle layer should be informed by calling
snd_pcm_period_elapsed; and it is this call that finally, after all the buffer operations performed within the driver, makes the data available to audio software like
arecord that can proceed with, say, recording this data to disk.
writing-an-alsa-driver.pdf, in regards to
snd_pcm_period_elapsed, mentions:
Interrupt Handler The rest of pcm stuff is the PCM interrupt handler. The role of PCM interrupt handler in the sound driver is to update the buffer position and to tell the PCM middle layer when the buffer position goes across the prescribed period size. To inform this, call the snd_pcm_period_elapsed() function. ... Interrupts at the period (fragment) boundary This is the most frequently found type: the hardware generates an interrupt at each period boundary. In this case, you can call snd_pcm_period_elapsed() at each interrupt. ... High frequency timer interrupts This happense when the hardware doesn't generate interrupts at the period boundary but issues timer interrupts at a fixed timer rate (e.g. es1968 or ymfpci drivers). In this case, you need to check the current hardware position and accumulate the processed sample length at each interrupt. When the accumulated size exceeds the period size, call snd_pcm_period_elapsed() and reset the accumulator. ... On calling snd_pcm_period_elapsed() In both cases, even if more than one period are elapsed, you don't have to call snd_pcm_period_elapsed() many times. Call only once. And the pcm layer will check the current hardware pointer and update to the latest status.
More on memory (buffer) management
At this point, let us recall that
minivosc simply repeats a short waveform, in order to generate a continuous tone. This waveform is specified as the array
wvfdat within the driver code. Additionally, at each repetition, the waveform can be 'lifted' - that is, a constant value can be added to it - which is controlled by the
minivosc_device->wvf_lift variable.
In the case of actual capture hardware, the driver would have to first collect the data from the card in some intermediate buffer (array) - and in the case of
minivosc, that intermediate buffer is in fact
wvfdat; the only difference from the hardware case being, that it is pre-filled with data (and in a real soundcard, it would have to be continuosly updated with data from the soundcard).
Thus, we can state the following: regardless if we talk about a virtual or a real hardware driver, a key part of the driver job, is to transfer data from an intermediate buffer/array (here
wvfdat) to the PCM buffer for that substream (here
minivosc_device->substream->runtime->dma_area) - in 'individual' transfers of chunks, whose size is determined by the time elapsed since the last 'individual' transfer (or in other words, the time between two consecutive
In other words, in the case of
minivosc we can distinguish between:
- intermediate (waveform) buffer/array -
wvfdat- size 21 bytes
- size preset by driver programmer
- 'individual' transfer chunk size - given by
bytes / count- size 32 (or 64) bytes
- size dependent on timing between consecutive executions of
_timer_function& stream(s) format
- size dependent on timing between consecutive executions of
- PCM substream buffer/array -
dev->substream->runtime->dma_area- size 816 (or 1536) bytes
- size chosen by software (?): audacity usually claims 816 bytes, arecord 1536 bytes
pcm_period_size- size 48 bytes,
- for calling
snd_pcm_period_elapsed, size set by stream(s) format & kernel timer frequency
- for calling
And, since it turns out that, in this case, the intermediate buffer size (21) is less than the 'individual' transfer chunk size (32 or 64), we come to an interesting situation, not accounted for in the original
aloop-kernel.c - displayed on the diagram below (the colors on the diagram match the colors used in the list above).
As shown in the buffer visualisation diagram, due to intermediate (waveform) buffer/array size (
wvfsz) being smaller than 'individual' transfer chunk size (
count), we need to loop through the waveform buffer/array in order to fill a chunk request - and the waveform piece will not end at the end of the chunk request. In other words, the data will not be aligned at boundary.
That is why, although 'individual' transfer chunk size is not a real array, we have to treat it as such, because we need to keep a pointer for it (here
dpos). In other words, if we want seamless looping of the waveform buffer, we need to keep three buffer pointers:
- dev->wvfpos - where are we in the
- dpos - where are we in the current chunk request
- dev->buf_pos - where are we in the PCM substream buffer (
To illustrate this, there are three copying algorithms one can choose from in
minivosc's function
_fill_capture_buf - simply by uncommenting the corresponding
#define (and commenting the others):
COPYALG_V1- here, bytes are copied in chunks using
memcpy(which slightly complicates buffer pointer calculation)
COPYALG_V2- here, bytes are copied one by one from
dma_areathrough assignment in a loop
COPYALG_V3- a copy of
copy_play_buffunction's algorithm from
Note that V1 and V2 calculate their own
buf_pos in
_fill_capture_buf, and they can both demonstrate seamless looping of the waveform:
Seamless loop example (V1 or V2) - the large spikes represent different buffer sizes of audacity and arecord.
V3 uses the same calculation of
buf_pos as originally in
aloop-kernel.c, and it does show that the waveform looping in that case is not seamless:
Problems in looping between audacity and arecord, due to differing buffer sizes, when the buf_pos is calculated in _xfer_buf as in aloop-kernel.c.
Also note that by uncommenting the
#define BUFFERMARKS, we can insert bytes marking specific 'edges' of the buffer, which visibly illustrates the differences in PCM buffer sizes between
arecord and
audacity (note, you can use these buffer marks, even if no algorithm for copying is used, that is, without a waveform - however,
buf_pos still has to be handled):
Illustration of buffer marks - and difference of buffer sizes between arecord and audacity.
Note that while
audacity seems to 'speed up' its buffers after some periods, it will still report the same 32 and 64 bytes requests in the logs as
arecord (?!)
Finally, let's include these snippets related to buffers:
From ALSA project - the C library reference: PCM (digital audio) interface:
One digital value is called sample. More samples are collected to frames (frame is terminology for ALSA) depending on count of converters used at one specific time. One frame might contain one sample (when only one converter is used - mono) or more samples (for example: stereo has signals from two converters recorded at same time). Digital audio stream contains collection of frames recorded at boundaries of continuous time periods. General overview ALSA uses the ring buffer to store outgoing (playback) and incoming (capture, record) samples. There are two pointers being maintained to allow a precise communication between application and device pointing to current processed sample by hardware and last processed sample by application. The modern audio chips allow to program the transfer time periods. It means that the stream of samples is divided to small chunks. Device acknowledges to application when the transfer of a chunk is complete. Transfer methods in UNIX environments In the UNIX environment, data chunk acknowledges are received via standard I/O calls or event waiting routines (poll or select function). To accomplish this list, the asynchronous notification of acknowledges should be listed here. The ALSA implementation for these methods is described in the ALSA transfers section. ... ALSA transfers There are two methods to transfer samples in application. The first method is the standard read / write one. The second method, uses the direct audio buffer to communicate with the device while ALSA library manages this space itself. You can find examples of all communication schemes for playback in Sine-wave generator example. To complete the list, we should note that snd_pcm_wait() function contains embedded poll waiting implementation.
And from HowTo Asynchronous Playback - ALSA wiki:
snd_pcm_hw_params_set_access is used to set the transfer mode I've been talking about at the start of this document. There are two types of transfer modes: * Regular - using the snd_pcm_write* functions * Mmap'd - writing directly to a memory pointer Besides this, there are also two ways to represent the data transfered, interleaved and non-interleaved. If the stream you're playing is mono, this won't make a difference. In all other cases, interleaved means the data is transfered in individual frames, where each frame is composed of a single sample from each channel. Non-interleaved means data is transfered in periods, where each period is composed of a chunk of samples from each channel. To visualize the case above, where we have a 16-bit stereo sound stream: * interleaved would look like: LL RR LL RR LL RR LL RR LL RR LL RR LL RR LL RR LL RR LL RR ... * non-interleaved might look like: LL LL LL LL LL RR RR RR RR RR LL LL LL LL LL RR RR RR RR RR ... where each character represents a byte in the buffer, and padding should of course be ignored (it's just for clarity). Note that I emphasized 'might' in the non-interleaved case. The size of the chunks depends on the period size hardware parameter, which you can adjust using snd_pcm_hw_params_set_period_size. But in most cases, you want interleaved access.
So, given that we have
SNDRV_PCM_INFO_MMAP_VALID in our
_pcm_hw struct, and we never use
snd_pcm_write* functions (but instead we use say
memcpy to transfer data) - it would be safe to say that in
minivosc, the mmap transfer mode is being used.
dummy.c revisited
Some documentation for it can be found on Matrix:Module-dummy - AlsaProject, where it is described as:
This driver provides up to 4 devices with up to 16 substreams. It uses a timer to sink and generate data. Useful for initial testing of an ALSA installation.
Some more information on (alsa-devel) Problem in dummy driver:
> I am working on the dummy driver provided with the ALSA. I took it from > the linux kernel 126.96.36.199 > I build the module and load it. The XMMS seems to play ok (doesn't hang > and all) but none of > the recording application seem to record from the driver. > > Can the driver in current state work as the loop back cable between > applications? No, it's really dummy driver which eats playback samples and returns zero samples for capture. Try use the snd-aloop driver.
And in Alsa-sound-mini-HOWTO: How to install ALSA sound drivers:
The great thing is: you don't need a supported sound card anymore, as ALSA now has a dummy driver that does nothing! (No, it really does nothing, but some programs will work now that they believe there is a sound card available).
If we look again at the
dummy.c driver, and we try to apply the same approach as in
minivosc - that is, we simply try to copy bytes into
substream->runtime->dma_area right before
snd_pcm_period_elapsed is called - we will experience SEVERE crashes/freezes. The reason for this is a variable
fake_buffers being set to 1 - in which case, the
dma_area is, in fact, not allocated at all!
Therefore, the patch below shows some minimal changes that need to be implemented on dummy.c; so that a few bytes at the beginning of PCM buffer are written during capturing (which results with pulses at PCM buffer boundaries in the captured audio):
--- dummy-orig.c 2010-07-20 22:15:36.086589147 +0200 +++ dummy.c 2010-07-20 22:21:23.469990765 +0200 @@ -18,6 +18,14 @@ * */ + +static int debug = 1; +/* Use our own dbg macro */ +#undef dbg +#define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG __FILE__ ": " format "\n" , ## arg); } while (0) + + + #include <linux/init.h> #include <linux/err.h> #include <linux/platform_device.h> @@ -154,7 +162,12 @@ #ifdef CONFIG_HIGH_RES_TIMERS static int hrtimer = 1; #endif -static int fake_buffer = 1; + +//static int fake_buffer = 1; +// NOTE: IF WE INTEND TO WRITE TO +// DMA_AREA, fake_buffer CANNOT BE 1 +// ELSE VERY SERIOUS CRASHES HAPPEN +static int fake_buffer = 0; module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for dummy soundcard."); @@ -355,14 +372,26 @@ static void dummy_hrtimer_pcm_elapsed(unsigned long priv) { struct dummy_hrtimer_pcm *dpcm = (struct dummy_hrtimer_pcm *)priv; - if (atomic_read(&dpcm->running)) + + if (atomic_read(&dpcm->running)) { + // we should write into the buffer right before snd_pcm_period_elapsed? probably yes... and probably only if dpcm->running... + // trying to write the value 230 (e6) four times + // note that this works in arecord without specifying format (which defaults to 8KHz, 8bit); + // but arecord completely messes the buffers up, for say, stereo 16 bit 44.1 KHz (as in audacity - although sometimes even audacity gives OK pulses, as long as one makes sure to reclick to select correct input). + if (dpcm->substream->stream == SNDRV_PCM_STREAM_CAPTURE) + memset(dpcm->substream->runtime->dma_area, 230, 4); + + snd_pcm_period_elapsed(dpcm->substream); + } } static enum hrtimer_restart dummy_hrtimer_callback(struct hrtimer *timer) { struct dummy_hrtimer_pcm *dpcm; + dbg("%s: dummy_hrtimer_callback", __func__); + dpcm = container_of(timer, struct dummy_hrtimer_pcm, timer); if (!atomic_read(&dpcm->running)) return HRTIMER_NORESTART; @@ -547,11 +580,12 @@ dummy->timer_ops = &dummy_hrtimer_ops; #endif - err = dummy->timer_ops->create(substream); + err = dummy->timer_ops->create(substream); // this calls dummy_hrtimer_create, where dpcm->substream is set to substream if (err < 0) return err; runtime->hw = dummy_pcm_hardware; + //dpcm->substream = substream; // already done in _create if (substream->pcm->device & 1) { runtime->hw.info &= ~SNDRV_PCM_INFO_INTERLEAVED; runtime->hw.info |= SNDRV_PCM_INFO_NONINTERLEAVED; @@ -1024,7 +1061,8 @@ .resume = snd_dummy_resume, #endif .driver = { - .name = SND_DUMMY_DRIVER + .name = SND_DUMMY_DRIVER, + .owner = THIS_MODULE }, };
Let's just note that in this case, we use
memset to write 4 bytes at the beginning of the PCM buffers; if we request (say via
arecord) a 8-bit mono stream, then we will see four samples in the captured audio; if we asked for a floating point (32 bit) mono stream, then we will see a single sample in the captured audio (which makes sense, since a
float is usually encoded using 4 bytes, that is -
sizeof(float) is 4).
One of the most problematic things in driver development is their debugging as kernel modules - and especially problematic are errors such as
memsetting a null pointer (which is what happens, if we try to write to
dma_area in
dummy.c, while
fake_buffers = 1). In such a case, the computer freezes, without time to generate
printk kernel debug messages in
/var/log/syslog - and the only way out from such a freeze is a hard reboot (power off and on).
In such a case, pretty much the first thing that pops to mind is to step the code in a debugger and identify the offending line. However, since in case of drivers we are talking about kernel modules (not userspace programs), the procedure for debugging them is not trivial.
Fortunately, there is a kernel debugger built into the Linux kernel since version 2.6.26, known as kgdb light. What this means is that, while for earlier kernels this functionality required recompiling the kernel - for kernels newer than 2.6.26, we can simply add arguments like
kgdboc=ttyS0 kgdbwait
to the GRUB boot entry for the operating system - and then when the OS boots, instead of loading the desktop etc., the boot process will in fact halt, and wait for a signal from the GNU debugger
gdb. This signal needs to be delivered through a serial connection - and so, debugging a kernel using
kgdb assumes having a second machine that will run
gdb for debugging, connected to the machine that runs the kernel / module to be debugged via serial cable.
Notably, since newer PCs don't even have a real RS-232 serial port, the only remaining approach to debugging with
kgdb is on a single PC, through usage of a virtual machine. Here VirtualBox OSE was used (although in principle also Qemu or KVM could be used, since the Intel Atom processor used here does not support hardware virtualization, VirtualBox is as good as any), a virtual hard drive created from it, and Ubuntu 10.04 command line version was installed using the Ubuntu minimal CD image. VirtualBox can then be set up in its Settings / Serial Ports to: 'Enable Serial Port', and 'Create Pipe', where 'Port/File Path' would be a file like
Then, after adding 'kgdboc=ttyS0 kgdbwait' as GRUB2 boot options to the virtual image OS installation, we can boot the virtual image; after a while the booting process starts, and should show:
kgdb: Waiting for connection from remote gdb.
Then, in the host OS environment, in one terminal we can run
$ socat UNIX-CONNECT:/tmp/vboxpipe TCP-LISTEN:8040
and in another:
$ gdb /path/to/linux-2.6.32/vmlinux ..Reading symbols from /path/to/linux-2.6.32/vmlinux...done. (gdb) target remote 127.0.0.1:8040 Remote debugging using 127.0.0.1:8040 kgdb_breakpoint (new_kgdb_io_ops=0xc0747f18) at kernel/kgdb.c:1721 1721 wmb(); /* Sync point after breakpoint */ (gdb) continue
after which control is passed from
gdb to the kernel running in the virtual image, and the virtual kernel image completes booting. After that, breakpoints can be made by running:
$ echo g | sudo tee /proc/sysrq-trigger
at the virtual image
bash prompt; or by using
#define BREAKPOINT() asm(" int $3");
in the driver kernel module code, and then calling
BREAKPOINT(); wherever in the driver code we want. Obviously, if we have a breakpoint in, say, "
_prepare" function, we first
insmod the driver module in the VM image OS, and then should call
arecord in the VM so that the driver is activated there.
Note that the
vmlinux file used in the
gdb call above is, in fact, the symbol file for the kernel; and the only way to obtain it is to rebuild the kernel. So although you don't need to rebuild the kernel simply to be able to break into
gdb, you must rebuild the kernel in order to obtain the symbol file, and be able to step through source - without a symbol file, the
gdb session above would look like:
$ gdb (gdb) target remote 127.0.0.1:8040 Remote debugging using 127.0.0.1:8040 0xc019de6e in ?? () (gdb) continue
Of course, after you rebuild your kernel (it should automatically be set to generate debug symbols), you should also install your new debug kernel in the VM OS - and set it to boot by default, with the
kgdboc=ttyS0 kgdbwait options appended to its boot entry.
Finally, since the driver modules we're working with here are not built as part of the kernel,
gdb will need their symbol files as well. As such, it is best to built the driver modules within the virtual machine OS, and then copy the
.o file to the normal file system so it is available to
gdb. Here's how a sample session might look like (assuming 192.168.1.15 is the 'real' IP address of the host OS):
VM# cd /path/to/minivosc-src VM# make VM# scp snd-minivosc.o 192.168.1.15:~ VM# sudo insmod ./snd-minivosc.ko VM# cat /sys/module/snd_minivosc/sections/.text 0xd8b51000 VM# echo g | sudo tee /proc/sysrq-trigger (gdb) add-symbol-file ~/snd-minivosc.o 0xd8b51000 (gdb) continue VM# arecord ...
Note that for correct stepping within
gdb, the source files should be at the same path in both the virtual image OS and the host OS - so, if the source files for the kernel module are in
/path/to/minivosc-src in the VM filesystem, the same directory should exist (and have the same source files) in the host filesystem as well. Also, a debug build should be enabled in the
Makefile for the driver module (and it is so already for
Finally, once freezes are not an issue anymore, one can simply use
printk command throughout the driver module code - no VM image needed; the output of
printk can be found in
/var/log/syslog or
/var/log/messages under Ubuntu 10.04. The
minivosc driver code is by default set with these messages enabled, and they can be followed by running, say,
tail -f /var/log/syslog
in a terminal.
Here are some more resources dealing with debugging the kernel:
- Gnu Debugger & Linux Kernel - Stack Overflow
- Loading symbols when debugging the kernel and kernel modules | Fotis
- Mastering Linux debugging techniques
- Pekka's Blog: kmemcheck: valgrind for the Linux kernel
- Debugging With kmemcheck | KernelTrap
- KGDB in Ubuntu 8.10 - Ubuntu Forums
- Linux Hacks: Setting up kgdb using kvm/qemu
- Kernel parameter: kgdboe
- Merging kdb and kgdb (LWN.net)
- Remote Debugging of Loadable Kernel Modules with kgdb: a Knowledge-based Article for Getting Started | Linux Journal
- Debugging the virtual world.: Configuring application debugging with Record/Replay


text:
The mission of the New York Invasive Species Awareness Week (ISAW) is to promote knowledge and understanding of invasive species and the harm they can cause by engaging citizens in a wide range of activities across the state, and empowering them to take action to help stop the spread. This annual education campaign is comprised of various outreach initiatives and events led by partner organizations statewide. Activities include interpretive hikes, invasive plant removal, and restoration projects, displays, webinars, radio and television programming, and more.
Displaying 1 to 20 of 616Search Help
New York Invasive Species Awareness Week.
A Guide to Integrated Fish Health Management in the Great Lakes Basin: Viral Hemorrhagic Septicemia - Chapter 19 (Jun 2002) (PDF | 26 KB)
Great Lakes Fishery Commission.
See also: Table of Contents for complete document.
Mississippi River Basin Panel on Aquatic Nuisance Species.
Rapid response actions are often complex, costly, and controversial, and therefore advanced planning for rapid response prior to an introduction is crucial. The Mississippi River Basin Panel on AIS (MRBP) has developed this model rapid response plan and supplemental attachments to assist natural resources management agencies effectively plan and quickly implement rapid response actions. In addition to providing information on rapid response planning, the model plan includes a template that can be used by states in developing their own rapid response plans. See also: MRBP Documents for more resources.
Illinois-Indiana Sea Grant College Program.
Much needed attention has been directed at some particularly problematic aquatic invasive species in the Great Lakes, such as Asian carps and zebra and quagga mussels. But others invaders, like crayfish, can also take their toll on the lakes. Illinois-Indiana Sea Grant (IISG) has created a new collaborative that brings together a variety of experts and stakeholders to address the threat of invasive crayfish. The Invasive Crayfish Collaborative (ICC), includes 68 experts and other stakeholders from government agencies, universities, non-profit organizations, and private businesses to combine resources and expertise to address priority invasive crayfish research and outreach needs.
Western Regional Aquaculture Center.
See also: WRAC Extension Publications for more fact sheets.
Adirondack Park Invasive Plant Program.
North Carolina State University. Cooperative Extension.
USDA. FS. Northern Research Station.
Select the non-indigenous forest pest to view maps depicting state and county distribution. Produced by: USDA, FS, Forest Health Protection, and its partners.
USDA. FS. Northern Research Station.
Cornell Laboratory of Ornithology.
Note: Nesting Behavior
USDA. FS. Northern Research Station.
New York State Department of Environmental Conservation.
Cornell University (New York). New York State Agricultural Experiment Station.
Cornell University. Cooperative Extension of Suffolk County. Horticulture Diagnostic Laboratory.
See also: Tree and Shrub Disease for more fact sheets.
University of Wisconsin Sea Grant.
The Aquatic Invaders Attack Pack is filled with materials to help teach groups about Great Lakes aquatic invasive species (AIS), the problems they cause and what can be done about them. Each pack includes preserved specimens of some of the most problematic AIS in the Great Lakes, rugged plastic fact sheets and a classroom guide. Additional materials are available for download.
Oregon Sea Grant.
The materials found here are part of Menace to the West, an educational resource for teachers, informal educators, parents, and students on aquatic invasive species. These materials are designed to teach K-12 students how invasive species can do untold damage when they move to new territory. Kits, resources, and full lessons are available.
Oregon Sea Grant.
Oregon Sea Grant.
Oregon Sea Grant.
Oregon Sea Grant.


text:
Americans United for Life
Americans United for Life protects and defends human life from conception to natural death through vigorous legislative, judicial, and educational efforts.
Tom ShakelyMay 30, 2018
We share 10-12 monthly updates, featuring Americans United for Life News, updates from President & CEO Catherine Glenn Foster, and action alerts. We are powered by Americans of all ages, backgrounds, and beliefs, and we invite you to join us.
We take your trust seriously. Your information will never be shared with others.


text:
Rob Ayling, yer Gonzo Grande Fromage, writes:
Who, why or what is Gonzo? Why are they blogging? and why should you care?
GONZO MULTIMEDIA is a unique record company bringing you a wide variety of products from a number of renowned artists and record labels, largely spanning rock and pop music from the '60s to today, and the Gonzo catalogue includes 100% exclusive products that are unavailable elsewhere.
WE, THE BLOGGERS are a bunch of disaffected music journalists from beyond the lost horizon. And, like it says at the top of the page, we are still crazy enough to think that music is more than a disposable commodity useful to marketing departments across the world.
Do we think that if we chant loud enough we can stop it raining? Quite possibly.
Copyright 2010 The Gonzo Daily.
Theme by WordpressCenter.com.
Blogger Template by Beta Templates.


text:
GROVE CITY — The Midwestern Intermediate Unit IV board accepted the resignation Wednesday night of its executive director, who the board says had unauthorized credit card charges.
The board has ordered a forensic audit of credit card charges made by Cecelia H. Yauger, said Joe Boltz, the Karns City School District representative to the MIU IV, and a member of the board. Yauger had been placed on administrative leave with pay March 27.
"Whatever figure I give you is going to be wrong," Boltz said this morning, declining to share the estimated amount of money involved that the board was told Wednesday from its solicitor, Timothy McNickle, in an executive session.
The executive session followed the MIU IV's annual meeting, which includes the election of 13 board members from 27 school districts in Butler, Lawrence and Mercer counties for three-year terms.
Angelo Pezzuolo of New Castle was appointed as interim executive director, during the search for a new one, Boltz said. Pezzuolo was the executive director of the agency from 1992 to 2007, when Yauger was hired.
MIU IV is based in Grove City, where Yauger lives.
McNickel, who has been investigating Yauger's credit card use, will contact legal authorities in Mercer County, Boltz said.
The MIU IV had no statement this morning.
In Butler County, Butler, Karns City, Mars, Moniteau, Seneca Valley, Slippery Rock and South Butler school districts and the Butler Area Vocational-Technical School are covered by the MIU IV.


text: Art theft is an ancient and complex criminal activity. When you look at the some of the most well-known cases of art thefts in history, you see completely prepared operations that include art dealerships, art fakers, mobsters, ransoms, and millions of dollars. Here you can check out a few https://kurtcriter.wordpress.com/


text:
We're happy to announce our grand prize winners for the final seasons of our FIFA Predictor and FIFA Ultimate Trivia games.
Please sign in to your FIFA.com user account below. This will allow you to make the most of your account with personalization, plus get access to commenting tools, exclusive games, the chance to win cool football prizes and much, much more.


text: At the Office of Disability Adjudication and Review (ODAR) in Hartford, Connecticut, 7 different administrative law judges (ALJ) conduct Social Security Disability (SSD) hearings and Supplemental Security Income (SSI) hearings. Currently, in Hartford, the average wait time for a SSI or SSD hearing is 13.0 months. The average case processing time in Hartford is 375 days.The Hartford average for winning a SSI or SSD disibility hearing is 33%. Click on the name of one of the ALJs below to see detailed information about their hearing results. This information for the Hartford ODAR office was last updated on 6/11/2019.


text:
Hello all! Here at Rock-kitty.net we are in the process of a complete
overhall of the website to include categories and tags to all themes that
are uploaded. Thus at this time we will not upload
any new wordpress themes to the directory but we will continue to collect them.
Our new portal will have - Free Wordpress Themes, Premium Wordpress Themes,
Featured Wordpress Themes and Request Custom Theme options. In addition to that
we will have the section with recommended Wordpress Web Hosting Providers.
Spiration is a fully responsive and clean Multipurpose Magazine and Corporate Style WordPress Theme built on HTML5, CSS3, JS / ...
Xanadu is a minimalistic fab series theme with a unique design and layout feature. Theme theme comes with a photo ...
Fantastic Multi Purpose Wordpress Theme. Premium Theme provided for FREE.
NEW** Bubble thought boxes for comments
NEW** Auto sizing of ...
Fashion blog,
Please download the Help File for Fashion Peal Theme for modification
FashionPeal is a ...