2015年3月23日 星期一

Linux kernel platform

http://www.itkee.com/os/detail-81d.html

2.6起引入了一套新的驅動管理與註冊機制  platform_device//platform_driver
platform_driver_register()的註冊過程

1. platform_driver_register(&XXX_driver)
2. driver_register(&drv->driver)
3. bus_add_driver(drv)
4. driver_attach(drv)
5. bus_for_each_dev(drv->bus, NULL, drv, __driver_attach)
6. __driver_attach(struct device * dev, void * data)
7. driver_probe_device(drv, dev)
8. really_probe(dev, drv)

2015年3月20日 星期五

使用request_irq request_threaded_irq 註冊ISR

http://blog.csdn.net/gx19862005/article/details/18740705

http://blog.chinaunix.net/uid-21977330-id-3755609.html

request_threaded_irq() 是Linux kernel 2.6.30之後新加的irq handler API

handler將不是在interrupt context裡執行;而是在新增的thread中執行,如此可以確保不被綁架,擁有所有workqueue的特性,卻省去了創建、初始化、調度workqueue等多個步驟。

支援threaded interrupt handler

int request_threaded_irq(unsigned int irq, irq_handler_t handler, irq_handler_t thread_fn, unsigned long irqflags, const char *devname, void *dev_id)

irq是中斷號
handler是在發生中斷時,首先要執行的動作,類似舊機制中的top half 
最後可return IRQ_WAKE_THREAD來喚醒中斷線程,或return IRQ_HANDLE而不執行中斷線程
thread_fn是要在線程中執行的動作,類似舊機制中的bottom half
irqsflasg多了一個IRQF_ONESHOT,用來指示在中斷線程執行完之後再打開該中斷


[盜文] 柴靜《穹頂之下》存在的問題以及輿論爭議背後的政治博弈

原出處  http://www.weibo.com/p/1001603818114662944115
李晓鹏1982的微博

2015年3月11日 星期三

Ubuntu 指令 安全移除usb碟

http://manpages.ubuntu.com/manpages/oneiric/man1/udisks.1.html

看一堆文章  想查出有沒有內建的指令可以取代nautilus內的 [Safely Remove Drive] 按鈕

就是找不到!!!

基本的是umount, eject, unbind或是remove
但都沒有像 [Safely Remove Drive] 那樣連帶把電關掉
echo '4-1' |sudo tee /sys/bus/usb/drivers/usb/bind
echo '4-1' |sudo tee /sys/bus/usb/drivers/usb/unbind


最後還是根據論壇去安裝了 udisks

udisks --detach /dev/sdb

看起來一樣了.....  還是不爽

http://pintant.cat/2012/05/12/power-off-usb-device/
I asked on the linux-usb mailing list (question, see one of the relevant answers (from Alan Stern). In short: not possible. When using a USB hub it’s then maybe possible -some models only-. The answer includes a link to a small program to try to disable the port. I could disable the port, but the device had still power.

http://askubuntu.com/questions/532586/what-is-the-command-line-equivalent-of-safely-remove-drive


領帶結打法



2015年3月10日 星期二

Apple Watch 發表

http://www.mobile01.com/newsdetail.php?id=16415

蘋果把智慧型手錶做對了

他先花了一堆時間介紹這隻手錶提供的各種款式顏色 採用的精美不鏽鋼材質 高科技工法 抗磨玻璃 讓大家欣賞手錶的裡裡外外



******  這才叫做手錶發表會  ******

然後才介紹你能如何使用那些你早已知道的功能: 心跳記錄 收發訊息 看天氣 看地圖 當然還有看時間

最後最後才介紹手錶不應該有  但所有mobile device都脫離不了的弱點 : 你如何每天幫它充電


這才是正確的智慧型手錶的做法: 你理應以做一隻手錶的態度去動工  智慧型功能是你的額外賣點  並且最好別讓客戶想起他的手機早已做的到幾乎所有事情 (否則他可能不會再額外掏錢出來買另一個mobile device)

2015年3月4日 星期三

英文有字母順序可排序 中文沒有

在一群資料中要找某個特定字串很累

有沒有能從外型上做排序判斷的標準?

目前想到  用筆畫順序

第一筆