2009年12月28日 星期一

kernel debug Low level

CONFIG_DEBUG_LL
CONFIG_DEBUG_KERNEL

arch/arm/plat-mxc/include/mach/debug-macro.S

add definition:
#define MXC_LL_UART_PADDR UART1_BASE_ADDR
#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)

2009年12月27日 星期日

change VPU_IRAM size

change VPU_IRAM size
it is in arch/arm/plat-mxc/include/mach/mx51.h

2009年12月24日 星期四

desperate housewives season5

[原创] Desperate Housewives第五季学习笔记 欢迎纠错(更新中)

Desperate Housewives Season05 Episode01 "You're Gonna Love Tomorrow"
1.开头语
It will happen to all of us eventually.
The moment will come when we ask ourselves:
"where did the time go?
How did the children I once cradled grow up so very quickly?
How did the life I dreamt of turn into a career I never expected?
And how did that woman I saw each day in the mirror become someone I don't even recognize?"
结束语
It goes by so quickly.
In a flash, the life we knew is gone forever.
And we're left to ask ourselves:
"How could he have left me?
When did my beauty start to fade?
Was I the best mother I could have been?"
Of course, there are some people who understand how quickly time passes,
that's why they're so determined to get what they want before it's too late.
2. I bet they'd have a mrs. Shrek dress that would fit her.
伊甸园字幕组的风格之一是英文名字都保留(一些很著名的除外),这点我很喜欢。
在这里Mrs.Shrek要译成怪物史莱克的太太
3.Just ring it up.
这裙子我要了
ring up在这里不是打电话的意思
ring sth up
to press buttons on a cash register to record how much money is being put inside
 The cashier rang up £300 by mistake.
4.It's the galleys of my new book.
这是我新书的抢鲜版
galley一般是飞机或船上的厨房,这里取如下之意
The pre-publication copies sent to the author for final proofreading or to reviewers for pre-publication reviews.
aalbc.com/writers/publishing_glossary.htm
5.and the big blind...catches a jack on the river
将J压到了河底(赌博语)
庄家左边的第一个玩家叫小盲注SB (small blind),第二个玩家叫大盲注BB (big blind)
6.don't make me pull out the solis family photo album.It's like a bunch of sealions posing on a rock.
用我拿出你们家全家福吗 就像是一群海狮晒太阳(意思是他们全家都很胖)
我觉得译成"别逼我..."比较好.这句挺好玩的。摘录下来。
7.And hot-wiring mccluskey's car-- that was a work of art.
偷偷启动McCluskey的车 这都得叫艺术了吧?
注意第2个C要大写
hot-wire
start (a car engine) without a key by bypassing the ignition interlock; "The woman who lost the car keys had to hot-wire her van"
wordnet.princeton.edu/perl/webwn
朗文当代英语词典中的解释
v [T]
informal to start the engine of a vehicle using the wires of the ignition system, instead of a key
8.Oh, by the way, it wasn't a trombone. It was a tuba.
对了 我吹的不是长号 是大号
有兴趣的去了解下trombone和tuba的区别。
9.Women only have five seconds to be young and beautiful, and then it's gone.and then before you know it,
we're old and fat and married and wondering where our beauty went.
Gaby的话每次都是这么cute^_^ 下面是Carlos的回答 很touching
Nobody knows your face better than I do.and I see it every time I kiss you.In 5 years or 50, you will always be beautiful.
10.I have to say, ladies,this is quite a shindig.
姑娘们 这个聚会好棒啊
shindig热闹喧哗的社交聚会,舞会,大宴会
本主题由 vanjohnbob 于 2009-12-7 10:16 解除高亮
收藏分享评分
回复 引用 订阅 TOP
伊甸园-嘟嘟橙 隆重推出影视周边
钱教授
YTET-伊甸园字幕组

帖子64 精华1 积分0 威望0 点 金钱91 RMB 注册时间2008-10-1 最后登录2009-11-12
沙发
发表于 2009-1-4 20:28 | 只看该作者
Desperate Housewives Season05 Episode02 "We're So Happy You're So Happy"
1. 开头语
Lives change in five years.
Some families grow,while others grow apart.
And we find ways to ease the pain

If there is one thing everyone in suburbia can appreciate...It's a good neighbor.
You know, the kind that helps with the last bag of groceries...
or brings over misplaced mail...
or offers to mow your lawn.
Yes, everyone appreciates a good neighbor.
And no one knew this better than dave williams,
who was determined to be the best neighbor steria lane had ever seen...
assuming, of course, his wife didn't get in the way.
结束语
Yes, everyone appreciates a good neighbor.You know,
the kind that helps you with the groceries...but doesn't ask,"why is your son so moody?"
the type that delivers misplaced mail but doesn't point out your wife seems discontented...
the sort that offers to mow your lawn...but doesn't mention your husband seems cold.
But if you're not sure the man next door is as nice as he would have you believe...
Do everything you can to get to know him better.
2.I don't know. I could check out his friends list on silverfizz.
不知道 我可以查他在Silverfizz上的好友
这里Lynette的儿子们用了Silverfizz,那这究竟是什么东西呢?
Parker回答道什么是Silverfizz:It's like myspace. You have a web page.It shows your hobbies, your favorite music, and you can talk to people.
新鲜的东西每时每刻都在产生Orz...(但这个silverfizz是编辑虚构的)
3.Now it's just a mock-up, but this is what the book is going to look like.
这只是一本样书 但大体上没什么差别
mock-up
a full size model of something, made before the real thing is built, or made for a film, show etc
跟前一集中It's the galleys of my new book的galley差不多意思吧
4.That's preposterous.
简直是强词夺理嘛
preposterous 荒谬的 可笑的
e.g. That's a preposterous accusation!
那样的指责简直荒谬可笑!
5.For starters, you talk to your cat like it's a person.
When I knocked on your door,you immediately invited me in.
Doesn't take a genius to see that you're lonely.
Edie的新丈夫Dave对Mrs. Mccluskey一语中的的评价
6.Sorry. I just had to rip the band-aid off.
对不起 我不得不把话讲明
7.I really think the end justifies the means here.
我觉得只要目的正确 可以不择手段
8.I have to knock her socks off
我得让她刮目相看
9. 00:31:17,330 --> 00:31:19,230
Just shakin' the dew off the lily.
只是出恭了下
And speaking of,that paint
job in the guest can is nice. Kudos
说来 客用洗手间的漆刷得不赖 赞个
现在依然搞不懂shake the dew off the lily为什么是出恭的意思(但当时剧情确实是Susan前夫用了一下洗手间)
另外can作为洗手间这个意思有点少见
10.and I guess I lost track of time talking to crunchy granola here.
然后就和那位环保人士聊得忘了时间
crunchy granola 可以去urban上查,这句当时理解也有点偏差。
11.We have lost nothing that matters.
We have a home,we have each other,we have work that supports us,
and we have two beautiful little girls that...love us more than ice cream.
I've never been happier in my life.The only thing that will make me happier is for you to realise how good we've got it.
Carlos对Gaby说的话。
回复 引用 TOP
钱教授
YTET-伊甸园字幕组

帖子64 精华1 积分0 威望0 点 金钱91 RMB 注册时间2008-10-1 最后登录2009-11-12
板凳
发表于 2009-1-4 20:33 | 只看该作者
Desperate Housewives Season05 Episode03 "Kids Ain't Like Everybody Else"
1.Danielle! What a delightfully ethnic ensemble
Danielle 家庭大团圆 多喜庆啊
这句话我们组的翻译是错误的。
emsemble有如下含义
a small group of musicians, actors, or dancers who perform together regularly
a set of things that go together to form a whole
a set of clothes that are worn together
Emsemble在这里应该是第三种解释。 整句应该翻译成: Daniel,多么漂亮的民族服饰阿!
有兴趣的同学可以再去看一下这集里Daniel当时穿的衣服,确实是民族服饰,这里我就不上图了,嫌麻烦。
2.That's the second time this week. Is someone picking on you?
这星期第二次了 有人在欺负你吗?
pick on有“挑选,选中”的意思,但一般而言这种被“临幸”的选中都是不幸的。
It means: To bully or make fun of a victim; to bother or harass
比如Why pick on me every time?
为什么每次都怪我?
The God of Thunder strikes the beancurd; bullies pick on the soft and weak.
雷公打豆腐,拣软的欺。
Why do they always pick on me to do the washing-up?
为什么他们总是挑我洗碗碟?
所以pick on是个不幸的词,有“找...麻烦,找...岔子,欺负...”的意思
3.So I'm prepared to knock a grand off. What do you say?
所以我给你便宜1000块 怎么样?
这个grand俚语中是“一千美元”的意思,虽然以前就知道了,但还是记一下,加深印象么。
grand还有其它意思 比如:雄伟的;堂皇的;盛大的
He lives in a grand house.
他住在一栋富丽堂皇的房子里
以及这个...全部的,总的[Z][B]
I spent a grand total of $150.
我总共花了一百五十美元。
4.Oh, come on. It's already priced way below blue book, not to mention it's mint.
拜托 这价格已经超低了 而且这车毫无划痕呢
blue book在这是什么意思呢?
blue book
- a book with a list of prices that you can expect to pay for any used car
- a book with a blue cover that is used in American colleges for writing answers to examination questions
显然这里明显是第一个含义
另外mint除了有“薄荷a box of mints”,“造币厂The Mint has decided to issue the coins next year.”等基本意思外,
还有“崭新的;无污损的;完美的”的意思。
The book was still in mint condition.
这本书仍然像新的一样。
5.Oh, believe me, if he served time, it was in the state pen.
相信我 就算他服役 也是在州立监狱
学了这么多年英语今天还真是第一次见到pen有“监狱(俚语)”的意思,挺好玩的是吧(08年11月11日补充:估计是 penitentiary的缩写,在Prison BreakS4E10中听到这个词的)
pen还有这个意思:(关禽,畜的)栏,圈;一栏家畜
The dog chased the sheep into the pen.
狗追赶羊入栏
或者做动词用“ 把(家畜)关入围栏;把...关起来”“囚禁”。
6.Like a charm. And thanks again.
好用得很 再次谢谢你
like a charm
ad. 效验发神地(异常成功地)
Those new pills you gave me worked like a charm.
你给我的那些新药丸真是药到病除.
act like a charm
立见奇效
7.Because I'm telling ya, this guy is up to something.
我肯定地告诉你 这家伙一定另有隐情
be up to something 贬义词
I heard you two whispering so I know you must be up to something.
我听见你们俩嘀嘀咕咕的就知道没做什么好事。
I know she must be up to something.
我知道她一定是有所企图才会这么做的.
8.
00:12:52,030 --> 00:12:56,960
Gaby:Since your mom and I are dear friends, I'll
take it off your hands if you knock off $300.
Gaby:看在你妈和我是好朋友的份上 只要你降300块 我就要
00:12:56,990 --> 00:13:02,260
Andrew:And since my mom and you are dear friends,
I'll resist the urge to flip you the bird.
Andrew:我也是看在你俩交情的份上 才忍住不对你比中指的
LOL,这句对白实在太好笑了。Gaby卖了跑车买旧车,唉,落魄到这种地步啊
flip off [flip sb off]
also flip sb the bird 这就是比中指(hoho)
to make a rude sign at someone by lifting up your middle finger and keeping your other fingers down
9.Curse you and your diabolical checkers prowess
诅咒你和你邪恶的跳棋魔力
diabolical 恶魔的(刻毒的而且残忍的)=wicked=cruel=fiendish
checkers国际跳棋,西洋棋,又作draughts
prowess 勇敢(在战场上英勇过人的力量、勇气),超凡技术
10.And by the way, mark your calendars,'cause seven years from next saturday--benjamin's bar mitzvah.
顺便说一句 在你的台历上做个记号 因为七年后的下周六...是Benjamin的犹太成人礼。
bar mitzvah
受诫礼 [Bar Mitzvah]
犹太人庆祝男子满13周岁和成为犹太教徒的典礼。通常在安息日做礼拜时举行,男孩诵读托拉,还要解释一段经文。仪式后的当天或次日通常举办喜庆式的圣日前夕祝祷和家庭晚宴。
1810年后犹太教改革派坚振礼(为男女少年举办)取代受诫礼,但在20世纪许多会堂又恢复受诫礼。改革派和保守派犹太教都有一种单独为及龄女子举行的女受诫礼。
11. 00:17:19,120 --> 00:17:21,470
Those of us with hearing beg to differ.
听到这话的人可不这么想
这句话感觉有点不妥(个人意见)。Tom想玩Bass,搞garage band,说不定get, like, a couple of gigs.
他说I mean, if I wanna play bass, I will play bass.I'm not hurting anybody.
然后Lynette回了这句Those of us with hearing beg to differ
我想应该是她是嫌Tom玩bass弄得太难听吧:“有听力的人都不敢苟同吧”
另beg to differ的意思是“恕不同意(对不起,本人有不同意见)”。
12.You sold me a lemon.
你卖给了我一个破烂货
这里lemon可不是柠檬的意思,而是:
【俚】令人讨厌的人(或物);瑕疵品;无价值的东西[C]
That Chevy was a real lemon; it was fixed more often than it was driven.
那辆雪佛莱车真是部破车,进厂修理的时间比开车的时间还长。
Their new car turned out to be a lemon.
他们的新车根本就是劣货。
13.It doesn't matter. If it wears a skirt, it's off-limits.
这无所谓啊 只要是女孩儿 就有违原则
这句话挺有意思的,故记下
off-limits禁止进入的;禁区的
14.Couple of wusses. I'll handle it myself.
真是优柔寡断 我自己搞定好了
wuss 犹豫不定的,软弱无用的人(俚语)
15.A man gets to a certain age,and he realizes he's gonna die someday.
Really die.And what's worse is that he's everything he's ever gonna be.
He's never gonna be rich.He's never gonna climb a mountain.
Now some guys do bad things when they get those thoughts in their heads.
By comparison,playing in a garage band...well...it seems pretty harmless.
这段话挺好的,所以摘录下来,Dave说的(他自己是不是some guys who do bad things呢?)
16.That's how he ended up at the E.P.A.
所以他最后进了环保局
E.P.A. ---the Environmental Protection Agency环保局
-- 英汉 - 辞典例句
Government agencies include, for example, the Environmental Protection Agency (EPA), the Consumer Products Safety Commission, the Federal Trade Commission, and the National Labor Relations Board.
政府机构包括,例如,环保局(epa),消费产品安全委员会,联邦商务委员会及国家劳动关系局。
还想到了在Weeds(单身独妈)里看到的Drug Enforcement Administration (美国)(司法部)药品管理局,禁药取缔机构
17.I always wished that I'd gone to a school like cornell.
But...it just wasn't in the cards for me.
我对康奈尔这样的牛校一直很向往 但是 那对我来说不太可能
be on the cards
BrE be in the cards
AmE to seem likely to happen
 At 3-1 down, another defeat seemed to be on the cards.
18. 00:34:09,290 --> 00:34:11,300
We should rumble all the time.
我们该一直"斗"志昂扬
19.Well,I've apologized till I'm blue in the face,but they're still leaving in the morning.
我已费尽口舌地道歉了 他们还是执意明早就走
argue/talk etc till you're blue in the face (informal)
to argue, talk etc about something a lot, but without achieving what you want
 You can tell them till you're blue in the face, but they'll still do what they want.
20.Our policy lapsed.Hope you'got good coverage.
我的保单失效了 希望你的能赔付很多哦

