[LinuxBIOS] Convert hex to dec

Alan Carvalho de Assis acassis at gmail.com
Wed Jul 4 21:59:17 CEST 2007


2007/7/4, Peter Stuge <peter at stuge.se>:
> On Wed, Jul 04, 2007 at 07:47:11PM +0200, Uwe Hermann wrote:
> > I use some aliases in my .bashrc which are pretty handy for converting
> > HEX or BINARY or DECIMAL:
> >
> > alias HEX="ruby -e 'printf(\"0x%X\n\", ARGV[0])'"
> > alias DEC="ruby -e 'printf(\"%d\n\", ARGV[0])'"
> > alias BIN="ruby -e 'printf(\"%bb\n\", ARGV[0])'"
> >
> > (You can replace 'ruby' with 'perl' if you want)
>
> bash has printf too; try printf 0x%X\\n 128
>

Yes, printf at shell is very useful, I use this command to reset BIOS CMOS:

# printf "\x2E" | dd bs=1 seek=112 of=/dev/port
# printf "\xFF" | dd bs=1 seek=113 of=/dev/port

It sends 0x2E to port 0x70 and 0xFF to port 0x71.

>
> //Peter
>

Alan




More information about the coreboot mailing list