Time to refresh memory:
modprobe reads the modules and its dependencies from /lib/modules/$(uname -r)/modules.dep or modules.dep.bin. modprobe is a smarter tool which will also load the dependent modules.
modprobe accepts the name of a .ko file in /lib/modules/$(uname -r) and aliases (modules.alias.bin).
insmod takes file name or the exact paths to files. The module does not have to reside in /lib/modules/$(uname -r), but dependencies are not automatically loaded. This is the lower program used by modprobe to load modules.
rmmod removes a kernel name based on the name from /proc/modules. This name does not necessarily have to be the same as the one passed to modprobe (for the nvidia-current file, this is nvidia for example).
modinfo accepts a filename, or the filename without .ko suffix in /lib/modules/$(uname -r).
Tuesday, September 17, 2013
Monday, August 19, 2013
guake - a cool top down terminal for Gnome
http://guake.org/
It's just cool....
try it:
It's just cool....
try it:
# sudo aptitude install guake
Sunday, August 18, 2013
nohup - run a command immune to hangups (terminal close)
Say you're on business trip, ssh to a remote server, run a command to compile some huge source code which take hours, or process date which takes days, but then you need to close your laptop and run the next site. Closing the terminal will also kill all the process you started. What should you do?
nohup is is there to help you.:
nohup is is there to help you.:
Take an example of compiling a fresh configured buildroot, depends on the packages selected it takes hours/days to download the sources and compile:NAME nohup - run a command immune to hangups, with output to a non-tty SYNOPSIS nohup COMMAND [ARG]... nohup OPTION DESCRIPTION Run COMMAND, ignoring hangup signals.
Then the buildroot compilation will continue after you close your terminal/laptop.EXAMPLE $ nohup make buildroot &
Saturday, August 17, 2013
Audacious Headless and Keyboard Shortucts
Audacious is an open source audio player, a descendant of XMMS, light-weighted and very similar to MS Windows winamp.
However, by default it does not recognize keyboard shortcuts play/pause/prev/next.
In Audacious preferences (right click on the the right lower corner "a" logo, in the pop-up menu choose preference), -->plugins --> general tab --> check the "Global Hotkey" plugin, then it would recognize those shortcut keys. I would prefer Audacious to enable this by default..
However, by default it does not recognize keyboard shortcuts play/pause/prev/next.
In Audacious preferences (right click on the the right lower corner "a" logo, in the pop-up menu choose preference), -->plugins --> general tab --> check the "Global Hotkey" plugin, then it would recognize those shortcut keys. I would prefer Audacious to enable this by default..
Saturday, July 13, 2013
Gaming mouse too fast (sensitive) under Ubuntu Linux
I've got a set of RAPOO keyboard and mouse. I bought it just because it's a set of really compact and quiet keyboard and mouse, but after I got it I figured it's for gaming so the speed is crazily fast when I use it under Linux. I went to the "Mouse and Touchpad" to turn Acceleration and Sensitivity to the minimum value but it doesn't work. Finally I've done the following to slow it down.
For your mouse, the last 2 commands you may need to play around with the numbers to find the optimum value.gideon@gideon-desktop-i5:~$ xinput --list --short ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ RAPOO RAPOO 5G Wireless Device id=9 [slave pointer (2)] ⎜ ↳ MemsArt MA144 RF Controller id=11 [slave pointer (2)] ⎜ ↳ MemsArt MA144 RF Controller id=12 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Power Button id=7 [slave keyboard (3)] ↳ RAPOO RAPOO 5G Wireless Device id=8 [slave keyboard (3)] ↳ MemsArt MA144 RF Controller id=10 [slave keyboard (3)] ↳ MemsArt MA144 RF Controller id=13 [slave keyboard (3)] gideon@gideon-desktop-i5:~$ xinput --set-prop 9 "Device Accel Velocity Scaling" 1 gideon@gideon-desktop-i5:~$ xinput --set-prop 9 "Device Accel Constant Deceleration" 2
Friday, February 08, 2013
DS89C450 SDCC getchar() function
After the putchar() function you probably need the getchar() function. The function is also quite simple. Just check the Receive Interrupt flag instead of Transmit Interrupt in the putchar(). I'm using mode 0 for the serial port, the RI_0 is set at the end of the 8th bit. When the flag is set, clear it then read and return the data:
If you want to read a line input you can use gets():char getchar(void) { char c; while (!RI_0) ; RI_0 = 0; c = SBUF0; return c; }
char line[100]; gets(line);
Thursday, February 07, 2013
DS89C450 SDCC serial init and printf putchar functions
sdcc is a very handy tool but it isn't magic. For embedded system even a "hello world" printf function isn't easy. If you just put printf in your code and ask sdcc to compile, it will complain because it doesn't know how the system connects to the serial port:
The solution is easy; just define the putchar() function to describe which buffer (e.g. UART0 or UART1) the characters should go to. Here is my example code of "Hello World" and blinking some LED on the DS89C450 evaluation kit:
http://www.maximintegrated.com/app-notes/index.mvp/id/3477
Only this document was written some time ago and now sdcc will warn it uses some deprecated macros. But the file still works fine and updating the keywords are trivial task.
You get the same error for similar printf stdio.h functions (e.g. vprintf, sprintf, vsprintf, puts etc...)?ASlink-Warning-Undefined Global '_putchar' referenced by module 'hello' make: *** [hello] Error 1
The solution is easy; just define the putchar() function to describe which buffer (e.g. UART0 or UART1) the characters should go to. Here is my example code of "Hello World" and blinking some LED on the DS89C450 evaluation kit:
Then it works! Download your firmware to the evKit and then you can see the "Hello World" displaying on your terminal! If nothing comes up then check if the LED are blinking. If LED are not blinking then the firmware is not running.. something is probably really wrong. I set 14400 as baudrate because the evKit uses the same baudrate for the in-system programming. I just don't want the hassles of changing the baudrate of my terminal all the time. If you need the register file sdcc_reg420.h of the above example code, you can get it in the following link:#include <stdio.h> #include "sdcc_reg420.h" void delay(void) { unsigned int i, j; for(j=0; j<12; j++) { for(i=0; i<3000; i++) { } } } void serialInit() { TMOD = 0x21; // Timer 1: 8-bit autoreload from TH1 TH1 = 220; // 14400 baud rate CKMOD = 0x38; // Use system clock for timer inputs T2CON = 0x00; // Serial 0 runs off timer 1 overflow TCON = 0x50; // Enable timers 0 and 1 SCON0 = 0x50; // Enable serial port 0 SBUF0 = ' '; } void putchar (char c) { while (!TI_0) /* assumes UART is initialized */ ; TI_0 = 0; SBUF0 = c; } void main(void) { serialInit(); // Initialize serial port 0 printf("\rHello World!!\n"); while(1) { P1 = 0x01; delay(); P1 = 0x02; delay(); P1 = 0x04; delay(); P1 = 0x08; delay(); } }
http://www.maximintegrated.com/app-notes/index.mvp/id/3477
Only this document was written some time ago and now sdcc will warn it uses some deprecated macros. But the file still works fine and updating the keywords are trivial task.
Wednesday, February 06, 2013
git clone --mirror and update
To create a git repository mirror is fairly easy:
$ git clone --mirror ssh://user@example.com/path/to/repoTo update the mirror from the original source:
$ git remote update
ssh-add "Could not open a connection to your authentication agent"
I came accross some occurence when I use ssh-add to add a ssh key it gives me the following error:
Could not open a connection to your authentication agent.
and the following command did the trick sometimes...
$ exec ssh-agent bashbut I still have the problem when I use ssh-add under Cygwin in Windows system.... couldn't find a solution :(
Saturday, February 02, 2013
Linux serial baud 14400 and DS89C450 development
For some freaking reason Linux couldn't support 14400 baud rate on it's serial connection. I was doing some development based on Maxim's DS89C450 , as it is one of the highest performance 8051 compatible microcontrollers in the market. The nice thing of this DS89C450 is that it has a boot ROM which allows me to program the chip using serial port (instead of an expensive programmer). However, the boot ROM only allows COM port connections at 14400 and Linux doesn't support this baud rate. (dear Maxim friends, can you change the baud rate to a standard one?)
I was desperate and trying through different bauds, surprisingly I found that it can work under 2400bps instead of 14400. (Anyone can explain to me why?)
If you are interested, there are a few more further readings of development using DS89C450 under Linux:
I was desperate and trying through different bauds, surprisingly I found that it can work under 2400bps instead of 14400. (Anyone can explain to me why?)
If you are interested, there are a few more further readings of development using DS89C450 under Linux:
- In-System programming of Maxim 8051-based Microncontrollers
- SDCC C Compiler is free and also available under Linux
- My favorite FTDI USB to serial converter cable - it works perfectly under Mac, Win and Linux, don't use the Polific it's a waste of time....
Thursday, January 31, 2013
Monday, January 28, 2013
Arch Linux: systemctl dhcpcd netcfg problem
I think the Arch Linux dhcpd / dhcpcd thing is kinda broke...
I read many installation guide which says to start dhcp use the following command but it NEVER works for me:
eth0 or enp2s1 whatever won't work. I don't know what the heck is enp2s1 in my system...
Anyway, this is what I do to fix it(mine is just VMware NAT network):
I read many installation guide which says to start dhcp use the following command but it NEVER works for me:
# systemctl enable dhcpcd@.service
Anyway, this is what I do to fix it(mine is just VMware NAT network):
- cp /etc/network.d/examples/ethernet-dhcp /etc/network.d/mynetwork
- vi /etc/network.d/mynetwork , modified line INTERFACE='enp2s1'
- try in root, netcfg mymetwork, see if it can fetch IP properly
- if everything looks good, # systemctl enable netcfg@mynetwork
Friday, January 18, 2013
VirtualBox UUID already registered
Stupid VirtualBox after you copied it and use it again it will complain the UUID already registered. Use the below Linux command to assign it a new random UUID:
$ vboxmanage internalcommands sethduuid arch.vdi
Wednesday, January 16, 2013
BloggerPaste: convert your code to HTML
For many times the blogger editor messed up my code when I paste it here. Obviously blogger is not intended for programmer.
I found an excellent tool to convert my code into HTML so that I can put it correctly here.
http://francois.schnell.free.fr/tools/BloggerPaste/BloggerPaste.html
I found an excellent tool to convert my code into HTML so that I can put it correctly here.
http://francois.schnell.free.fr/tools/BloggerPaste/BloggerPaste.html
Linux Mint 14 and Ubuntu 12.10 Chinese fonts Blur problem
Wenq.org offered an excellent tool to generate the .fonts.conf
http://wenq.org/cloud/fcdesigner_local.html
And also for the Chinese fonts packages
e.g. I used the tool to generate the below config file, save to ~/.fonts.conf and now the Chinese fonts looks much clear to me.
To download my file https://docs.google.com/file/d/0B7j0X0cOW5wTWnV2N3Y3NS1FeVE/edit
Or copy and paste here (Hope blogger won't do weird thing to mess up my code):
http://wenq.org/cloud/fcdesigner_local.html
And also for the Chinese fonts packages
# aptitude install ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy
e.g. I used the tool to generate the below config file, save to ~/.fonts.conf and now the Chinese fonts looks much clear to me.
To download my file https://docs.google.com/file/d/0B7j0X0cOW5wTWnV2N3Y3NS1FeVE/edit
Or copy and paste here (Hope blogger won't do weird thing to mess up my code):
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- created by WenQuanYi FcDesigner v0.5 -->
<match>
<test name="family"><string>sans-serif</string></test>
<edit name="family" mode="prepend" binding="strong">
<string>DejaVu Sans</string>
<string>WenQuanYi Bitmap Song</string>
<string>WenQuanYi Micro Hei</string>
<string>WenQuanYi Zen Hei</string>
<string>Liberation Sans</string>
<string>Droid Sans</string>
<!-- Please install WenQuanYi Bitmap Song first -->
</edit>
</match>
<match>
<test name="family"><string>serif</string></test>
<edit name="family" mode="prepend" binding="strong">
<string>DejaVu Serif</string>
<string>WenQuanYi Bitmap Song</string>
<!-- Please install WenQuanYi Bitmap Song first -->
<string>AR PL UMing CN</string>
<string>AR PL SungtiL GB</string>
<string>WenQuanYi Zen Hei Sharp</string>
<string>AR PL UMing TW</string>
<string>Liberation Serif</string>
<string>Bitstream Charter</string>
<string>Droid Serif</string>
</edit>
</match>
<match>
<test name="family"><string>monospace</string></test>
<edit name="family" mode="prepend" binding="strong">
<string>WenQuanYi Zen Hei Sharp</string>
<string>WenQuanYi Zen Hei Mono</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>DejaVu Sans Mono</string>
<string>Droid Sans Mono</string>
<string>Liberation Sans Mono</string>
<!-- Please install Liberation Sans Mono first -->
<string>AR PL UMing TW</string>
</edit>
</match>
</fontconfig>
Thursday, January 03, 2013
Viewnior fast image viewer
Just found Viewnior a pretty good image viewer, much faster image loading than the Ubuntu default image viewer. It doesn't need to import images like shotwell, and it allows left and right button to scroll to the next image.
so much to ask for a simple image viewer huh?
http://xsisqox.github.com/Viewnior/index.html
so much to ask for a simple image viewer huh?
http://xsisqox.github.com/Viewnior/index.html
Subscribe to:
Posts (Atom)