public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Till Harbaum <harbaum@beecon.de>
To: <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] Little Hexdump-Patch for hcidump
Date: Thu, 26 Aug 2004 18:44:20 +0200	[thread overview]
Message-ID: <200408261844.20194.harbaum@beecon.de> (raw)
In-Reply-To: <50BF37ECE4954A4BA18C08D0C2CF88CB2364EC@exmail1.se.axis.com>

Hi all,

in every new release of hcidump i have been replacing the built-in 
hexdump routine with my own one (giving the address and ascii as well).

Perhaps you want to use this replacement in hcidump/parser/parser.c

The hex output is very useful for me and e.g. just being able to see ascii 
strings inside rfcomm payload is something i really often need.

Feel free to include it into the public version if you like to ...

Regards,
  Till


void hex_dump(int level, struct frame *frm, int num)
{
	unsigned char *buf = frm->ptr;
	register int i,n,b2c;

	if ((num < 0) || (num > frm->len))
		num = frm->len;

	n = 0;
	while(num>0) {
	    p_indent(level, frm);
	    printf("%04x: ", n);

	    b2c = (num>16)?16:num;

	    for(i=0;i<b2c;i++) printf("%02x ", buf[i]);
	    for(i=0;i<(16-b2c);i++) printf("   ");
	    printf("  ");

	    for(i=0;i<b2c;i++) printf("%c", isprint(buf[i])?buf[i]:'.');
	    printf("\n");

	    buf  += b2c;
	    num  -= b2c;
	    n    += b2c;
	}
}

-- 
Dr.-Ing. Till Harbaum                       Tel.:  +49 721 4998963
BeeCon GmbH                                 Fax:   +49 721 4998962
Haid-und-Neu Strasse 7, 76131 Karlsruhe     Mobil: +49 179 9087904
harbaum@beecon.de                           http://www.beecon.de



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2004-08-26 16:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05 12:45 [Bluez-devel] Bluez on Axis DevBoard 82 Peter Kjellerstedt
2004-08-26 16:44 ` Till Harbaum [this message]
2004-08-26 17:03   ` [Bluez-devel] Little Hexdump-Patch for hcidump Marcel Holtmann
2004-08-26 18:35     ` Till Harbaum
2004-08-26 19:20       ` Marcel Holtmann
     [not found]         ` <200408262230.37213.till@harbaum.org>
2004-08-26 22:26           ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200408261844.20194.harbaum@beecon.de \
    --to=harbaum@beecon.de \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox