Posts Tagged with linux

选择适合你的Linux发行版


zegeni Studios 发布了一个小测试来帮你选择适合你的Linux发行版,如果你正在迷茫中,不妨来试试: Linux Distribution Chooser

这个是我的测试结果:

Do you know what a “Linux distribution” is?
— Yes

Have you successfully installed an operating system before?
— Yes

Do you know how to “partition” a hard drive?
— Yes

Which kind of installer do you prefer?
— I don’t care, as long as it’s easy and it works

How would you rate your technical skills?
— Intermediate / Advanced

What kind of computer are you installing on?
— A portable computer / laptop

What is the primary use of this computer?
— Home / Office workstation

Do you have a 64-bit processor?
— Yes

How old is the computer you are installing Linux on?
— It’s (almost) still shining!

How would you rate your knowledge of linux?
— Experienced – I know my way around

What package management system do you prefer?
— I prefer deb

Do you need development packages installed / easily available?
— Yes, easily available

What desktop environment do you prefer?
— I prefer GNOME

Do you need easy access to a lot of ready-to-run software?
— No thanks / I don’t care

Will you be installing the distribuion on a PC or a Mac?
— I am installing it on a Mac

Please select what best fits you
— I don’t mind testing new, exciting, but experimental stuff

Does the Linux distro have to be free (gratis)?
— Yes

Do you want to include Live CDs in the results?
— No, just standard distributions

Result:

Debian
Homepage: http://www.debian.org/

Debian is a free operating system (OS) for your computer. An operating system is the set of basic programs and utilities that make your computer run. Debian GNU/Linux provides more than a pure OS: it comes with over 15490 packages, precompiled software bundled up in a nice format for easy installation on your machine.

结果嘛,还是很符合我的胃口滴

minicom接受键盘输入


默认的minicom是无法接受键盘输入的(#$R%@#^&%&&^#%$@% 不知道怎么想的。。。)

Ctrl + A -> O -> Serial Port Setup -> Hardware Flow Control

改为 No

即可

另类Linux发行版图片


http://www.arouse.net/despair-linux/ 转来的图片,不多说什么了,了解的xd自然明白

Slackware

Redhat

Mandrake

Gentoo

Fedora

Debian

Caldera

Ubuntu

PS: 个人认为 ubuntu 这个最形象了…

linux的ir设备


一台Sigma的板子,遥控器异常灵敏,拖了好久终于无法忍受,决定解决一下

看驱动源码,发现一个ioctl,IR_IOCSETWAITPERIOD,驱动(2.4内核)本来的默认设定是100,于是设定为1000


ioctl (fd, IR_IOSETWAITPERIOD, 1000);


问题解决,不过还是不太明白,这个period的时间单位是什么呢?毫秒?微秒?纳秒?知道的兄弟告诉一声啊

关于标准c的select


不知道哪个哥们写得,从ir红外线设备获取数据居然轮询,搞得程序一起来CPU占用率就达到99%,哪怕什么也不做…

于是动手改成对设备的fd进行select,block至获取数据或超时


int select (int nfds, fd_set *read_fds, fd_set *write_fds, fd_set *except_fds, struct timeval *timeout)


结果发现:

  • 设备一定要以block方式打开,即不能加O_NONBLOCK的mask

  • fd_set在select返回时会变化,如果重新对同一个设备进行select,则需要重新调用FD_SET来加入fd到fd_set

    不可能没学过的,居然一点印象都没有了…诶

    其次, 后来发现select的另一个用途—sleep线程

    在多线程程序里,在某个线程内调用sleep,usleep会导致整个程序的sleep,相信这个在大多数情况下都不是大家所期望的结果,那么你可以这样:


    struct timeval timeout;
    timeout.tv_sec = 1; /* 1s */
    timeout.tv_usec = 0; /* 0 microsecond */

    select (1, NULL, NULL, NULL, &timeout);