这集的开头语和结束语没有摘录,是觉得写作文时应该用不到,都不是太深刻的话-_-
回复 引用 TOP
钱教授
YTET-伊甸园字幕组

帖子64 精华1 积分0 威望0 点 金钱91 RMB 注册时间2008-10-1 最后登录2009-11-12
地板
发表于 2009-1-4 20:37 | 只看该作者
Desperate Housewives Season05 Episode04 "Back in Business"
1.开头语:
If you look closely into the faces of your friends, You'll see it.
Right behind their smiles, You will see a certain Green-eyed monster,
And then you'll understand How envious they are of your well-kept home...
Your delious recipes...And your tasteful possessions
But you'll have to work hard to see the jealousy,
Because good friends always work hard To hide it.
结束语:
If you look closely into the faces of those around you,
You will catch a glimpse of a certain Green-eyed monster.
And then you'll see they envy your career...your love life...the Time you spend with their child...
How do you deal with such jealousy?There are many ways.
But the best...is to simply share what you have.
2.00:04:49,840 --> 00:04:52,860
I'm just grabbing a kiss on my way to the Salt mines.
我只是去上班前来亲亲我的妻子
the Salt mines这里可不能理解为"盐矿",应该是泛指一切累人的事情(也不一定是工作,也可能是上学-_-LOL)
back to the salt mines
又要(像盐矿工作那样)辛苦一番了;返回工作岗位;重新回去做繁重工作,重操旧业
3.00:14:44,030 --> 00:14:47,260
I may be persona non grata at every company in this town,
这个城市的每家公司可能都不要我
persona non grata 不受欢迎的人(拉丁语)
在国际公法词典中,第7章外交与领事关系法,也出现了
persona non grata 不受欢迎的人,为了保障接受国的利益,防止外交特权与豁免和领事特权与豁免被滥用,《维也纳外交关系公约》和《维也纳领事关系公约》规定了宣告使馆外交人员和领馆领事官员为“不受欢迎的人”这种程序,且无须说明不同意的理由。遇此情形,派遣国应酌情召回或终止其馆员职务。《关键词》-128
链接 http://z5903093.fyfz.cn/blog/z5903093/index.aspx?blogid=182579
发现这个blog叫"执国际法牛耳",顺便来了解一下"执牛耳"的意思吧
词目 执牛耳
释义 古代诸侯订立盟约,要割牛耳歃血,由主盟国的代表拿着盛牛耳朵的盘子。故称主盟国为执牛耳。后泛指在某一方面居最有权威的地位。
出处 《左传·哀公十七年》:“诸侯盟,谁执牛耳?”
4.00:18:41,000 --> 00:18:42,310
Oh,he'll probably have to take a few spills
他可能会摔个几跤
spill的常见意思是"溢出;溅出"如那句很常见的习语Don't cry over spilt milk.
Don't cry over spilt milk;Things done can not be undone
覆水难收;木已成舟
spill还有泄漏秘密的意思:I wonder who spilled out the information.
而在这里spill是"摔跤,跌下"的意思,如I saw the motorcycle skid and its rider spill in dust.
我看到摩托车打滑,骑车人跌落在地。
当然,下面这种情况也可以用spill
(价格的)骤降,暴跌
Stocks took a sharp spill in today's trading.
股票在今天的交易中猛跌。
5.00:23:22,470 --> 00:23:24,100
Whoops-a-daisy!
大事不妙啊!
我个人认为这里译为"大事不妙啊"有点过了,MJ摔倒只是个minor accident,没必要这么夸张,但是若考虑到Suan喜欢一惊一乍的性格,这里译为"大事不妙"也为尝不可。
我查的是 http://www.urbandictionary.com/define.php?term=Whoopsy+daisy
其中解释为Used to express acknowledgement of a minor accident, blunder, or mistake.
"Whoospy daisy,I nearly killed myself!"
DH中这个whoops-a-daisy我是在wiktionary查了下,其解释为acknowledging a mistake.(感觉没有urban的解释好)
http://en.wiktionary.org/wiki/whoops-a-daisy
最后作下总结就是Whoops-a-daisy或Whoopsy daisy可以等同于oops/whoops了,常用于出现小小意外或失误后的一种感叹。(但好像都是女性才这么说)
6.00:30:50,260 --> 00:30:52,150
Wow,whoever did this really went to town.
天啊 这个捣蛋鬼还真是过分
really go to town这里可不是"进城"的意思,看了下面几例,相信就会理解这个短语意思了,以及何时何地能使用它
I can really go to town on everything.
我真的凡事都做得很快。
The critic really go to town on his latest film
影评界把他最新的电影数落个够
When you make a complain you don't spare their feelings, do you?You really go to town!
你提意见时不管别人情绪的,对吗?你真是无所顾忌!
7.00:31:00,000 --> 00:31:03,150
I appreciate the offer, But I'm really stretched thin these days.
多谢你们的邀请 但是我最近实在很忙
这里有个be stretched (too) thin,很有趣的短语。
be stretched too thin:When something is stretched too thin, it is unbearable or uncomfortable. Stretch too thin is also said of a person who tries to do many things at the same time and cannot give enought time or attention to any of them
I'm burdened with my solitude, stretched too thin to bear.
I realized I've been spreading myself too thin, so I resigned as secretary of the golf club
8.00:32:14,290 --> 00:32:19,410
He would schlep All the way across town Just to get me my chinese food.
为了帮我买份中餐 他跑遍了好几条大街
00:32:52,640 --> 00:32:55,930
You know,of course,we're across town, So it May be a bit of a schlep.
不过我们的地方在另一头 距离有点远
两次出现了schlep这个词,不得不学习下这个生词了。
schlep:拖曳, 缓慢费力地行进(动词)
遥远的路程,笨蛋(名词)
9.Bree在这集中有段话很发人深省:
Everything I gain comes at some horrible price,
And I'm starting to wonder if any of it's even worth it.
Lynette的回答同样让人唏嘘不已:
You're at the start of an incredible journey,
and I am going to be there every step of the way, cheering you on,
telling anyone who will listen that the Bree Van De Kamp is my friend.
...Just know that all your friends are very proud of you.Bitterly jealous,but proud.
10.00:38:03,810 --> 00:38:09,550
The man who is silent in his good deeds is the man who reaps the greatest reward.
无私奉献 默默无闻 苍天有眼 善恶有报
这句话的翻译我总感觉不是那么好。先放在这吧。---这集里说到karma(因果报应,缘分,命运),Eddie的新老公Dave就来了句这段话。挺好的一句话,但出于这个人口中,不禁寒意阵阵,真不知道他和Mike有什么过节,来紫藤街究竟出于何种原因。
Let's wait and see what transpires.
回复 引用 TOP
钱教授
YTET-伊甸园字幕组

帖子64 精华1 积分0 威望0 点 金钱91 RMB 注册时间2008-10-1 最后登录2009-11-12
5#
发表于 2009-1-4 20:43 | 只看该作者
Desperate Housewives Season05 Episode05 "Mirror,Mirror"
1.00:04:37,800 --> 00:04:40,830
Nobody likes a fickle god.
没人喜欢善变的上帝
Gaby说的一句话,觉得挺有趣的。
00:34:12,020 --> 00:34:15,110
Halle-damn-lujah,I got my period!
老天保佑 我的"大姨妈"来了
Gaby在hallelujah之间加了个damn,真是有趣。Gaby遣词造句都很幽默啊。这种幽默比Susan那种"马大哈"好多了。
2.00:15:26,190 --> 00:15:32,870
Yes, but daddy's gonna live to a ripe old age unless he doesn't get home in time for mrs. Mccluskey's party
and then all bets are off.
对 但爸爸会尽享天年的 除非他有胆晚归耽误McCluskey太太的派对 那可就说不准了
live to a ripe old age活到很高年岁,长命百岁
all bets are off:后果将不可料,什么事情都有可能发生
3.00:16:10,170 --> 00:16:13,760
He administered C.P.R. until the ambulance got there.
救护车来前 一直在给他做心肺复苏
cardiopulmonary resuscitation(CPR) 不知道是在翻译Grey's Anatomy还是在翻译Private Practice时遇见过一次,这次把它记下来。
心肺复苏(CPR)是针对呼吸心跳停止的急症危重病人所采取的抢救关键措施,即胸外按压形成暂时的人工循环并恢复的自主搏动,采用人工呼吸代替自主呼吸,快速电除颤转复心室颤动,以及尽早使用血管活性药物来重新恢复自主循环的急救技术。心肺复苏的目的是开放气道、重建呼吸和循环。人们只有充分了解心肺复苏的知识并接受过此方面的训练后才可以为他人实施心肺复苏。
  心肺复苏 = (清理呼吸道) + 人工呼吸 + 胸外按压 + 后续的专业用药
Cardiac resuscitation心脏复苏 另外还查到了这个,不知道和CPR有什么区别,记在这,希望某天有个学医的来解释下。
4.00:19:00,050 --> 00:19:01,410
An R.V.Might be overkill.
房车就小题大做了
“RV”,Rving,旅行房车。用房车旅行,随意停靠在远离城市的沙滩、湖岸、草地、山坡、森林中,同时又拥有城市的生活方式:自己做可口的饭菜、洗个热腾腾的澡、睡柔软舒服的床、看电视、听音乐、放DVD……
现代房车的标志之一是豪华和舒适,但它的雏形却是吉普塞人的大篷车,在欧洲,旅居房车被叫做:caravan,说是大篷车的意思。一次世界大战末,美国人把帐篷、床、厨房设备等加到了家用轿车上。(这或许就是房车雏形吧)
另外还查到RV:RV的全称是Recreati&a Vehicle,.即休闲车,是一种适用于娱乐、休闲、旅行的汽车,首先提出RV汽车概念的国家是日本。RV的覆盖范围比较广泛,没有严格的范畴。从广义上讲,除了轿车和跑车外的轻型乘用车,都可归属于RV。MPV及SUV也同属RV。
但在剧情中应该是房车了。
5.00:21:00,960 --> 00:21:04,820
Well... another dead soldier.
呃 又喝空了一瓶
这句话要结合剧情看,光看字面意思你是怎么也想不到和“喝酒”有什么联系的。
有兴趣的同学可以再回头去看看,我就不上图了。
我也在http://en.wiktionary.org/wiki/dead_soldier查到了这个短语确实有这么一个意思,如下,挺有趣的:
dead soldier (plural dead soldiers)slang) An empty container, usually a bottle or can which contained an alcoholic beverage.
例:When my mother drinks beer, she peeks in the bottle to make sure it's a dead soldier.
6.Bree在"My husband's gone. My son's gone. I have nothing left."的情况下一蹶不振,酗酒度日。
Katherine这么劝慰她:
Okay, so you have a void in your life. Welcome to the club.
Don't fill it with wine.Fill it with work, with accomplishments.
生活就该如此,不能自怨自艾,自暴自弃,无论遇到什么困难,都要打起精神来,该干什么就干什么,哪怕像疯子一样工作,像呆子一样学习,填满自己的生活,这样就不会觉得空虚了。而最终,那段低迷的时光会随着时间的流逝而黯然失色的。
7.00:25:47,570 --> 00:25:53,950
the party was in full swing, and everyone was waiting to surprise the guest of honor.
聚会正在紧锣密鼓的筹备 大家等着给主宾惊喜
in full swing活跃(正在全力进行)proceeding with full vigor;
8.00:26:49,400 --> 00:26:53,690
Prying is what people too old to have sex do to keep life interesting.
对于上了年岁的老人 八卦是唯一乐趣了
Eddie说的一句话,虽然有点不雅,但我个人认为挺有趣的。
9.Lynette和Tom的一段对话,感觉自己有时候挺像Tom的,恩,不好不好,得改掉。
Lynette: You want your life to count or something.
Tom: Exactly. I just don't want to keep making pizzas every day till I drop to the floor for real.
I want my life to be exciting.You know, I need adventure.
Lynette: Scavo's was the adventure.We changed our whole lives so you could live out your dream, and now you're bored.
We can't keep doing this, tom.We can't keep throwing all the cards up in the air every time you get a little restless.
Lynette: 你希望自己的生活更有价值
Tom: 完全正确 我不想成天做披萨 直到真的翘辫子 我想让生活激动人心 想要冒险
Lynette: 披萨店本来就是冒险 为了让你实现梦想 我们整个生活都变了 现在你玩够了 我们不能总这样 Tom 不能每次你一有什么想法 就全部重新洗牌
回复 引用 TOP
钱教授
YTET-伊甸园字幕组

帖子64 精华1 积分0 威望0 点 金钱91 RMB 注册时间2008-10-1 最后登录2009-11-12
6#
发表于 2009-1-4 20:45 | 只看该作者
Desperate Housewives Season05 Episode06 "There's Always a Woman"
这集DH让我想到了adidas的戏称:all day i dream about sex = adidas
没错,在S5EP6中,It's almost everything to do with sex.
Carlos的"马杀鸡"让Mrs. Virginia达到了orgasm;
Jackson刚和Susan分手就和另一个女的搭上了;
Katherine在Bree这个matchmaker的成全下成就了一段one night stand,估计又要和Mike擦出火花;
而Lynette的儿子Porter竟然和自己母亲差不多年纪的女人Anne Schilling有了一段relationship...
这些老外编剧的脑中果然都是sex啊,DH搞得都快和Grey's Anatomy有一拼了...
因为最近比较忙,这集看得不是太仔细。收录几条笔记如下:
1.开头语:
There are dangerous women in this world...
devious predators waiting to strike.
You can spot them by the lipstick they use,
the shoes they wear and the perfume they choose.
But the easiest way to spot a dangerous
woman is to see how she behaves with another woman's husband.
结束语:
There are dangerous women in this world.
Some are lovers, blind to the consequences of their actions.
some are wives enraged by the betrayal of those they trusted.
others are predators, deviously setting traps to get what they want.
If you're unlucky enough to come upon one of these dangerous creatures,
the safest thing to do is run the other way.
这次开头部分是我翻的,关于dangerous women那个部分我刚开始译为“危险的女人”,后来定为“坏女人”,现在看了看,与后面结束语链接起来的话还是“危险的女人”比较好。
坏女人是因为那个Anne Schilling出场的坏印象让我先入为主了,有点断章取义。在此检讨一下。不过结束语翻译得还挺不错的。
2.00:10:49,910 --> 00:10:51,980
Those must've set you back a chunk.
这花了你不少银子吧
chunk:又短又厚的块状物(如肉、木头等);相当大的数量;矮胖结实的人
a good chunk of time
大量时间
3.00:13:39,060 --> 00:13:42,550
Oh, wait a minute. Is this a setup? Because I loathe blind dates.
等等 你不是在安排我们约会吧?
我可最恨"相亲"了
blind date由第三方安排的)男女间初次见面,即相亲
朗文解释:an arranged meeting between a man and woman who have not met each other before
再补2个相关的:
Speed dating 很多人在一起的那种相亲,每对交谈的时间很短
Gold diggers 钓金龟婿的那种人(不是专指女的,指的就是只看重对方钱财的人)
4.00:18:38,250 --> 00:18:40,440
- neat or rocks?
- Rocks.
- 纯的还是加冰?
- 加冰
对酒类文化不是很了解,看到这个还挺新鲜的,记录下来。
neat除了有整洁整齐的意思外,还有“纯净的;不掺水的”的意思,下面2例:
He likes his whisky neat.
他喜欢纯威士忌酒。
He drinks his brandy neat.
他喝白兰地不掺水。
另外还有这个意思【美】【口】美妙的,很棒的
The party was really neat -- we had good fun.
这次聚会真是美妙极了--我们玩得非常开心。
------------rocks------------
scotch/vodka etc on the rocks (informal)
an alcoholic drink that is served with ice but no water
加冰块的威士忌等
5.00:25:20,870 --> 00:25:25,280
Yeah, I have been married twice,and both times that's imploded,
我结过两次婚 两次都很失败
00:25:25,290 --> 00:25:30,240
so really, I feel like...love is not my friend.
所以我感觉...我和爱情没缘分
Love is not my friend.喜欢这句话---所以写下来了。
回复 引用 TOP
钱教授
YTET-伊甸园字幕组

