From: Duncan Sands <baldrick@wanadoo.fr>
To: linux-usb-devel@lists.sourceforge.net
Cc: Greg KH <greg@kroah.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] USB speedtouch: better proc info
Date: Mon, 24 Feb 2003 10:58:51 +0100 [thread overview]
Message-ID: <200302241058.52073.baldrick@wanadoo.fr> (raw)
Output the correct device name, show the state of the device (for debugging) and of the
ADSL line (anyone want to write a graphical utility to show this, like under windows?). We
no longer consult the usb_device struct in udsl_atm_proc_read, so don't take a reference
to it. Against Greg's current 2.5 USB tree.
speedtouch.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 58 insertions(+), 10 deletions(-)
--- 1.62/drivers/usb/misc/speedtouch.c Fri Feb 21 10:21:00 2003
+++ 1.64/drivers/usb/misc/speedtouch.c Mon Feb 24 10:17:09 2003
@@ -156,6 +156,7 @@
/* usb device part */
struct usb_device *usb_dev;
+ char description [64];
int firmware_loaded;
/* atm device part */
@@ -698,8 +699,6 @@
dbg ("udsl_atm_dev_close: killing tasklet");
tasklet_kill (&instance->send_tasklet);
- dbg ("udsl_atm_dev_close: freeing USB device");
- usb_put_dev (instance->usb_dev);
dbg ("udsl_atm_dev_close: freeing instance");
kfree (instance);
}
@@ -722,8 +721,10 @@
}
if (!left--)
- return sprintf (page, "SpeedTouch USB %s-%s (%02x:%02x:%02x:%02x:%02x:%02x)\n",
- instance->usb_dev->bus->bus_name, instance->usb_dev->devpath,
+ return sprintf (page, "%s\n", instance->description);
+
+ if (!left--)
+ return sprintf (page, "MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
atm_dev->esi[0], atm_dev->esi[1], atm_dev->esi[2],
atm_dev->esi[3], atm_dev->esi[4], atm_dev->esi[5]);
@@ -735,6 +736,30 @@
atomic_read (&atm_dev->stats.aal5.rx_err),
atomic_read (&atm_dev->stats.aal5.rx_drop));
+ if (!left--) {
+ switch (atm_dev->signal) {
+ case ATM_PHY_SIG_FOUND:
+ sprintf (page, "Line up");
+ break;
+ case ATM_PHY_SIG_LOST:
+ sprintf (page, "Line down");
+ break;
+ default:
+ sprintf (page, "Line state unknown");
+ break;
+ }
+
+ if (instance->usb_dev) {
+ if (!instance->firmware_loaded)
+ strcat (page, ", no firmware\n");
+ else
+ strcat (page, ", firmware loaded\n");
+ } else
+ strcat (page, ", disconnected\n");
+
+ return strlen (page);
+ }
+
return 0;
}
@@ -867,7 +892,8 @@
struct udsl_instance_data *instance;
unsigned char mac_str [13];
unsigned char mac [6];
- int i;
+ int i, length;
+ char *buf;
dbg ("Trying device with Vendor=0x%x, Product=0x%x, ifnum %d",
dev->descriptor.idVendor, dev->descriptor.idProduct, ifnum);
@@ -962,7 +988,7 @@
instance->atm_dev->ci_range.vpi_bits = ATM_CI_MAX;
instance->atm_dev->ci_range.vci_bits = ATM_CI_MAX;
- instance->atm_dev->signal = ATM_PHY_SIG_LOST;
+ instance->atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
/* tmp init atm device, set to 128kbit */
instance->atm_dev->link_rate = 128 * 1000 / 424;
@@ -976,14 +1002,34 @@
memcpy (instance->atm_dev->esi, mac, 6);
- wmb ();
+ /* device description */
+ buf = instance->description;
+ length = sizeof (instance->description);
+
+ if ((i = usb_string (dev, dev->descriptor.iProduct, buf, length)) < 0)
+ goto finish;
+
+ buf += i;
+ length -= i;
+
+ i = snprintf (buf, length, " (");
+ buf += i;
+ length -= i;
+
+ if (length <= 0 || (i = usb_make_path (dev, buf, length)) < 0)
+ goto finish;
+ buf += i;
+ length -= i;
+
+ snprintf (buf, length, ")");
+
+finish:
+ /* ready for ATM callbacks */
instance->atm_dev->dev_data = instance;
usb_set_intfdata (intf, instance);
- usb_get_dev (dev);
-
return 0;
fail:
@@ -1116,8 +1162,10 @@
for (i = 0; i < UDSL_NUMBER_SND_BUFS; i++)
kfree (instance->all_buffers[i].base);
+ instance->usb_dev = NULL;
+
/* atm finalize */
- shutdown_atm_dev (instance->atm_dev);
+ shutdown_atm_dev (instance->atm_dev); /* frees instance */
}
next reply other threads:[~2003-02-24 9:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-24 9:58 Duncan Sands [this message]
2003-02-24 10:43 ` Oliver Neukum
2003-02-25 8:22 ` Duncan Sands
2003-02-25 20:54 ` Oliver Neukum
2003-02-26 7:31 ` Duncan Sands
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=200302241058.52073.baldrick@wanadoo.fr \
--to=baldrick@wanadoo.fr \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-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
all inboxes | Powered by JetHome®