On Wed, 2009-07-01 at 18:00 -0600, Matthew Wilcox wrote: > On Wed, Jul 01, 2009 at 04:45:07PM -0700, Warren Turkal wrote: > > I don't really care about that. I just want to be able to look at and > > decode the values more easily. > > > > Speaking of pie in the sky, it would also be nice if I could tell it > > to spit out a string of binary bits instead of hex sometimes. It would > > be even better if I could only spit out certain bits as binary or hex. > > > > For example, let's say I want something like bits 23 through 29 of the > > quad word @ 0x40. > > # setpci binary(40.Q[32:23]) > > 0x40[29:23]: 0011 0101 10 > > > > Or let's say I wanted the same thing in hex: > > # setpci hex(40.Q[32:23]) > > 0x40[29:23]: 0xD6 > > I've often found Linux to be pretty weak at that kind of thing. > I normally have to resort to invoking 'bc' and messing around with obase > and ibase. It seems like the kind of thing that hexdump should be able > to do, although mybe making it a separate utility would be more useful. > > Something like the way 'units' works, perhaps. I do think it would be > nice to have a separate tool rather than enhancing each tool to be able > to do this kind of thing. You can do step two, the printing, with i: $ i 0xD6 214 0xD6 0326 0b11010110 In the "iprint" package on debian/ubuntu. And you can always i your original value, and cut and paste the bits you want from the binary representation, and run i on that. cheers
Attachment:
signature.asc
Description: This is a digitally signed message part