帖子64 精华1 积分0 威望0 点 金钱91 RMB 注册时间2008-10-1 最后登录2009-11-12
7#
发表于 2009-1-4 20:50 | 只看该作者
Desperate Housewives Season05 Episode07 "What More Do I Need"
1.开头语:
Desire...It's an emotion designed to lead us astray,
causing us to buy things we can't afford...
encouraging us to sample desserts we don't need...
and pushing us into love affairs we're clearly not ready for.
结束语:
Desire...it's an emotion designed to lead us astray,
persuading those who crave love to make foolish choices...
causing those who yearn for family to act out in anger...
allowing those who are lonely to behave in reckless ways.
And when the pursuit of our heart's desire becomes an obsession,
the best we can hope for is a caring friend willing to come along...and stop us
2.一些词组和单词
false alarm:虚惊一场
phlegm(痰):How do you pronounce p-h-l-e-g-m? Look up `phlegm' in the dictionary if you don't know.
这个单词是生活中比较常见的单词,同时也是发音比较不常见的单词。
另外它还有"迟钝,冷漠,冷静的"的意思(dated or fml旧或文)---不怎么常见,给个例子吧:
show considerable phlegm in facing the crisis 面对危机表现得相当冷静.
00:26:08,420 --> 00:26:11,180
So...carte blanche?
那...全权交给我了?
carte blanche:[律]全权委托, 署名空白纸(任人填写条件等)
“Carte Blanche”最早来源于法语,它的本意是“空白的纸”。
  到了17世纪第一次出现在英语中时是作为军事术语来使用,当战败方无条件投降后会递交一个协议给战胜方,协议是一张白纸,上面只有战败方司令官的签名,这意味着战胜方可以随意的填写条件,也就是“署名空白纸”的意思。
  到了18世纪,“Carte Blanche”一词的含义已不在局限于只是“署名空白纸”,而慢慢演绎为“全权委托”的词义。
3.00:05:59,140 --> 00:06:01,120
Yeah,like pot dealers give receipts.
有 你以为毒贩子给发票啊
00:06:15,440 --> 00:06:17,440
A thief and a pothead!
既是小偷又是瘾君子!
pot的常规意思显然大家都知道,但这里作为slang它的意思是大麻
pothead 吸食大麻者 瘾君子
看到"大麻"我又想起Weeds(单身毒妈)了,真的很好看的一部剧集。不知道为什么吸食大麻在美国为什么是如此普遍的现象,抓得好像也不严格。
百度了一下"大麻 美国":
美国的毒品问题,说穿了,就是大麻问题。根据美国国家毒品滥用问题研究所1979年的调查,12岁到17岁的少年中,用过大麻的占31%,而用过海洛因的只占5%;18岁到25岁的青年中,用大麻的占68%,而用过海洛因的只占4%;26岁以上的成年人中,用大麻的占20%,用过海洛因的仅占1%。这充分说明,大麻类问题要比鸦片类问题严重得多。其主要原因大概有两点:其一,大麻比海洛因便宜易得,可以自己栽种,制作也不复杂,大麻叶就像烟叶一样,揉碎了卷在纸中就能抽;其二,大麻不产生严重的戒断症,即用过大麻以后可以较为容易地戒掉。

70年代,尼克松签署的《综合性药物滥用预防与控制法》把大麻列入了最危险的毒品类。持有大麻最低要判罚5000元美金与一年徒刑,贩卖大麻则要重判二年以上以至无期徒刑。但是,大麻成瘾究竟算不算是犯罪,至今仍然是有争议的问题。

现在,美国已有十几个州减轻了拥有大麻罪的刑罚。有的西方国家如荷兰,大麻可以公开买卖。走得更远的如美国阿拉斯加州在1975年已经通过法律,允许私人自种自用大麻,认为这是合理的“隐私权”。据加利福尼亚州法院1977年的报告,加利福尼亚州放宽执行大麻法,仅6个月就减省执法费用740万美元。

大麻在美国禁止的前景如何,这是一个人们普遍关心的问题。有的学者预言,大麻管制的历史很可能会重演酒精管制的历史,令不行,禁不止,不了了之。

摘自《恶之花——毒品世界探寻》 徐鸿宾王容花著 中国人民大学出版社出版
4.00:06:32,660 --> 00:06:36,670
Ah,well... we needed to wipe the slate clean,right?
呃 我们都要放下以前的情债 是吧?
wipe the slate clean:勾销往事(即往不咎) 下为2例:
Let's wipe the slate clean and forget our past quarrels.
让我们捐弃前嫌,忘却过去的争吵吧
Once you have served your sentence you can wipe the slate clean and start a new life.
你刑满以后,你就可对过去的事一笔勾销,重新做人。
5.00:10:28,810 --> 00:10:33,470
oh,lap of luxury,how I've missed sitting in you.
奢侈的生活啊 真怀念享受的日子啊
这句话是我翻的,写这个笔记的时候我特别去射手看了下,风软字幕组将这句话翻为"噢 这么好的天气 坐在这真舒服",首发字幕组翻为"豪华泳池坐垫 我真怀念坐在你上面的感觉"
lap of luxury:奢侈的生活
She was brought up in the lap of luxury.
她从小养尊处优。
6.00:15:30,530 --> 00:15:35,630
And so that's when I got caught stuffing at the pep rally.
所以我被撞见在比赛前往胸里塞填充物
胸里最好改为胸部,往胸里填感觉有点奇怪
pep rallyAmE) a meeting at a school before a sports event, when cheerleaders lead the students in encouraging their team to win
鼓劲会 (赛前)士气动员会
7.00:17:25,650 --> 00:17:31,090
so before we wrap up here,we still need some chaperones for the junior prom.
今天结束前 选一下年度舞会的监护人
warp up:完成,结束;穿暖和的衣服:In cold weather you should wrap up well.天气寒冷时,你应该穿得暖和些。 chaperone:an older woman in the past who went out with a young unmarried woman on social occasions and was responsible for her behaviour
AmE someone, usually a parent or teacher, who is responsible for young people on social occasions 有女伴,监护人的意思
8.00:19:37,120 --> 00:19:39,100
her father,who's mormon. 就是她父亲 还是魔门教徒呢
mormon:摩门教徒,一夫多妻主义者
Mormons are a religious group founded in USA in 1830.
摩门教派是1830年在美国成立的一个宗教团体。
耶稣基督末世圣徒教会成员或是与其密切相关的教派(如耶稣基督末世圣徒改组教会)教徒。由史密斯创建,他自称见到了一位天使,天使告诉他写有上帝启示的金页片在什么地方,1830年他将这些页片上的铭文编成《摩门经》史密斯及其教徒既接受《圣经》,也接受《摩门经》,但却和正统的基督教大相径庭,尤其是他们认为神是从人变来,人可以成神。其他独特的教义包括相信人的灵魂在生前已存在,等待出生;经过有追溯力的洗礼使死者获救赎。这个教派因实行多偶婚制而臭名昭著,尽管1852~1890年官方禁止实行一夫多妻制。史密斯和其教徒从纽约的帕尔迈拉迁移到俄亥俄州、密苏里州,最后到达伊利诺伊州。1844年史密斯被暴徒杀害。1846~1847年在扬的领导下,摩门教徒长途跋涉1,800千米达到犹他州,建立了盐湖城。如今该宗教在全球有近1,000万名教徒,所有的男性成员都必须进行两年的传教工作,因此教徒人数不断增多。摩门教徒期望在美国建立神国,接受耶稣的亲自统治。
有关摩门教在 http://sfile.ydy.com/bbs/viewthr ... &extra=page%3D1 有讨论,有兴趣的可以去看看。
这个单词跟moron(低能者,笨蛋)长得比较像。(呵呵)
9.
00:29:15,930 --> 00:29:17,980
Jackson,look at me.
Jackson 看看我
00:29:18,010 --> 00:29:18,810
I'm tipsy.
我酩酊大醉
00:29:18,850 --> 00:29:19,690
I'm horny.
性感可人
00:29:19,710 --> 00:29:22,700
I'm easier than a 5-year-old's homework.
我比五岁小孩的家庭作业还好"做"
我本来是冲着最后一句话记下来的,觉得Susan这句话特别好玩(比五岁小孩的家庭作业还好"做")
后来发现了一个问题tipsy这个单词在这里译为"酩酊大醉"不妥(可能我们的小翻在i'm tipsy,i'm horny都想用四字短语的缘故吧),因为tipsy是"slightly drunk"的意思,只能算是"微醉"。
10.00:32:11,570 --> 00:32:12,610
Humor me.
那你们就不知道了
这句话的翻译,我个人感觉挺奇怪的,想不通,就记在这里了。
上下文是:
00:32:06,160 --> 00:32:09,090
Actually,you may want to watch it first.(Andrew)
00:32:09,160 --> 00:32:11,560
Why? I embarrassed enough as it is.(Bree)
00:32:11,570 --> 00:32:12,610
Humor me.(Andrew)
00:32:12,640 --> 00:32:13,270
I'll cue it up.(Andrew)
我觉得这里应该译为"给我个面子吧",如同"do me a favour”
或者"迁就我看一下吧"。http://www.urbandictionary.com/define.php?term=humor+me urban也有解释,可以看看。
回复 引用 TOP
钱教授
YTET-伊甸园字幕组

帖子64 精华1 积分0 威望0 点 金钱91 RMB 注册时间2008-10-1 最后登录2009-11-12
8#
发表于 2009-1-4 20:51 | 只看该作者
Desperate Housewives Season05 Episode08 "City on Fire"
1.00:05:43,630 --> 00:05:46,920
Right,and in exchange, when she finally kicks the bucket, we wind up with a lamp.
好吧 作为交换 哪天她翘辫子了 我们就能得个灯
kick the bucket:一命呜呼,死了
2.00:06:37,630 --> 00:06:40,900
Oh,my gosh,andrew. Don't you look sharp today?
哦天啊 Andrew 你今天看起来真帅
00:07:22,050 --> 00:07:25,230
What a sharp outfit.
衣服真是漂亮啊
Bree在这集里两次用了sharp来夸别人,虽然这个用法早有耳闻,但还是记下来加深印象吧。
sharp【口】时髦的,漂亮的
Uncle George's new car is really sharp.
乔治叔叔的新车实在设计优美。
You really look sharp in that new outfit.
你穿那套衣服看起来很帅。
3.I went online and pulled a bunch of her articles,
and a lot of them are complete hatchet jobs.
我上网下载了一些她的文章 很多都是纯粹的诽谤
hatchet job:恶毒攻击, 诽谤
Two newspapers did avery effective hatchet job on the Prime Minister's achievements.
有两家报纸对首相的成就极尽诋毁之能事.
4.00:09:25,950 --> 00:09:28,510
I'm gonna cut to the chase, Dave.
我就不和你兜圈子了 Dave
cut to the case 开门见山
Let's cut to the chase.
我们开门见山吧(言归正传)。
类似的有:get to the point,come straight to the point,talk turkey
5.00:11:30,410 --> 00:11:32,630
- Did someone throw rice at you?
- Yeah.
- 你们举办婚礼了吗?
- 举办了
Why do people throw rice or birdseed as a newly married couple leaves the church?
Throwing things at a newly married couple is a very old tradition that may date back to ancient Rome or Egypt or even further back. The custom is intended to give newlyweds good luck, and most of the items thrown at the couple represent fertility and abundance.

Food has always been a popular choice because it symbolizes plentiful crops. Seeds and nuts symbolize fertility because a little seed may grow into a big plant, an appropriate sentiment for a newly married couple. Grains such as wheat and rice were thrown over the newlyweds in the hopes that the couple would be prosperous and have many children to work the land.

While tossing rice became most popular in America, many countries have their own traditions. In Morocco, figs, dates, and raisins are thrown to encourage a "fruitful" union. Italians traditionally shower the newlyweds with sweets and sugarcoated nuts. (The word "confetti" may derive from the root for the Italian word for "confectionery.") In Korea, the groom's father tosses red dates at his new daughter-in-law to bring fertility. In France, wheat greets the happy couple. Eggs represent new life in some European countries and are thrown at newlyweds. An old Irish tradition has the couple being pelted with pots and pans (ouch!) in honor of their new domestic life.

Throwing birdseed, however, is a more modern idea. A widely circulated urban legend says that if you throw rice at your wedding, birds will eat the uncooked rice, and it will expand in their stomachs, causing the birds to explode. There is no truth to this story, and ornithologists and bird watchers have thoroughly debunked the myth. Uncooked rice doesn't harm birds -- they often eat it in the wild.

Due to the urban legend, many in the wedding industry began recommending birdseed as a rice alternative. Of course, wedding businesses would prefer you buy their special "wedding" birdseed or "designer heart-shaped rice" that's supposed to be "safe" for birds. But don't buy into it -- inexpensive rice from your grocery store is just as safe for our feathered friends. The only danger rice poses is to people who might slip on rice on a hard floor (birdseed can be just as risky). Some wedding locations have banned rice and seed throwing out of lawsuit fears.

Other trendy "tosses" include rose petals and other blooms, sunflower seeds, fall leaves, and paper snowflakes. Bridal businesses also promote blowing bubbles or waving lit sparklers at the departing couple. Just don't ask us what those symbolize.
参考资料:http://ask.yahoo.com/20030626.html
to throw rice [to wish fertility upon the couple]
撒米[祝福新郎新娘多子多孙]
6.
You know something?
I like money.
I like it a lot.
And a couple years ago,you could've bought me with that big fortune of yours.
But I'm a mom now,and i make the decisions for my kids.
And that is something that cannot be bought.
不得不说,Gaby在这季中的成长是有目共睹的。
7.
Well,putting a wall around your heart doesn't protect you.
It just keeps people out.
这是Susan对她女儿Julie说的话。挺有道理的。不敞开心扉怎么能找到真爱呢?
回复 引用 TOP
钱教授
YTET-伊甸园字幕组

帖子64 精华1 积分0 威望0 点 金钱91 RMB 注册时间2008-10-1 最后登录2009-11-12
9#
发表于 2009-1-4 20:53 | 只看该作者
Desperate Housewives Season05 Episode09 "Me and My Town"
1.
00:02:18,600 --> 00:02:20,150
I'm not promising a slam dunk here.
我可不保证十拿九稳
00:02:20,180 --> 00:02:22,750
I'm just saying it's possible.
我只是说有可能
slam dunk:"灌篮高手";很有把握、肯定会发生的事情
2.
00:04:58,950 --> 00:05:01,070
You're an honest to god hero.
你可真是个大英雄
起先看这句话觉得挺奇怪的,查了一下honest to god(a.) 真的(确实的)。举2个例子:
Honest to God, mister, I'm without a place to sleep."
“先生,真的,我今晚连个过夜的地方也没有。”
It's rare that you find people like that in this world, honest to God.
实话说, 在世界上找到那样的人是非常罕见的。
这样就清楚了吧:You're an hero,honest to god.
3.
00:07:07,220 --> 00:07:09,560
Mm,i hate macadamia nuts.
哦 我讨厌夏威夷坚果
00:07:09,580 --> 00:07:13,730
You think they're white chocolate chips
until it's too late. Stupid hawaii.
等你意识到它不是白巧克力条时
已经太晚了 白痴的夏威夷
因为这里不是我翻的,所以看到macadamia(澳洲坚果树)译为夏威夷挺纳闷的,但Susan后面又说到Hawaii,这是怎么回事呢?(分析了下,觉得Susan有点"小白")
google一下:「夏威夷果仁」的迷思~ Macadamia Nut

Macadamia Nut,在台湾常常被称为「夏威夷果仁」或是「火山果」,小时候的印象中总觉得这种果子有种特别的香味,吃起来不同于其他的坚果类,这种特别的好感百分之50来自幼童崇洋的心态:从夏威夷坐飞机来的比较好!

这种心态一直到25年后的今天才发现原来错了!而且是大错特错!

原来,「夏威夷果仁」不是美国夏威夷本土所原产的果子,它的原产地是远在南半球的澳洲,昆士兰省(Queensland, Australia),所以正确的名称应该是「昆士兰果仁」!不过「夏威夷果仁」这个名词已经成为Macadamia Nut的代名词,要改还真不容易呢。为了尊重原创,我可是做了不少心理建设才把根深蒂固的「夏威夷果仁」改成「火山果」。不过「火山果」这个字眼也有误导的嫌疑,因为Macadamia Nut的生长环境似乎和火山没什么大关系!

Macadamia Nut 事实上一直是澳洲原住民日常食物的一部分,聪明的原住民早在数千年前就发现这种果仁营养价值极高,可以提炼健康、不含胆固醇的食用油。Macadamia Nut 在澳洲当地又被称为「Queensland Nuts」、「Bush nuts」、「Bauple Nuts」。根据记载,好处多多的Macadamia Nut是在1850年左右被欧洲来的移居者发现其商业价值并且于1890年左右传到夏威夷并被发扬光大。

对Macadamia Nut 印象深刻还有一个很大的原因来自于位于澳洲新南威尔斯省北部的Yarramalong Macadamia Nut 农场门口一块小小的招牌,内容约是:「警告!掉在地上的果子属于私人财产,请勿随意拿走」。第一次踏足这个新南威尔斯省最大的Macadamia Nut农场,最先映入眼廉的就是这块小小的牌子,心里的第一个念头是,掉在地上的应该没用了吧,农庄主人真小气,还不给人家碰。后来经由农庄主人详细的解说才知道,原来Macadamia Nut成熟后会自动从树上落下,所以他们根本不需要爬树摘果子,只要稍微摇晃树干,然后捡掉在地上的果子就可以了,所以地上的果仁才最有经济价值呢!真是蛮特别的一种收成方式。

Macadamia Nut 除了可以当坚果类食用,它还可以制作成不同的产品及用途,例如:食用油(可达200度C的燃点)、Macadamia 花蜜、果酱、护肤乳液、精油、其他保养品、香皂。据说Macadamia Nut的所提炼的油非常的纯净,很适合人的皮肤,所以对于皮肤组织的修护、抗老、和保养都有卓越的功效。

所以下次去澳洲旅游时,看到Macadamia Nut可不要以为只有夏威夷才有生产,Macadamia Nut 可是道道地地的澳洲土产呢!
见:http://www.letscook.info/display.asp?articleId=4802&tp=GB
4.
00:16:22,720 --> 00:16:24,600
Hey,i'm not a short-order cook.
嘿 我可不是快餐店厨子
快餐厨子short-order cook:someone in a restaurant kitchen who cooks food that can be prepared easily or quickly
5.
00:38:16,000 --> 00:38:20,950
I'm sorry,mr. Hodge. I'm sensing you're
a bit apprehensive about the surgery.
抱歉 Hodge先生 我怎么觉得你有点不安
一开始把apprehensive看成comprehensive了,还一直在纳闷呢
apprehensive忧虑的; 害怕的; 不安的
6.一些医学词汇
医学词汇里Grey's Anatomy比较多,有兴趣的可以去那收集
这集DH也有一些医学词汇的出现,顺带整理收集一下,都是一些比较简单的词汇
(blood) transfusion输血
concussion 脑震荡
optic nerves 视(觉)神经
septum 隔膜
回复 引用 TOP
钱教授
YTET-伊甸园字幕组

帖子64 精华1 积分0 威望0 点 金钱91 RMB 注册时间2008-10-1 最后登录2009-11-12
10#
发表于 2009-1-4 20:54 | 只看该作者
Desperate Housewives Season05 Episode10 "A Vision's Just a Vision"
1
开头语:
It's an awful thing to live in the dark,unable to see what others take for granted.
But sometimes for a lucky few, a flicker of light pierces that darkness and brings with it the promise of better days to come.
结束语:
It's an awful thing to live in darkness,unable to see what others take for granted.
But if we are lucky,the darkness lifts and we can finally see the secret sacrifices made by our wives...
The surprising progress made by our mothers...
Or the unintended consequences of our own actions.
But there are those who prefer the darkness,because there,they see only what they choose to see.

2.
这集Porter被捕,在美国警察抓捕嫌疑犯时总要说的bla bla之类的东西是?
来了解下Miranda Warnings(米兰达警告)吧:
You have the right to remain silent and refuse to answer questions.
  Anything you do say may be used against you in a court of law.
  You have the right to consult an attorney before speaking to the police and to have an attorney present during questioning now or in the future.
  If you cannot afford an attorney, one will be appointed for you before any questioning if you wish.
  If you decide to answer questions now without an attorney present you will still have the right to stop answering at any time until you talk to an attorney.
  Knowing and understanding your rights as I have explained them to you, are you willing to answer my questions without an attorney present?
"宪法要求我告知你以下权利:
  1."你有权保持沉默,你对任何一个警察所说的一切都将可能被作为法庭对你不利的证据。
  2."你有权利在接受警察询问之前委托律师,他(她)可以陪伴你受询问的全过程。
  3."如果你付不起律师费,只要你愿意,在所有询问之前将免费为你提供一名律师。
  4.如果你愿意回答问题,你在任何时间都可以终止谈话。
  如果你希望跟你对律师谈话,你可以在任何时间停止回答问题,并且你可以让律师一直伴随你询问的全过程。"

3.
00:31:54,090 --> 00:31:59,880
Yeah. Well,you know,i mean,we both know that i have sort of an interesting past myself.
00:32:00,670 --> 00:32:02,860
So,you know,uh,glass houses,stones.
这句"glass houses,stones"我们字幕组翻译成“己所不欲 勿施于人”---我感觉翻译得很欠缺,今天看到那就觉得挺纳闷的。
Andrew在这里说了两个关键词:"glass houses"和"stones",说完整了差不多是:Pepole (或Those) who live in glass houses should not throw stones 住在玻璃房子里的人最好不要向他人投掷石头,否则后果自负。因为别人也可以向玻璃房投掷石头,从而自食其果。意指不要说他人的是非长短,因为自己也有缺点。
即所谓「自身有短,勿批他人」。

嵌入式Linux内核时钟初始化问题

c
嵌入式Linux内核时钟初始化问题

内核版本:Linux 2.6.18
平台: FOR ARM

首先搞清楚RTC在kernel内的作用:

linux系统有两个时钟:一个是由主板电池驱动的“Real Time Clock”也叫做RTC或者叫CMOS时钟,
硬件时钟。当操作系统关机的时候,用这个来记录时间,但是对于运行的系统是不用这个时间的。
另一个时间是 “System clock”也叫内核时钟或者软件时钟,是由软件根据时间中断来进行计数的,
内核时钟在系统关机的情况下是不存在的,所以,当操作系统启动的时候,内核时钟是要读取RTC时间
来进行时间同步。并且在系统关机的时候将系统时间写回RTC中进行同步。

如前所述,Linux内核与RTC进行互操作的时机只有两个:
1) 内核在启动时从RTC中读取启动时的时间与日期;
2) 内核在需要时将时间与日期回写到RTC中。

系统启动时,内核通过读取RTC来初始化内核时钟,又叫墙上时间,该时间放在xtime变量中。
The current time of day (the wall time) is defined in kernel/timer.c:
struct timespec xtime;

The timespec data structure is defined in as:
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};

问题1:系统启动时在哪读取RTC的值并设置内核时钟进行时间同步的呢?
最有可能读取RTC设置内核时钟的位置应该在arch/arm/kernel/time.c里的time_init函数内.
time.c为系统的时钟驱动部分.time_init函数会在系统初始化时,由init/main.c里的start_kernel函数内调用.X86架构就是在这里读RTC值并初始化系统时钟xtime的.

ARM架构的time_init代码如下:
/* arch/arm/kernel/time.c */
void __init time_init(void)
{
if (system_timer->offset == NULL)
system_timer->offset = dummy_gettimeoffset;
system_timer->init();
#ifdef CONFIG_NO_IDLE_HZ
if (system_timer->dyn_tick)
system_timer->dyn_tick->lock = SPIN_LOCK_UNLOCKED;
#endif
}

上面system_timer->init()实际执行的是时钟驱动体系架构相关(具体平台)部分定义的init函数,若是 s3c2410平台,则执行的为arch/arm/mach-s3c2410/time.c里定义的s3c2410_timer_init函数.不过 s3c2410_timer_init()也没有读RTC的代码.整个时钟驱动初始化的过程大致就执行这些代码.
既然在系统时钟驱动初始化的过程中没有读RTC值并设置内核时钟,那会在哪设置呢?

我搜了一下,发现内核好象只有在arch/cris/kernel/time.c里有RTC相关代码,如下:
/* arch/cris/kernel/time.c */
/* grab the time from the RTC chip */
//读RTC的函数
unsigned long get_cmos_time(void)
{
unsigned int year, mon, day, hour, min, sec;
sec = CMOS_READ(RTC_SECONDS);
min = CMOS_READ(RTC_MINUTES);
hour = CMOS_READ(RTC_HOURS);
day = CMOS_READ(RTC_DAY_OF_MONTH);
mon = CMOS_READ(RTC_MONTH);
…………
return mktime(year, mon, day, hour, min, sec);
}

这个函数会在update_xtime_from_cmos内被调用:
void update_xtime_from_cmos(void)
{
if(have_rtc) {
xtime.tv_sec = get_cmos_time();
xtime.tv_nsec = 0;
}
}

另外还有设置rtc的函数
int set_rtc_mmss(unsigned long nowtime); /* write time into RTC chip */

不过我加了printk测试了一下,好象arch/cris/kernel/time.c这个文件和这两个函数只是适用与X86?
ARM平台启动时并不走这边.因此执行不到这些函数。
那ARM平台启动时,系统是在哪读RTC的值并对内核时钟(WallTime)进行初始化的呢?

已解决:
嵌入式Linux内核(ARM)是在系统启动时执行/etc/init.d/hwclock.sh脚本,这个脚本会调用hwclock小程序读取RTC的值并设置系统时钟。
(换句话说,这要取决于你制作的文件系统里是否有这样的脚本)

/* /etc/init.d/hwclock.sh */
DAEMON1=/sbin/hwclock
start() {
local RET ERROR=
[ ! -f /etc/adjtime ] && echo "0.0 0 0.0" > /etc/adjtime
log_status_msg "Setting the System Clock using the Hardware Clock as reference..." -n
# Copies Hardware Clock time to System Clock using the correct
# timezone for hardware clocks in local time, and sets kernel
# timezone. DO NOT REMOVE.
[ "$HWCLOCKACCESS" != no ] && $DAEMON1 --hctosys $GMT $BADYEAR
#
# Now that /usr/share/zoneinfo should be available,
# announce the local time.
#
log_status_msg "System Clock set. Local time: `date`"
log_status_msg ""
return 0
}

hwclock最先读取的设备文件是 /dev/rtc ,busybox里面的hwclock是这样实现的:
static int xopen_rtc(int flags)
{
int rtc;
if (!rtcname) {
rtc = open("/dev/rtc", flags);
if (rtc >= 0)
return rtc;
rtc = open("/dev/rtc0", flags);
if (rtc >= 0)
return rtc;
rtcname = "/dev/misc/rtc";
}
return xopen(rtcname, flags);
}

2. 内核如何更新RTC时钟?
通过set_rtc函数指针指向的函数,set_rtc在arch/arm/kernel/time.c内
/* arch/arm/kernel/time.c */
/*
* hook for setting the RTC's idea of the current time.
*/
int (*set_rtc)(void);
但是set_rtc函数指针在哪初始化的呢?set_rtc应该是和RTC驱动相关的函数.
搜索kernel源码后发现,好象内核其他地方并没有对其初始化。待解决!

set_rtc在do_set_rtc内调用
static inline void do_set_rtc(void)
{
……
if (set_rtc())
/*
* rtc update failed. Try again in 60s
*/
next_rtc_update = xtime.tv_sec + 60;
else
next_rtc_update = xtime.tv_sec + 660; /* update every ~11 minutes by default*/
}

do_set_rtc在timer_tick里调用
/*
* Kernel system timer support.
*/
void timer_tick(struct pt_regs *regs)
{
profile_tick(CPU_PROFILING, regs);
do_leds();
do_set_rtc();
do_timer(1);
……
}
timer_tick为Kernel提供的体系架构无关的时钟中断处理函数,通常会在体系架构相关的时钟中断处理函数内调用它。如s3c2410是这样的:
在arch/arm/mach-s3c2410/time.c中
* IRQ handler for the timer
*/
static irqreturn_t
s3c2410_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
write_seqlock(&xtime_lock);
timer_tick(regs);
write_sequnlock(&xtime_lock);
return IRQ_HANDLED;
}

debug init.rc

android/system/core/init/init.c parser.c

kernel debuuging

menuconfig
CONFIG_KERNEL_DBG_LL

2009年12月18日 星期五

trace clock source of RTC

1. gettimeofday();
2. system_call sys_gettimeofday
3 kernel level: do_gettimeofday

4 kernel /time /jiffies.c jiffies
5 kernel/time/clocksource.c clocksource0

2009年12月10日 星期四

android: pass value from system

1) method 1
import android.os.SystemProperties;
String strResult = SystemProperties.get("hw.VIDEO_TVOUT_DISPLAY");
SystemProperties.set("hw.VIDEO_TVOUT_DISPLAY", "1");
2) method 2
Settings.System.getInt(getContentResolver(), "PlayVieo", 0);
Settings.System.putInt(getContentResolver(), "PlayVieo", 1);
import android.provider.Settings;

2009年12月8日 星期二

Android wifi on off tutorial

Turn off, Turn on wifi in android using code tutorial

For list of android tutorial click here

Here is how to turn on and turn off wifi in android.

First you need to declare the following in your manifest file
XML | copy code | ?
1



2



3



4



After doing it that on your Activity class
Java | copy code | ?
01

private WifiManager wifiManager;

02

@Override

03

public void onCreate(Bundle icicle) {

04

....................

05

wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);

06

if(wifiManager.isWifiEnabled()){

07

wifiManager.setWifiEnabled(false);

08

}else{

09

wifiManager.setWifiEnabled(true);

10

}

11

}

Explanation
Get the Wifi service from our system
wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);

Check the our wifi is currently turned on or turned off
if(wifiManager.isWifiEnabled()){

Turn on/off our wifi
wifiManager.setWifiEnabled();

Reference
WifiEnabler
Permissions Journey: ACCESS_WIFI_STATE
Share and Enjoy:

* Digg
* Sphinn
* del.icio.us
* Facebook
* Mixx
* Google Bookmarks
* Reddit
* Yahoo! Buzz
* email
* Fark
* HackerNews
* PDF
* Slashdot
* StumbleUpon
* Technorati

October 17th, 2009 | Tags: Wifi | Category: Android | One comment
1 comment to Turn off, Turn on wifi in android using code tutorial

install android sDK and eclipse

http://hi.baidu.com/samson2008/blog/item/276b2d505149e2561138c23e.html

2009年12月7日 星期一

can not power off with BT on

1. Keyinputqueue.java
2. EventHub.cpp

if (can not find key map file)
then
publicID=0;

thus AVRCP can will has mDevices[x].id =0;instead of correct 65540.

trace wifi can not be powered off

setprop wlan.driver.unifi_helper_pid ->wlan.driver.helper_pid

2009年12月3日 星期四

Linux Kernel module

http://tech.sunplusedu.com/space/viewspacepost.aspx?postid=5043

Android的电源管理

Android的电源管理


接下来我们从Java应用层面, Android framework层面, Linux内核层面分别进行详细的讨论:

应用层的使用:

Android提供了现成android.os.PowerManager类,该类用于控制设备的电源状态的切换.

该类对外有三个接口函数:

void goToSleep(long time); //强制设备进入Sleep状态

Note:

尝试在应用层调用该函数,却不能成功,出现的错误好象是权限不够, 但在Framework下面的Service里调用是可以的.

newWakeLock(int flags, String tag);//取得相应层次的锁

flags参数说明:

PARTIAL_WAKE_LOCK: Screen off, keyboard light off

SCREEN_DIM_WAKE_LOCK: screen dim, keyboard light off

SCREEN_BRIGHT_WAKE_LOCK: screen bright, keyboard light off

FULL_WAKE_LOCK: screen bright, keyboard bright

ACQUIRE_CAUSES_WAKEUP: 一旦有请求锁时强制打开Screen和keyboard light

ON_AFTER_RELEASE: 在释放锁时reset activity timer

Note:

如果申请了partial wakelock,那么即使按Power键,系统也不会进Sleep,如Music播放时

如果申请了其它的wakelocks,按Power键,系统还是会进Sleep

void userActivity(long when, boolean noChangeLights);//User activity事件发生,设备会被切换到Full on的状态,同时Reset Screen off timer.

Sample code:

PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);

PowerManager.WakeLock wl = pm.newWakeLock (PowerManager.SCREEN_DIM_WAKE_LOCK, “My Tag”);

wl.acquire();

…….

wl.release();

Note:

1. 在使用以上函数的应用程序中,必须在其Manifest.xml文件中加入下面的权限:





2. 所有的锁必须成对的使用,如果申请了而没有及时释放会造成系统故障.如申请了partial wakelock,而没有及时释放,那系统就永远进不了Sleep模式.






Android Framework层面:

其主要代码文件如下:

frameworks\base\core\java\android\os\PowerManager.java

frameworks\base\services\java\com\android\server\PowerManagerService.java

frameworks\base\core\java\android\os\Power.java

frameworks\base\core\jni\android_os_power.cpp

hardware\libhardware\power\power.c

其中PowerManagerService.java是核心, Power.java提供底层的函数接口,与JNI层进行交互, JNI层的代码主要在文件android_os_Power.cpp中,与Linux kernel交互是通过Power.c来实现的, Andriod跟Kernel的交互主要是通过sys文件的方式来实现的,具体请参考Kernel层的介绍.



这一层的功能相对比较复杂,比如系统状态的切换,背光的调节及开关,Wake Lock的申请和释放等等,但这一层跟硬件平台无关,而且由Google负责维护,问题相对会少一些,有兴趣的朋友可以自己查看相关的代码.






Kernel层:

其主要代码在下列位置:

drivers/android/power.c

其对Kernel提供的接口函数有

EXPORT_SYMBOL(android_init_suspend_lock); //初始化Suspend lock,在使用前必须做初始化

EXPORT_SYMBOL(android_uninit_suspend_lock); //释放suspend lock相关的资源

EXPORT_SYMBOL(android_lock_suspend); //申请lock,必须调用相应的unlock来释放它

EXPORT_SYMBOL(android_lock_suspend_auto_expire);//申请partial wakelock, 定时时间到后会自动释放

EXPORT_SYMBOL(android_unlock_suspend); //释放lock

EXPORT_SYMBOL(android_power_wakeup); //唤醒系统到on

EXPORT_SYMBOL(android_register_early_suspend); //注册early suspend的驱动

EXPORT_SYMBOL(android_unregister_early_suspend); //取消已经注册的early suspend的驱动



提供给Android Framework层的proc文件如下:

"/sys/android_power/acquire_partial_wake_lock" //申请partial wake lock

"/sys/android_power/acquire_full_wake_lock" //申请full wake lock

"/sys/android_power/release_wake_lock" //释放相应的wake lock

"/sys/android_power/request_state" //请求改变系统状态,进standby和回到wakeup两种状态

"/sys/android_power/state" //指示当前系统的状态



Android的电源管理主要是通过Wake lock来实现的,在最底层主要是通过如下三个队列来实现其管理:

static LIST_HEAD(g_inactive_locks);

static LIST_HEAD(g_active_partial_wake_locks);

static LIST_HEAD(g_active_full_wake_locks);

所有初始化后的lock都会被插入到g_inactive_locks的队列中,而当前活动的partial wake lock都会被插入到g_active_partial_wake_locks队列中, 活动的full wake lock被插入到g_active_full_wake_locks队列中, 所有的partial wake lock 和full wake lock在过期后或unlock后都会被移到inactive的队列,等待下次的调用.

在Kernel层使用wake lock步骤如下:

1. 调用函数android_init_suspend_lock初始化一个wake lock

2. 调用相关申请lock的函数android_lock_suspend 或 android_lock_suspend_auto_expire请求lock,这里只能申请partial wake lock, 如果要申请Full wake lock,则需要调用函数android_lock_partial_suspend_auto_expire(该函数没有EXPORT出来),这个命名有点奇怪,不要跟前面的android_lock_suspend_auto_expire搞混了.

3. 如果是auto expire的wake lock则可以忽略,不然则必须及时的把相关的wake lock释放掉,否则会造成系统长期运行在高功耗的状态.

4. 在驱动卸载或不再使用Wake lock时请记住及时的调用android_uninit_suspend_lock释放资源.



系统的状态:

USER_AWAKE, //Full on status

USER_NOTIFICATION, //Early suspended driver but CPU keep on

USER_SLEEP // CPU enter sleep mode

其状态切换示意图如下:







系统正常开机后进入到AWAKE状态, Backlight会从最亮慢慢调节到用户设定的亮度,系统screen off timer(settings->sound & display-> Display settings -> Screen timeout)开始计时,在计时时间到之前,如果有任何的activity事件发生,如Touch click, keyboard pressed等事件, 则将Reset screen off timer, 系统保持在AWAKE状态. 如果有应用程序在这段时间内申请了Full wake lock,那么系统也将保持在AWAKE状态, 除非用户按下power key. 在AWAKE状态下如果电池电量低或者是用AC供电screen off timer时间到并且选中Keep screen on while pluged in选项,backlight会被强制调节到DIM的状态.

如果Screen off timer时间到并且没有Full wake lock或者用户按了power key,那么系统状态将被切换到NOTIFICATION,并且调用所有已经注册的g_early_suspend_handlers函数, 通常会把LCD和Backlight驱动注册成early suspend类型,如有需要也可以把别的驱动注册成early suspend, 这样就会在第一阶段被关闭. 接下来系统会判断是否有partial wake lock acquired, 如果有则等待其释放, 在等待的过程中如果有user activity事件发生,系统则马上回到AWAKE状态;如果没有partial wake lock acquired, 则系统会马上调用函数pm_suspend关闭其它相关的驱动, 让CPU进入休眠状态.

系统在Sleep状态时如果检测到任何一个Wakeup source, 则CPU会从Sleep状态被唤醒,并且调用相关的驱动的resume函数,接下来马上调用前期注册的early suspend驱动的resume函数,最后系统状态回到AWAKE状态.这里有个问题就是所有注册过early suspend的函数在进Suspend的第一阶段被调用可以理解,但是在resume的时候, Linux会先调用所有驱动的resume函数,而此时再调用前期注册的early suspend驱动的resume函数有什么意义呢?个人觉得android的这个early suspend和late resume函数应该结合Linux下面的suspend和resume一起使用,而不是单独的使用一个队列来进行管理.

2009年12月2日 星期三

audio codec device nodes

seems fail to locate some /dev/snd nodes.
For example, mixer, controlC0, audio, dsp, pcmC0D0c, pcmC0D0p.

add domain_name_servers to default reqeust options

add domain_name_servers to default reqeust options donut-x86 master android-x86-1.6



author Chih-Wei Huang

Wed, 2 Sep 2009 06:57:13 +0000 (14:57 +0800)

committer Chih-Wei Huang

Wed, 2 Sep 2009 06:57:13 +0000 (14:57 +0800)







dhcpcd.c

patch | blob | history






diff --git a/dhcpcd.c b/dhcpcd.c


index e674bd2..f4f21c3 100644 (file)


--- a/dhcpcd.c

+++ b/dhcpcd.c

@@ -659,8 +659,8 @@ main(int argc, char **argv)

VENDORCLASSID_MAX_LEN,

"%s %s", PACKAGE, VERSION);



-#ifdef CMDLINE_COMPAT

add_option_mask(options->requestmask, DHO_DNSSERVER);

+#ifdef CMDLINE_COMPAT

add_option_mask(options->requestmask, DHO_DNSDOMAIN);

add_option_mask(options->requestmask, DHO_DNSSEARCH);

add_option_mask(options->requestmask, DHO_NISSERVER);


/system/core/libnetutil
/external/dhcpcd
frameworks/base/core/java/android/net/MobileDataState.java

2009年11月28日 星期六

WIFI DNS ANDROID

android-porting
Thread Date
[android-porting] Re: android DNS fail to resolve website IP adddres
vinay
Tue, 03 Feb 2009 19:36:50 -0800

On Thu, Jan 29, 2009 at 11:47 AM, vinay wrote:

> hi,
>
> DNS started working after setting net dns proprty.. ,
> setprop net.dns1
>
> thanks,
> -vinay
>
> On Wed, Jan 21, 2009 at 12:10 PM, Sean McNeil wrote:
>
>>
>> eth1 isn't a valid device for tracking. Take a look at
>> frameworks/base/core/java/android/net/MobileDataStateTracker.java.
>> You'll see that it really only looks at rmnet0, eth0, and gprs. For DNS
>> to work, the net.dns# properties need to get set. You'll either have to
>> add eth1 into the MobileDataStateTracker, get the wifi to set net.dns#,
>> or change your kernel so the wifi is eth0.
>>
>> vinay wrote:
>> > hi,
>> > I have configured wifi with custom driver and able to connect to
>> > secured Access point. But IP resolv for website link is not
>> > happening. If I type IP address in the url then browser opens the
>> > site.
>> >
>> > Are there any known problems/limitations with DNS deployment in
>> > android on real target ?
>> >
>> > below getprop detaiils:--------------
>> > [dhcp.eth1.dns1]: [192.168.200.100]
>> > [dhcp.eth1.dns2]: []
>> > [dhcp.eth1.dns3]: []
>> > [dhcp.eth1.dns4]: []
>> > [dhcp.eth1.reason]: [BOUND]
>> > [dhcp.eth1.ipaddress]: [192.168.200.104]
>> > [dhcp.eth1.gateway]: [192.168.200.100]
>> > [dhcp.eth1.mask]: [255.255.255.0]
>> > [dhcp.eth1.leasetime]: [86400]
>> > [dhcp.eth1.server]: [192.168.200.100]
>> > [dhcp.eth1.result]: [ok]
>> >
>> > In browser AndroidManifest.xml ---------
>> > is
>> > also present.
>> >
>> > logcat detail below---------------
>> > I/ActivityManager( 1553): Starting activity: Intent
>> > { action=android.intent.ac
>> > tion.VIEW categories={android.intent.category.BROWSABLE} data=http://
>> > 164.129.225
>> > .192/ comp={com.android.browser/com.android.browser.BrowserActivity} }
>> > D/dalvikvm( 1672): GC freed 2989 objects / 215368 bytes in 144ms
>> > D/browser ( 1672): updating cursor
>> > D/dalvikvm( 1672): GC freed 4780 objects / 439912 bytes in 112ms
>> > W/KeyCharacterMap( 1672): No keyboard for id 0
>> > W/KeyCharacterMap( 1672): Using default keymap: /system/usr/keychars/
>> > qwerty.kcm.
>> > bin
>> > D/browser ( 1672): updating cursor
>> > I/ActivityManager( 1553): Starting activity: Intent
>> > { action=android.intent.acti
>> > on.VIEW categories={android.intent.category.BROWSABLE} data=http://
>> > stway.st.com/
>> > comp={com.android.browser/com.android.browser.BrowserActivity} }
>> > E/browser ( 1672): onReceivedError code:-2 The URL could not be found.
>> > D/browser ( 1672): updating cursor
>> >
>> > # cat /proc/net/route ------------
>> > Iface Destination Gateway Flags RefCnt Use
>> > Metric Mask M
>> > TU Window IRTT
>> > eth1 00C8A8C0 00000000 0001 0 0
>> > 0 00FFFFF0
>> >
>> > eth1 00000000 64C8A8C0 0003 0 0
>> > 0 00000000
>> >
>> > >
>> >
>>
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

[android-porting] android DNS fail to resolve website IP adddres vinay
[android-porting] Re: android DNS fail to resolve website IP adddres Sean McNeil
[android-porting] Re: android DNS fail to resolve website IP adddres vinay
[android-porting] Re: android DNS fail to resolve website IP adddres vinay
Reply via email to

2009年11月27日 星期五

浅析android下如何通过jni监控wifi

December 18
浅析android下如何通过jni监控wifi(三)
jni
=>runDhcp
=>android_net_utils_runDhcp
libs/netutils/dhcp_utils.c
=>dhcp_do_request
=>
static const char DAEMON_NAME[] = "dhcpcd";
static const char DAEMON_PROP_NAME[] = "init.svc.dhcpcd";
static const char DHCP_PROP_NAME_PREFIX[] = "dhcp";
const char *ctrl_prop = "ctl.start";
const char *desired_status = "running";
snprintf(result_prop_name, sizeof(result_prop_name), "%s.%s.result",
DHCP_PROP_NAME_PREFIX,
interface);
property_set(result_prop_name, "");//设置dhcp.eth0.result="";等到成功完成dhcp之后,
property_set(ctrl_prop, DAEMON_NAME);//向名字为dhcpcd的service,发送"ctrl.start"启动命令字,该service在init.rc中
//init.rc中dhcpcd服务进程命令字
//service dhcpcd /system/bin/dhcpcd eth0
// disabled
// oneshot
wait_for_property(DAEMON_PROP_NAME, desired_status, 10);
//init.c=>init进程
//=>handle_property_set_fd因为是"ctrl.start"命令字,所以调用handle_control_message处理控制信息
//=>handle_control_message
//=>msg_start
//=>
// struct service *svc = service_find_by_name(name);
// service_start(svc);//启动svc,即执行:/system/bin/dhcpcd eth0
//=>service_start
//=>pid = fork();
// if(pid == 0)execve(svc->args[0], (char**) svc->args, (char**) ENV);子进程执行execve运行/system/bin/dhcpcd,参数为eth0
//=>否则父进程,即init进程将
//=>notify_service_state(svc->name, "running");设置该svc的状态prop
// snprintf(pname, sizeof(pname), "init.svc.%s", name);
// property_set(pname, state);//所以这样上面wait_for_property(DAEMON_PROP_NAME, desired_status, 10);也才能够正常pass[luther.gliethttp].
wait_for_property(result_prop_name, NULL, 15);//等待dhcp.eth0.result=非空
=============================================================================================================
system/extra/dhcpcd-4.0.0-beta9/dhcpcd.c
dhcpcd
=>main
# define SYSCONFDIR "/system/etc/dhcpcd"
#define PACKAGE "dhcpcd"
# define CONFIG SYSCONFDIR "/" PACKAGE ".conf"
# define LIBEXECDIR "/system/etc/dhcpcd"
# define SCRIPT LIBEXECDIR "/" PACKAGE "-run-hooks"
=>strlcpy(options->script, SCRIPT, sizeof(options->script));//默认的options->script="/system/etc/dhcpcd/dhcpcd-run-hooks"
=>f = fopen(cf ? cf : CONFIG, "r");//如果没有指定.conf文件,那么使用默认.conf文件
=>parse_config_line//解析"/system/etc/dhcpcd/dhcpcd.conf"默认配置文件
=>parse_option
=>如果在"/system/etc/dhcpcd/dhcpcd.conf"有"script"这个节
=>那么执行strlcpy(options->script, oarg, sizeof(options->script));直接拷贝
/*
{"script", required_argument, NULL, 'c'},
{"option", required_argument, NULL, 'o'},
"/system/etc/dhcpcd/dhcpcd.conf"中的部分内容如下:
...
option domain_name_servers, domain_name, domain_search, host_name
...
*/
=>dhcp_run
=>handle_dhcp_packet
=>handle_dhcp
=>bind_dhcp
reason = "TIMEOUT";reason = "BOUND";reason = "REBIND";reason = "RENEW";
system/extra/dhcpcd-4.0.0-beta9/configure.c
=> configure(iface, reason, state->new, state->old, &state->lease, options, 1);
//如果dhcp超时或者dhcp成功,都会调用exec_script来执行脚本,
//执行setprop dhcp.${interface}.result "failed"或者
//执行setprop dhcp.${interface}.result "ok"
=>exec_script(options, iface->name, reason, NULL, old);
=>然后configure_env通过环境变量将reason传递到脚本中
int exec_script(const struct options *options, const char *iface, const char *reason,
const struct dhcp_message *dhcpn, const struct dhcp_message *dhcpo)
=>pid = fork();
=>if(pid == 0)execve(options->script, argv, env);//子进程执行脚本,默认"/system/etc/dhcpcd/dhcpcd-run-hooks"
//dhcpcd-run-hooks脚本会根据level值,决定是否执行system/etc/dhcpcd/dhcpcd-hook/*目录下的相应文件
//我们的系统在该system/etc/dhcpcd/dhcpcd-hook/*目录下有如下3个文件
//95-configured
//20-dns.conf
//01-test
=>父进程返回while (waitpid(pid, &status, 0) == -1)等待子进程脚本执行完成

system/extra/dhcpcd-4.0.0-beta9/dhcpcd-hooks/20-dns.conf
system/extra/dhcpcd-4.0.0-beta9/dhcpcd-hooks/95-configured
...
setprop dhcp.${interface}.ipaddress "${new_ip_address}"
setprop dhcp.${interface}.result "ok"//设置属性为ok
setprop dhcp.${interface}.result "failed"
...
=============================================================================================================
inet_init、tcp_prot
sock->ops->sendmsg(iocb, sock, msg, size);
=>inetsw_array[]
=>inet_stream_ops
=>tcp_sendmsg
=============================================================================================================
wpa_cli.c
=>main
=>wpa_cli_interactive
=>wpa_cli_recv_pending(monitor_conn, 0, 0);//阻塞等待wpa_supplicant发送数据过来
=>如果action_monitor为true,那么将执行一些简单加工操作,否则将直接将wpa_supplicant发过来的数据打印到console上[luther.gliethttp].
============================================================================================================= 2:28 PM | Add a comment | Permalink | Blog it | Android浅析android下如何通过jni监控wifi(二)
//剔除前导控制字符,将" - "后面的描述字符串作为真实数据,继续处理
...
if (event == STATE_CHANGE) {
handleSupplicantStateChange(eventData);
} else if (event == DRIVER_STATE) {
handleDriverEvent(eventData);
} else {
handleEvent(event, eventData);//对于CONNECTED和DISCONNECTED等netlink事件将执行此操作来处理[luther.gliethttp]
// If supplicant is gone, exit the thread
if (event == TERMINATING) {
break;
}
}
...
void handleEvent(int event, String remainder) {
switch (event) {
case DISCONNECTED:
handleNetworkStateChange(NetworkInfo.DetailedState.DISCONNECTED, remainder);
break;

case CONNECTED:
handleNetworkStateChange(NetworkInfo.DetailedState.CONNECTED, remainder);//控制界面显示
break;
...
}
public class WifiStateTracker extends NetworkStateTracker {
...
public void startEventLoop() {
mWifiMonitor.startMonitoring();//启动上面的MonitorThread线程
}
...
}
java/services/com/android/server/WifiService.java
public class WifiService extends IWifiManager.Stub {
...
private boolean setWifiEnabledBlocking(boolean enable) {
final int eventualWifiState = enable ? WIFI_STATE_ENABLED : WIFI_STATE_DISABLED;
...
if (enable) {
if (WifiNative.loadDriver()) {
Log.e(TAG, "Failed to load Wi-Fi driver.");
updateWifiState(WIFI_STATE_UNKNOWN);
return false;
}
if (WifiNative.startSupplicant()) {
WifiNative.unloadDriver();
Log.e(TAG, "Failed to start supplicant daemon.");
updateWifiState(WIFI_STATE_UNKNOWN);
return false;
}
mWifiStateTracker.startEventLoop();
//启动MonitorThread线程,等待wpa_supplicant将netlink数据转发过来,然后根据netlink动作类型,进一步影响界面显示[luther.gliethttp].
}
...
}
java/android/android/net/wifi/WifiStateTracker.java
电源管理
private void handleConnectedState() {
...
mDhcpTarget.obtainMessage(EVENT_DHCP_START).sendToTarget();//传递到下面的handleMessage方法
...
}
public void onChange(boolean selfChange) {
...
handleConnectedState();
...
}
public class WifiStateTracker extends NetworkStateTracker {
...
public void handleMessage(Message msg) {
switch (msg.what) {
case EVENT_SUPPLICANT_CONNECTION:
case EVENT_NETWORK_STATE_CHANGED:
handleConnectedState();//调用
...
private class DhcpHandler extends Handler {

private Handler mTarget;

public DhcpHandler(Looper looper, Handler target) {
super(looper);
mTarget = target;
}

public void handleMessage(Message msg) {
int event;
//private static final int DRIVER_POWER_MODE_AUTO = 0;
//private static final int DRIVER_POWER_MODE_ACTIVE = 1;
switch (msg.what) {
case EVENT_DHCP_START:
synchronized (this) {
WifiNative.setPowerModeCommand(DRIVER_POWER_MODE_ACTIVE);//设置电源模式,调用android_net_wifi_setPowerModeCommand
}
Log.d(TAG, "DhcpHandler: DHCP request started");
//libs/android_runtime/android_net_NetUtils.cpp
//static JNINativeMethod gNetworkUtilMethods[] = {
//{ "runDhcp", "(Ljava/lang/String;Landroid/net/DhcpInfo;)Z", (void *)android_net_utils_runDhcp },
// ...
//};

if (NetworkUtils.runDhcp(mInterfaceName, mDhcpInfo)) {//执行dhcp申请ip地址操作
event = EVENT_INTERFACE_CONFIGURATION_SUCCEEDED;
if (LOCAL_LOGD) Log.v(TAG, "DhcpHandler: DHCP request succeeded");
} else {
event = EVENT_INTERFACE_CONFIGURATION_FAILED;
Log.i(TAG, "DhcpHandler: DHCP request failed: " +
NetworkUtils.getDhcpError());
//如果dhcpcd分配ip失败,那么Message.obtain(mTarget, event).sendToTarget();将执行
//WifiNative.disconnectCommand();即:static JNINativeMethod gWifiMethods[] = {
//android_net_wifi_disconnectCommand发送"DISCONNECT"字符串[luther.gliethttp]
//然后在wpa_supplicant服务端执行wpa_supplicant_ctrl_iface_process
//wpa_supplicant_disassociate
}
synchronized (this) {
WifiNative.setPowerModeCommand(DRIVER_POWER_MODE_AUTO);
}
Message.obtain(mTarget, event).sendToTarget();
break;
}
}
}
...
/**
* Send the tracker a notification that a connection to the supplicant
* daemon has been established.
*/
//在上面的public class WifiMonitor=>ensureSupplicantConnection
//=>
//while (!supplicantConnected) {
// boolean connected;
//synchronized (mWifiStateTracker) {
//connected = WifiNative.connectToSupplicant();//如果没有连接成功,那么while循环尝试,直到尝试成功,或者定义了oneShot,仅一次尝试
//=>mWifiStateTracker.notifySupplicantConnection();//如果WifiNative.connectToSupplicant()成功,那么将执行
//mWifiStateTracker.notifySupplicantConnection();的调用.
void notifySupplicantConnection() {//向对象发送message
Message.obtain(this, EVENT_SUPPLICANT_CONNECTION).sendToTarget();
}
void notifyStateChange(SupplicantState newState) {
Message.obtain(this, EVENT_SUPPLICANT_STATE_CHANGED, newState).sendToTarget();
}
...
}
static jboolean android_net_wifi_setPowerModeCommand(JNIEnv* env, jobject clazz, jint mode)
{
char cmdstr[256];

sprintf(cmdstr, "DRIVER POWERMODE %d", mode);
return doBooleanCommand(cmdstr, "OK");
}
android_net_wifi_setPowerModeCommand
=>doBooleanCommand
=>doCommand
=>wifi_command
=>wifi_send_command
=>wpa_ctrl_request
=>send给wpa_supplicant
然后wpa_supplicant将做如下接收操作:
system/extra/wpa_supplicant/main.c
=>wpa_supplicant_add_iface
=>wpa_supplicant_init_iface2
=>wpa_supplicant_ctrl_iface_init
=>注册ctrl_conn控制端口和monitor_conn监听端口的处理函数
eloop_register_read_sock(priv->sock, wpa_supplicant_ctrl_iface_receive, wpa_s, priv);//ctrl_conn端口的handler处理函数
wpa_msg_register_cb(wpa_supplicant_ctrl_iface_msg_cb);//monitor_conn端口的回调处理函数,处理netlink数据到所有monitor_conn监听端口
=>wpa_supplicant_ctrl_iface_receive//对于unix通信方式
=>wpa_supplicant_ctrl_iface_process
=>如果wpa_cli发送的是wpa_cli driver xxx形式的命令,那么调用这个函数
if (os_strncmp(buf, "DRIVER ", 7) == 0) {//掠过前7个,直接将命令传过去
reply_len = wpa_supplicant_driver_cmd(wpa_s, buf + 7, reply, reply_size);
=>wpa_supplicant_driver_cmd
=>wpa_drv_driver_cmd
=>自定义DRIVER扩展处理函数,所以对于java传递过来的power电源管理命令,wpa_drv_driver_cmd将收到"POWERMODE 0"或者"POWERMODE 1"字符串[luther.gliethttp]
=============================================================================================================
2:27 PM | Add a comment | Permalink | Blog it | Android浅析android下如何通过jni监控wifi(一)
浅析android下如何通过jni监控wifi网络连接、dhcpcd执行和power电源控制

=============================================================================================================
libs/android_runtime/android_net_wifi_Wifi.cpp
部分jni接口
static JNINativeMethod gWifiMethods[] = {
{ "loadDriver", "()Z", (void *)android_net_wifi_loadDriver },
{ "setPowerModeCommand", "(I)Z", (void*) android_net_wifi_setPowerModeCommand },//电源管理
{ "connectToSupplicant", "()Z", (void *)android_net_wifi_connectToSupplicant },
{ "waitForEvent", "()Ljava/lang/String;", (void*) android_net_wifi_waitForEvent },
{ "disconnectCommand", "()Z", (void *)android_net_wifi_disconnectCommand },
...
};
int register_android_net_wifi_WifiManager(JNIEnv* env)
{
...
return AndroidRuntime::registerNativeMethods(env,
WIFI_PKG_NAME, gWifiMethods, NELEM(gWifiMethods));//登记jni
}
libs/android_runtime/AndroidRuntime.cpp
static const RegJNIRec gRegJNI[] = {
...
REG_JNI(register_android_net_wifi_WifiManager),
...
};
int AndroidRuntime::startReg(JNIEnv* env)
{
...
register_jni_procs(gRegJNI, NELEM(gRegJNI), env);
...
}
AndroidRuntime::start
=>startReg(env)即调用方法int AndroidRuntime::startReg(JNIEnv* env)
=============================================================================================================
wifi_load_driver
wifi_start_supplicant
=>ensure_config_file_exists
//检查/data/misc/wifi/wpa_supplicant.conf文件是否存在,如果不存在,那么从/system/etc/wifi/wpa_supplicant.conf动态拷贝一份
android_net_wifi_connectToSupplicant
=>wifi_connect_to_supplicant
=>
ctrl_conn = wpa_ctrl_open(ifname);
monitor_conn = wpa_ctrl_open(ifname);
wpa_ctrl_attach(monitor_conn);

android_net_wifi_waitForEvent
=>wifi_wait_for_event
=>wpa_ctrl_recv(monitor_conn, buf, &nread);
=>recv(ctrl->s, reply, *reply_len, 0);//阻塞等待wpa_supplicant的netlink数据过来
=>如果接收的buf数据区,buf[0]为'<',那么说明有level级别信息,所以将'<'...'>'数据剔除,然后wifi_wait_for_event函数返回[luther.gliethttp].
java/android/android/net/wifi/WifiMonitor.java
public class WifiMonitor {
...
public void startMonitoring() {
new MonitorThread().start();//启动java线程
}
class MonitorThread extends Thread {
public MonitorThread() {
super("WifiMonitor");
}
public void run() {
for (;;) {
ensureSupplicantConnection();//=>WifiNative.connectToSupplicant调用jni函数android_net_wifi_connectToSupplicant
String eventStr = WifiNative.waitForEvent();//=>调用jni函数android_net_wifi_waitForEvent
//private static final int CONNECTED = 1;
//private static final int DISCONNECTED = 2;
//private static final String eventPrefix = "CTRL-EVENT-";
//private static final int eventPrefixLen = eventPrefix.length();
//private static final String connectedEvent = "CONNECTED";
//private static final String disconnectedEvent = "DISCONNECTED";
String eventName = eventStr.substring(eventPrefixLen);//去掉"CTRL-EVENT-"字符串
int nameEnd = eventName.indexOf(' ');//找到随后的空格位置,这在wpa_supplicant发送时
//#define WPA_EVENT_CONNECTED "CTRL-EVENT-CONNECTED "中,已经内置空格了.
if (nameEnd != -1)
eventName = eventName.substring(0, nameEnd);
int event;
if (eventName.equals(connectedEvent))//检测netlink过来的字符串action类型
event = CONNECTED;
else if (eventName.equals(disconnectedEvent))
event = DISCONNECTED;
...
int ind = eventStr.indexOf(" - ");//CTRL-EVENT-CONNECTED - Connection to ...
if (ind != -1)
eventData = eventStr.substring(ind + 3);
2:26 PM | Add a comment | Permalink | Blog it | Android

2009年11月26日 星期四

tty driver

http://blog.chinaunix.net/u1/51562/showart_1092220.html

2009年11月19日 星期四

ip camera

這是屬於Justin的個人Blog, 用來紀錄一些事物或是技術文件 ...
Justin

Links
About Justin
Album
Bookmarks
Guestbook
Tags
3C產品 (13)
Computer (3)
Others (15)
USB Webcam
􀁺 Vimicro Zc301P

實驗步驟:

ARM-based IPCam實驗步驟共可分為以下幾個部分:
A.Host環境設置
B.Webcam驅動程式移植
C.Webcam擷取軟體移植
D.Web Server編譯
E.Target端軟體配置與實測

A.Host環境設置

(1)在 Linux Host 上安裝 Toolchain (Cross Compiler) for NAV-270
(Host)# cd /
(Host)# tar –jxvf cross-3.4.1.tar.bz2
(Host)# export PATH=/usr/local/arm/3.4.1/bin/:$PATH
(Host)# arm-linux-gcc –v
看是否有gcc 3.4.1版本訊息出現,來得知是否已正確引入路徑。

(2)在 Linux Host 上解開2.6.9 Kernel Source Code (/usr/local/arm)
(Host)# tar –zxvf linux-2.6.9-nav-0809.tar.gz

B.Webcam驅動程式移植

(1)使用mxhaard.free.fr提供的驅動程式Linux kernel webcams Driver GSPCA / SPCA5xx來驅動Vimicro晶片之Webcam:
官方網頁: http://mxhaard.free.fr/

(2)下載usb-2.6.12LE06.patch.tar.gz
Driver 下載: http://mxhaard.free.fr/spca50x/embedded/KernelPatch/

(3)進行Kernel Patch
(Host)# cd /usr/local/arm/linux-2.6.9-nav/drivers/usb
(Host)# tar zxvf usb-2.6.12LE06.patch.tar.gz
(Host)# patch –p1 <>下的Video for linux選擇為<*>,並已內含於Kernel。接著將 USB support
---> USB Multimedia devices選項下的USB SPCA5XX Sunplus Vimicro Sonix Cameras標記成,以編譯成Modules。

(5)編譯SPCA5XX Kernel Module
(Host)# make module

(6)取得SPCA5XX Kernel Module (spca5xx.ko)

C.Webcam擷取軟體移植
使用同為mxhaard.free.fr所提供的servfox來進行Webcam影像之擷取。
官方網站: http://mxhaard.free.fr/spca50x/embedded/Servfox/

(1)下載servfox-R1_1_3.tar.gz

(2)解開servfox
(Host)# tar zxvf servfox-R1_1_3.tar.gz

(3)編譯servfox
(Host)# cd servfox-R1_1_3
(Host)# mv Makefile.arm Makefile
(Host)# vi Makefile (確認Cross-Compiler)
(Host)# make

(4)取得servfox執行檔

D.Web Server編譯
使用www.acme.com提供的thttpd進行Web Server 安裝。

(1)下載 thttpd Source Code並解壓縮:
(Host)# cd /usr/local/arm
(Host)# wget http://www.acme.com/software/thttpd/thttpd-2.25b.tar.gz
(Host)# tar zxf thttpd-2.25b.tar.gz

(2)編譯 thttpd Web-Server
(Host)# cd thttpd-2.25b
(Host)# CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc ./configure host=arm-linux
(Host)# make

(3)取得thttpd執行檔

E.Target端軟體配置與實測

(1)備妥之程式與設定檔:
a.servfox (影像擷取與串流輸出程式)
b.spca5xx.ko (Webcam驅動程式)
c.thttpd (Web Server)
d.thttpd.conf (Web Server配置檔)
e.www目錄 (放置遠端監控Webcam之網頁程式)

thttpd.conf配置檔內容:
dir=/ramdisk/www
port=8080
user=nobody
nochroot
nosymlink
novhost

(2)遠端監控Webcam之網頁程式:
使用同為mxhaard.free.fr所提供的spcaview內含之http-java-applet來進行Webcam影像遠端觀看功能實
作,spcaview亦可於linux上編譯並直接與servfox進行影像串流擷取。
下載網址: http://mxhaard.free.fr/spca50x/Download/
下載spcaview-20071223.tar.gz
解開後於http-java-applet目錄中取得index.htm (原index-sample.html), control.jpg, JWebcamPlayer.jar三個檔案。

(3)將NAV270開機,並透過超級終端機由Com 1連上。

(4)使用udhcpc取得網路位址
(Target)# udhcpc
例如取得eth0之IP位址為192.168.1.105

(5)將程式檔案上傳到ARM開發版上:
(Target)# cd ramdisk
將程式與配置檔透過Zmodem協定上傳
(Target)# mkdir www
(Target)# cd www
將Web監控程式透過Zmodem協定上傳

(6)將Web監控程式設成可讀狀態
(Target)# chmod +r *

(7)將Webcam接上ARM開發版, 並載入驅動程式
(Target)# cd ..
(Target)# insmod spca5xx.ko
若成功載入驅動程式則會出現:
Using spca5xx.ko
Drivers/usb/media/spca5xx/spca_core.c: USB SPCA5XX camera found. Type Vimicro Zc301P 0x301b
Usbcore: registered new driver spca5xx
Drivers/usb/media/spca5xx/spca_core.c: spca5xx driver 00.57.06LE registered

(Target)# mknod /dev/video0 c 81 1
建立video設備節點,/dev/video0為設備名稱,c代表字元設備,81為主設備編號,1為從設備號

(8)執行servfox程式
(Target)# chmod 755 servfox
(Target)# ./servfox –h (查看可使用的參數)
(Target)# ./servfox –d /dev/video0 –s 640x480 –w 7070 &
目標裝置設為/dev/video0,擷取模式為640x480,以port 7070輸出影像串流。

(9)啟動thttp程式
(Target)# chmod 755 thttpd
(Target)# ./thttpd –C thttpd.conf

(10)於可連線的範圍內以一台具備java plugin的瀏覽器電腦開啟目標網頁:
於網址列輸入 http://192.168.1.105:8080/index.htm 即可觀看到Webcam畫面。

實驗問題記錄

第一次嘗試使用與編譯Linux Kernel 2.6.9 一樣的 Corss-compiler 3.4.1 gcc來編譯servfox可以無錯誤完成編譯,但於ARM平台上直行會出現ioctl錯誤與無法辨識Webcam的錯誤訊息- “Not a JPEG webcam sorry Abort! “,而後改用Corss-compiler 3.2.2 gcc即無此問題。

一般建立/dev/video設備節點時由於只有一個設備,通常輸入mknod /dev/video0 c 81 0,從設備號0代表僅有一個,但在此NAV270開發版上需要指定為1,判斷時可以透過/dev/v4l目錄下的節點來觀察,NAV270上推測具有預設之/dev/v4l/video0設備,而插入USB Webcab時可以觀察到會多出一個/dev/v4l/video1設備,因此從設備號需設為1。

2009年11月15日 星期日

speed up dd copy in linux

To speed up the dd command, you may try to set the block size:
dd if=system.img of=/dev/sdb2 bs=100K

it will help you to transfer in 100KB block size except in byte in last block. It will speed up the dump process a lot.

2009年11月11日 星期三

git usage

http://linux.yyz.us/git-howto.html

2009年11月8日 星期日

Android查看memory usage

Android查看memory usage
在adb shell裡有幾種方法可以看memory

1. android shell裡的top

PID CPU% S #THR VSS RSS UID Name

VSS -Virtual memory 的size
RSS -就是指physical 的page

不過在android上這兩項不一定是實際的數值
第一是這裡拿到的值是process可以用的memory space
而不是實際上已經使用的memory
第二是在android上很多processes之間有share
所以phy pages是可以被share的


2. 用busybox的top
不過...............那出來的值好像都怪怪的



3.用procrank

# procrank
PID Vss Rss Pss Uss cmdline

Uss是這個process exclusive 的memory

Pss 不是很清楚
不過好像是Uss 加上 RSS/ (用這塊shared memory的process數目)

procrank的source在 mydroid/extras/procrank

主要是利用 kernel 在2.6.25後一個新的功能
在/proc/pid/裡新加一個 pagemap
http://lwn.net/Articles/230975/


4. 如果要看java heap的使用量的話
dumpsys meminfo

** MEMINFO in pid 608 [com.android.phone] **
native dalvik other total
size: 4112 3655 N/A 7767
allocated: 3829 2821 N/A 6650
free: 266 834 N/A 1100
(Pss): 2087 1785 2877 6749
(shared dirty): 1124 3952 928 6004
(priv dirty): 1968 1380 556 3904

Objects
Views: 0 ViewRoots: 0
AppContexts: 5 Activities: 0
Assets: 3 AssetManagers: 3
Local Binders: 18 Proxy Binders: 14
Death Recipients: 1
OpenSSL Sockets: 0

SQL
heap: 142 dbFiles: 0
numPagers: 2 inactivePageKB: 24
activePageKB: 0

dumpsys的source在/mydroid/frameworks/base/cmds/dumpsys
張貼者: ALLSTARS 位於 下午 12:08

2009年11月6日 星期五

sd card benchmark software tool

HDBENCH 3.40 B3 簡體中文- - 全方位下載

2009年10月22日 星期四

android usb mtp mode

android-porting USB mtp
1 vold.conf

2. init.rc setprop persist.service.mount.umsauto 1

2009年10月8日 星期四

empty Trash

rm /home/name/.local/share/Trash/info/*

svn command line usage

svn status
export SVN_EDITOR=vim
SVN add xxx

2009年10月6日 星期二

贴上答案作参考--嵌入式研发工程师面试试题大全(ANSI C/C++方面的知识)

贴上答案作参考--嵌入式研发工程师面试试题大全(ANSI C/C++方面的知识)402674129 2008-3-15 19:35:48 收藏 | 打印 | 投票(15) | 评论(15) | 阅读(86153) ◇字体:[大 中 小] 看了一篇叫“嵌入式研发工程师面试试题大全”的文章,觉得里面的题目很有水平,我会分阶段做完这些题目,并贴出来接受大家的指正。今天先贴上“ANSI C/C++方面的知识 ”,有不妥之处希望博友能给出意见,而且有几道本人尚不清楚,需要大家帮助解决。



一.ANSI C/C++方面的知识
1、简答题。

1、 如何在C中初始化一个字符数组。

逐个字符赋值:char s[] = {‘A’,’B’,’C’,’D’};

字符串赋值:char s[] = {“ABCD”};

对于二维字符数组:char s[2][10] = {“cheng”,”jinzhou”};


2、 如何在C中为一个数组分配空间。

如果是栈的形式,Type s[N]定义后系统自动分配空间,分配的空间大小受操作系统限制;

若是堆的形式,Type *s; s = (Type *)malloc(sizeof(Type) * N); 分配的空间大小不受操作系统限制。


3、 如何初始化一个指针数组。

这里有必要重新对比一下指针数组与数组指针的差异。

a. 指针数组:数组里存储的是指针。

如:int * s[ 5 ] 表示数组s里存储了5个指向整型的指针。

Char * s[ 3 ] = {“aaaaa”,”bbb”,”ccccc”} 表示数组s里存储3个指向字符型的指针,分别指向字符串aaaaa、bbb、ccccc。

b. 数组指针:其实就是数组,里面存放的是数据。

如:int ( * s )[ 5 ] 表示数组s里存储了5个整型数据。


4、 如何定义一个有10个元素的整数型指针数组。

Int * s [ 10 ];


5、 s[10]的另外一种表达方式是什么。

* ( s + 10 )

二维数组S [ 5 ][ 8 ]的表示方法:*( *(s + 5) + 8 )


7、 要使用CHAR_BIT需要包含哪个头文件。

Include limits.h

在该头文件里 #define CHAR_BIT 8


8、 对(-1.2345)取整是多少? -1


9、 如何让局部变量具有全局生命期。

使用Static,局部变量就存储在全局区(静态区),便具有全局的生命期和局部的访问控制。


10、C中的常量字符串应在何时定义?

没有理解到题目的意思,我只是想说明一点,定义常量字符串后它属于const型,不能去修改它,否则程序出错。


11、如何在两个.c文件中引用对方的变量。

使用extern


12、使用malloc之前需要做什么准备工作。

定义一个指针后就可以malloc了。


13、realloc函数在使用上要注意什么问题。

Realloc后返回的指针与之前malloc返回的指针指向的地址不同。


14、strtok函数在使用上要注意什么问题。

首次调用时,s必须指向要分解的字符串,随后调用要把s设成NULL


15、gets函数在使用上要注意什么问题。

这里要将Scanf( )、gets( )放在一起比较。Scanf( )是遇到空格就判断为输入结束,而gets( )则遇到回车才判断为输入结束。


16、C语言的词法分析在长度规则方面采用的是什么策略?

尚不清楚,望博友能告知,万分感谢!


17、a+++++b所表示的是什么意思?有什么问题?

根据自增运算符的右结合性,它是(a++)+(++b)的意思,但有的编译器里省略括号就不能通过,同时也降低了程序可读性。


18、如何定义Bool变量的TRUE和FALSE的值。

#define TRUE 1

#define FALSE 0


19、C语言的const的含义是什么。在定义常量时,为什么推荐使用const,而不是#define。

Const是只读的意思,它限定一个变量不允许被改变。

#define缺乏类型检测机制,在预处理时候有可能引发错误。

Const方面的其它知识扩展:

问题1:const变量 & const 限定的内容

下面的代码编译器会报一个错误,请问,哪一个语句是错误的呢?

  typedef char * pStr;

  char string[4] = "abc";

  const char *p1 = string; // *p1 作为整体不能被修改,但p1可以修改,p1++合法

  const pStr p2 = string; //p2作为一个整体,不能被修改,但是下面的p2++非法修改

  p1++;

  p2++;

     

问题2:const变量 & 字符串常量

请问下面的代码有什么问题?

char *p = "i''''''''m hungry!"; //定义的是字符串常量
  p[0]= ''''''''I'''' //不能修改字符串常量
  

问题:const变量 & 字符串常量2

  char a[3] = "abc" 合法吗?使用它有什么隐患?

没有考虑到字符串结束符‘\0’,所以会产生意想不到的错误。

  比如以下程序:

int main()

{

int i;

char p[6] = {''''''''a'''''''',''''''''b'''''''',''''''''c'''''''',''''''''d'''''''',''''''''e'''''''',''''''''f''''''''};

printf("%s",p);

while(1);

return 0;

}

运行后显示: abcdef@

问题3:const & 指针

类型声明中const用来修饰一个常量,有如下两种写法,那么,请问,下面分别用const限定不可变的内容是什么?    

1)、const在前面

a. const int nValue; //nValue是const

把类型int撇开,变量nValue作为一个整体,因此 nValue是const型;

b. const char *pContent; //*pContent是const, pContent可变

把类型char撇开,变量 *pContent作为一个整体,因此 *pContent是const型;
c. const (char *) pContent;//pContent是const,*pContent可变

把类型char * 撇开,注意这里(char * )是一个整体,而变量 pContent作为一个整体,因此 pContent是const型;

d. char* const pContent; //pContent是const,*pContent可变

const与变量间没有类型,变量 pContent作为一个整体,因此 pContent是const型;

e. const char* const pContent; //pContent和*pContent都是const

这里分为两层,外层:把类型char 撇开,变量 * const pContent作为一个整体,因此 * pContent是const型;内层:没有类型,因此 pContent 是 const 型。

2)、const在后面,与上面的声明对等 (这类型更容易判断)

a. int const nValue; // nValue是const

const与变量之间没有类型,const后面那部分整体是const型,因此nValue是const型

b. char const * pContent;// *pContent是const, pContent可变

const与变量之间没有类型,const后面那部分整体是const型,因此 * pContent是const型

c. (char *) const pContent;//pContent是const,*pContent可变

const与变量之间没有类型,const后面那部分整体是const型,因此 pContent是const型

d. char* const pContent;// pContent是const,*pContent可变

const与变量之间没有类型,const后面那部分整体是const型,因此 pContent是const型

e. char const* const pContent;// pContent和*pContent都是const

分为两层,外层:撇开类型char,const后面那部分整体* const pContent是const型,因此 * pContent是const型;内层:const与pContent之间无类型,因此pContent是const型。

  

C++中CONST

C中常用:#define 变量名 变量值定义一个值替代,然而却有个致命缺点:缺乏类型检测机制,这样预处理理在C++中成为可能引发错误的隐患,于是引入const.

const使用:

1. 用于指针的两种情况:const是一个左结合的类型修饰符.

int const *A; //A可变,*A不可变

int *const A; //A不可变,*A可变

2.限定函数的传递值参数:

void function(const int Var); //传递过来的参数在函数内不可以改变.

3.限定函数返回值型.

const int function(); //此时const无意义

const myclassname function(); //函数返回自定义类型myclassname.




20、C语言的volatile的含义是什么。使用时会对编译器有什么暗示。

volatile的本意是“易变的”

由于访问寄存器的速度要快过RAM,所以编译器一般都会作减少存取外部RAM的优化,但有可能会读脏数据。当要求使用volatile 声明的变量的值的时候,系统总是重新从它所在的内存读取数据,即使它前面的指令刚刚从该处读取过数据。而且读取的数据立刻被保存。

精确地说就是,优化器在用到这个变量时必须每次都小心地重新读取这个变量的值,而不是使用保存在寄存器里的备份。

下面是volatile变量的几个例子:
1). 并行设备的硬件寄存器(如:状态寄存器)
2). 一个中断服务子程序中会访问到的非自动变量(Non-automatic variables)
3). 多线程应用中被几个任务共享的变量
嵌入式系统程序员经常同硬件、中断、RTOS等等打交道,所用这些都要求volatile变量。不懂得volatile内容将会带来灾难。

Volatile的完全扩展:
1). 一个参数既可以是const还可以是volatile吗?解释为什么。

是的。一个例子是只读的状态寄存器。它是volatile因为它可能被意想不到地改变。它是const因为程序不应该试图去修改它。
2). 一个指针可以是volatile 吗?解释为什么。

是的。尽管这并不很常见。一个例子是当一个中服务子程序修该一个指向一个buffer的指针时。
3). 下面的函数有什么错误:
int square(volatile int *ptr)
{
return *ptr * *ptr;
}
这段代码的有个恶作剧。这段代码的目的是用来返指针*ptr指向值的平方,但是,由于*ptr指向一个volatile型参数,编译器将产生类似下面的代码:
int square(volatile int *ptr)
{
int a,b;
a = *ptr;
b = *ptr;
return a * b;
}
由于*ptr的值可能被意想不到地该变,因此a和b可能是不同的。结果,这段代码可能返不是你所期望的平方值!正确的代码如下:
long square(volatile int *ptr)
{
int a;
a = *ptr;
return a * a;
}

2009年10月5日 星期一

Embedded System Interview Questions:

Embedded System Interview Questions:

1. Can structures be passed to the functions by value? 1.結構体是否能传值给函数?
2. Why cannot arrays be passed by values to functions? 2.为什么数组不能传值给函数?
3. Advantages and disadvantages of using macro and inline functions? 3.宏定义和内联函数的利弊是什么?
4. What happens when recursion functions are declared inline? 4.将递归函数定义为内联函数会出现什么情况?
5. Scope of static variables? 5.静态变量的有效范?
6. Difference between object oriented and object based languages? 6.面向对象与面向基础的区别是什么?
7. Multiple inheritance - objects contain how many multiply inherited ancestor? 7.多态继承能包含多少祖先级的多态?
8. What are the 4 different types of inheritance relationship? 8.4种继承关系是什么?
9. How would you find out the no of instance of a class? 9.如何找出无实例类?
10. Is java a pure object oriented language? Why? 10.JAVA是纯面向对象语言吗?为什么?
11. Order of constructor and destructor call in case of multiple inheritance? 11.是否允许再多态种调用构造函数和析构函数?
12. Can u have inline virtual functions in a class? 12.在你的类种是否会含有内联虚函数?
13. When you inherit a class using private keyword which members of base class are visible to the derived class? 13.在什么情况下你继承的私有类种成员是基类的显性成员?
14. What is the output of printf("\nab\bcd\ref"); -> ef 14.printf("\nab\bcd\ref"); 会输出什么?
15. #define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why? 15.#define cat(x,y) x##y 链接 x to y.但是cat(cat(1,2),3)不能扩展同时会有预处理警告,为什么?
16. Can you have constant volatile variable? Yes, you can have a volatile pointer? 16.是否可以有可变恒常量?如果是是否有可变指针?
17. ++*ip increments what? it increments what ip points to 17++*ip增加了什么?它将IP指向了什么?
18. Operations involving unsigned and signed — unsigned will be converted to signed 18.操作类型包括符号型和非符号型---非符号型会转换成符号型?
19. a+++b -> (a++)+b 19.a+++b->(a++)+b ji
20. malloc(sizeof(0)) will return — valid pointer 20.malloc(sizeof(0)) 将会返回的有效指针
21. main() {fork();fork();fork();printf("hello world"); } — will print 8 times. 21.main() {fork();fork();fork();printf("hello world"); } 会打印8次?
22. Array of pts to functions — void (*fptr[10])() 22.指针数组函数 void (*fptr[10])()
23. Which way of writing infinite loops is more efficient than others? there are 3ways. 23.如何写死循环更有效?
24. # error — what it does? 24.#ERROR是干吗的?
25. How is function itoa() written? 25.如何实现itoa()?
26. Who to know wether system uses big endian or little endian format and how to convert among them? 26.谁去分析系统使用了大系统还是小系统。(大头小头)
Intel的AISC指令都是低字节在前,苹果等Power PC的cpu使用的是RISC指令集,都是高字节在前。如何转变他们?
27. What is interrupt latency? 27.什么是中断响应?
28. What is forward reference w.r.t. pointers in c? 28.什么在C中分析w.r.t. pointers?
29. How is generic list manipulation function written which accepts elements of any kind?
30. What is the difference between hard real-time and soft real-time OS? 30.软实时操作系统和硬实时操作系统的区别?
31. What is interrupt latency? How can you recuce it? 31.什么是中断潜伏?你如何识别它?
32. What is the differnce between embedded systems and the system in which rtos is running? 32.嵌入式操作系统和实时操作系统的区别?
33. How can you define a structure with bit field members? 33.如何定义 bit field members的結構体
34. What are the features different in pSOS and vxWorks? 34.PSOS和VXWORKS功能区别有那些?
35. How do you write a function which takes 2 arguments - a byte and a field in the byte and returns the value of the field in that byte? 35......
36. What are the different storage classes in C? 36.C中的存储类有什么不同?
37. What are the different qualifiers in C? 37.C中有什么不同的限定?
38. What are the different BSD and SVR4 communication mechanisms BSD与SVR4通讯有什么不同?

Persional Prospectives:

1.

Q1. No they are always passed by reference. Think. Size of structure can be arbitrarily large. Q2. Same as above. Q5. Lifetime of process. Q9. Declare a static variable, class variable, and increment(decrement) for every constructor (destructor) called. Q11. Constructor. Base to current. Destructor. current to base. Both are done recursuively. Q13. NONE Q14. $> acd ef ->ef is wrong, what happened to acd? Q16. You can have a constant pointer to a volatile variable but not a constant volatile variable. Q26. Write a union of int and 2 chars. Store as int retrieve as chars. Q 27. Time taken between INT req and INT service. Q33. Study Let us C, Yeshwant Kanetkar

Tech Interviews comment by Taran
2.

Q. 13 Answer posted is wrong. Public & protected members of base class will be visible to derived class, but not its objects.

Tech Interviews comment by Sumeet
3.

Q1 - YES, a complete structure can be passed. Regarding the size, it is true that they can be very large and hence it is not a good practice to do so. In any case, one can do if one wants to.

Tech Interviews comment by Bhaskar
4.

Q3. When using macro you can’t use data type while passing it. But in Inline function you can have data types so that it can be checked. e.g MACRO : ADD(a,b) INLINE : inline void Add(int a,int b );

Tech Interviews comment by VijayaKumar
5.

Q1. Yes structure can be passed by value but the overhead of copying large values will be there. hence not usable. We should pass it by pointer. Q2. Individual element can be passed by value of course. But not whole array. Q5. It is alive lifetime of process, and its scope is limited to function in which it is defined. file1.c ********** static int i; void main() { …….. } file2.c ********** extern int i; //error

If declared global then it is visible in that file only. Q6. Object oriented language have Inheritance, polymorphism etc. But object based language only deal with object. Q7. If class D:public A,B,C {} then three ancestors Q8. public ,private, protected, virtual Q30. Hard RTS is having deadline defined and it is life critical ,should be reliable. late answer is wrong answer. in Soft RTS,process time should be predictable and reliable.

Tech Interviews comment by Pawan Kumar
6.

Q36.What are the different storage classes in C? A:Auto,Register,Static,Extern

Tech Interviews comment by MKS
7.

Q5 Scope of static variables is only within the block where it is declared. But the lifetime is till the process is running

Tech Interviews comment by Satish Parande
8.

Questin???

How can we dynamically allocate memory without using malloc() or calloc() or realloc()?Explain in Breif.

Can any one help in finding this answer to this question……

Tech Interviews comment by Midhun V
9.

In Java, we place even the Main() function inside a CLASS. But it is not the case with C++.

So, i think this is one of the answers you can say, JAVA is Fully Obejct Oriented.

Tech Interviews comment by vsvraju
10.

Q11 : Base-class constructors are called in the order in which inheritance is specified in the derived-class definition. The order in which the Base-class constructors are specified in the derived-class member initializer list does not effect the order of construction.

Tech Interviews comment by vsvraju
11.

Q 12: Yes we can have. you are never guaranteed that a routine is inlined. It is only a suggestion to the compiler. If the routine is either too complicated or a virtual function,then a static copy of the routine will be placed in the compiled module. Thus, a routine that was coded as inline may cause a performance degradation because it may consume much more space when it is not physically inlined. With a virtual function, a copy of that routine will be created for every module that has at least one instantiation of that class.

Q 13: NONE. None of the Public, Protected and Private data members are visible.

Q 16: YES. We can have a const volatile variable. a volatile variable is a variable which can be changed by the extrenal events (like an interrput timers will increment the voltile varible. If you dont want you volatile varibale to be changed then declare them as “const volatile”.

Q 17. I will explain this with an example:

int a = 10; int *p = &a; // suppose &a = 4010 (address of a)

Because both ++ and * are unary operators, the are calculated from right to left –> ++ (*p)

++*p will inrement 4010 by 4 (int size) -> ++*p will have the value 4014.

Q 21: It will print 8 times. Because, each fork will print twice. if u flush, (using “fflush”), then it will be printed only once. thats is you need to flush the iostreams.

Q 30:

In Hard RTOS the latency should be less the 20ns (nano sec) in Soft RTOS the latency range 3ns - 20ns is also acceptable.

Tech Interviews comment by vsvraju
12.

I THINK A BALOON CAN HAVE TO MUCH ELECTRICITY

Tech Interviews comment by SANDRA
13.

Java is not a pure object oriented language as “everything” in java is not an object. It still has primitive data types such as int, char, etc. which are NOT objects. Ruby is an example of a pure object oriented language, where “everything” is an object, even int.

Tech Interviews comment by Karan
14.

16. It is possible to have “const volatile” declaration. This indicates that the variable defined like this is not possible to change within that context. It can be changed by an external event. const declaraion just says that it will be readonly within the context, that area can be modified by an interrupt routine or another process.

18. Operations involving unsigned and signed - The signed data will be converted to unsigned - Refer arithemetic conversion rules in K&R

24. #error is used for displaying an error while compilation. for eg.

#ifdef ABC printf(”ABC”); #else #ifdef DEF printf(DEF); #else #error “Declaration not done” #endif

30. Hard RTOS is system which will be having major problems if the specified time limit is crossed. For eg. missiles Soft RTOS is systems which will not be having major problems if the specified limit is crossed. For eg. real time audio steaming. But for both exceeding the time limit is concidered as error.

31. Interrupt latency is the time period between interrupt on the pin to the execution of 1st instuction in the interrupt routine. THis will depend upon the processor. If the execution time for the instruction is less (like in RISC) this time will also be less. If register storage is required the time will be less in the processors in which remapping of registers is present as this can be done in a single instruction.

32. RTOS systems are embedded systems with time criticality. 33.

Tech Interviews comment by deepak
15.

What is interrupt latency? It is the time interval between an interrupt has occured till the time it has been serviced. Mathematically:

Int(lat)= rt+pt+dt

where rt=recognition time pt=process time dt=dispatch time

Tech Interviews comment by Ramesh K.B.
16.

Q. Write a function to reverse contents in a single linked list without reversing the links? Can anyone pls help me out?

Tech Interviews comment by Ramesh K.B.
17.

Q.Can we have a constant volatile variable?

Soln: YES.We can have a const volatile variable. Volatile variable is one which can be changed by user,ie programmer as well as by the external events.If we declare it as const volatile,then user cannot change but can be changed by the hardware.

Tech Interviews comment by Ramesh K.B.
18.

20. malloc(sizeof(0)) will return — valid pointer yes. sizeof(0) –> int size and it is 4

25. itoa(…) itoa(pointer to storage buffer,int to convert, base(eg.binary,oct,hex,dec))

33. typedef struct regset{ unsigned char onebit:1; unsigned char twobit:2; …. }regset;

Tech Interviews comment by Ramesh.V
19.

i have an query regarding , interupts in Embedded systems

can we use the interrupt function call same as ordinary function,i.e. can we pass arguments and return values from an ISR routine.

Tech Interviews comment by Sushil Rana
20.

what happens when we put an infinite loop using for

for(;;) what is the condition expression value by default.

Tech Interviews comment by Sushil Rana
21.

Write a function to reverse contents in a single linked list without reversing the links? Can anyone pls help me out?

Count number of nodes in the linear linked list. Let say cnt is the number of nodes and index = 0. You can swap content of index th node and cnt-index th node, each time increment index by 1. All the contents will be reversed.

Tech Interviews comment by Hetal
22.

Scope of static variables? scope of static variables is limited to the local function in which it is defined and to the functions calling the stattic variable.

Tech Interviews comment by Guneet
23.

How virtual tables are created in case of abstract classes? Is it the same as in non-abstract classes? Virtual tables r created on stack or Heap?

Tech Interviews comment by Satish Parande
24.

why only reference is passed as a parameter in Copy constructor? why not address?

Tech Interviews comment by Satish Parande
25.

is it possible to call delete from the class member function ?

Tech Interviews comment by Mrinmay Biswas
26.

q.3. —- Inline is only a request that may be rejected also based on optimization policies,while macro is immediately replaced before compilation. —- type checking is not possible in Macros, but in inline its possible.