plusb.c patched to support Belkin F5U258 USB host-to-host cable
Subsystems (3)
PATCH 1/1 plusb.c patched to support Belkin F5U258 USB host-to-host cable
Dear Dave,
I have tried to make the changes I have been working on and testing with your help into a patch as attached.
Please let me know what you think of it.
Kind Regards,
Tony
---
Description: To make usbnet work with the Belkin F5U258 USB Host to Host cable,
which contains Prolific PL-25A1 chip, the file plusb.c has been edited to add the
VID and PID values for that cable.
The changes have been checked using the checkpatch.pl script.
The patch was tested on kernel 2.6.23.14 on Fedora Core 8, and on kernel 2.6.17.14 on Ubuntu Dapper Drake.
--- /home/tony/drivers/net/usb/plusb.c 2008-02-12 23:02:01.000000000 +0000
+++/usr/src/redhat/BUILD/kernel-2.6.23/linux-2.6.23.i386/drivers/net/usb/plusb
.c 2008-02-12 23:17:16.000000000 +0000
@@ -1,6 +1,7 @@
/*
* PL-2301/2302 USB host-to-host link cables
* Copyright (C) 2000-2005 by David Brownell
+ * PL-25A1 hack added by Tony Gibbs 07/02/2008.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,8 +18,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
*/
-//#define DEBUG // error path messages, extra info -//#define VERBOSE // more; success messages +#define DEBUG // error path messages, extra info +#define VERBOSE // more; success messages
#include <linux/module.h>
#include <linux/init.h>
@@ -46,6 +47,8 @@
* seems to get wedged under load. Prolific docs are weak, and
* don't identify differences between PL2301 and PL2302, much less
* anything to explain the different PL2302 versions observed.
+ *
+ * PL25A1 chip in Belkin F5U258 added.
*/
/*
@@ -96,7 +99,7 @@ static int pl_reset(struct usbnet *dev)
}
static const struct driver_info prolific_info = {
- .description = "Prolific PL-2301/PL-2302",
+ .description = "Prolific PL-2301/PL-2302_PL-25A1hack",
.flags = FLAG_NO_SETINT,
/* some PL-2302 versions seem to fail usb_set_interface()*/
.reset = pl_reset,
@@ -118,7 +121,12 @@ static const struct usb_device_id produc
}, {
USB_DEVICE(0x067b, 0x0001), // PL-2302
.driver_info = (unsigned long) &prolific_info,
-},
+}, {
+ USB_DEVICE(0x050d, 0x258a), /*Belkin F5U258 cable containing
PL-25A1 chip.*/
+ /* TG hack 07/02/2008 */
+ .driver_info = (unsigned long) &prolific_info
+},
+
{ }, // END
};
MODULE_DEVICE_TABLE(usb, products);
@@ -145,5 +153,5 @@ static void __exit plusb_exit(void)
module_exit(plusb_exit);
MODULE_AUTHOR("David Brownell");
-MODULE_DESCRIPTION("Prolific PL-2301/2302 USB Host to Host Link Driver"); +MODULE_DESCRIPTION("Prolific PL-2301/2302 USB Host to Host Link Driver with PL-25A1 TG hack");
MODULE_LICENSE("GPL");
Quoted 4 lines · tony_gibbs
I have tried to make the changes I have been working on and testing with your help into a patch as attached.
Please let me know what you think of it.
It arrived line wrapped, and turned on debug options that should stay off by default ... it couldn't merge, on those bases alone. Also, "PL-25A1hack" isn't a product name. ;)
Did you get this to pass data back and forth yet? The last report I had from you was that it wouldn't pass data. The Prolific hardware tends to enter that mode after a while. (Maybe there's documentation unseen by any Linux developer, saying how to make those chips actually work...) But you reported that they didn't seem to work even when freshly plugged in.
- Dave
Here's a patch with cleanups and without various encoding bugs. Can you verify it still works?
Also, some of the Prolific chips use some bizarre control requests, which by all rights should not be needed. They seem to exist only to cope with things the device firmware should have handled ... like resetting one end of a link after it's unplugged.
When you test this, please enable CONFIG_USB_DEBUG and let us know if those the host software still needs to do that reset ... or at least, whether the diagnostic appears.
- Dave
====== CUT HERE
Some plusb driver updates: pl25a1 support (based on info from Tony Gibbs), and various cleanups.
--- drivers/net/usb/Kconfig | 2 - drivers/net/usb/plusb.c | 52 ++++++++++++++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 18 deletions(-)
drivers/net/usb/plusb.c +35 -17
@@ -17,9 +17,6 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// #define DEBUG // error path messages, extra info -// #define VERBOSE // more; success messages -#include <linux/module.h> #include <linux/init.h> #include <linux/netdevice.h>
@@ -45,6 +42,14 @@* seems to get wedged under load. Prolific docs are weak, and * don't identify differences between PL2301 and PL2302, much less * anything to explain the different PL2302 versions observed. +* +* NOTE: pl2501 has several modes, including pl2301 and pl2302 +* compatibility. Some docs suggest the difference between 2301 +* and 2302 is only to make MS-Windows use a different driver... +* +* pl25a1 glue based on patch from Tony Gibbs. Prolific "docs" on +* this chip are as usual incomplete about what control messages +* are supported. */ /*
@@ -86,16 +91,20 @@ pl_set_QuickLink_features(struct usbnetstatic int pl_reset (struct usbnet *dev) { +int status; +/* some units seem to need this reset, others reject it utterly. * FIXME be more like "naplink" or windows drivers. */ - (void )pl_set_QuickLink_features (dev, + status =pl_set_QuickLink_features (dev,PL_S_EN |PL_RESET_OUT |PL_RESET_IN |PL_PEER_E ); +if (status !=0 &&netif_msg_probe (dev)) +devdbg (dev,"pl_reset --> %d\n" , status);return 0 ; }static const struct driver_info prolific_info = { - .description ="Prolific PL-2301/PL-2302" , + .description ="Prolific PL-2301/PL-2302/PL-25A1" , .flags =FLAG_NO_SETINT ,/* some PL-2302 versions seem to fail usb_set_interface() */ .reset = pl_reset,
@@ -110,16 +119,25 @@ static const struct driver_info prolific*/ static const struct usb_device_id products [] = { +/* full speed cables */ + { +USB_DEVICE (0x067b ,0x0000 ),/* PL-2301 */ + .driver_info = (unsigned long ) &prolific_info, + }, { +USB_DEVICE (0x067b ,0x0001 ),/* PL-2302 */ + .driver_info = (unsigned long ) &prolific_info, + }, + +/* high speed cables */ + { +USB_DEVICE (0x067b ,0x25a1 ),/* PL-25A1, no eeprom */ + .driver_info = (unsigned long ) &prolific_info, + }, { +USB_DEVICE (0x050d ,0x258a ),/* Belkin F5U258 (PL-25A1) */ + .driver_info = (unsigned long ) &prolific_info, + }, -{ -USB_DEVICE (0x067b ,0x0000 ),// PL-2301 - .driver_info = (unsigned long ) &prolific_info, -}, { -USB_DEVICE (0x067b ,0x0001 ),// PL-2302 - .driver_info = (unsigned long ) &prolific_info, -}, - - { },// END + { },/* END */ };MODULE_DEVICE_TABLE (usb, products);
@@ -134,16 +152,16 @@ static struct usb_driver plusb_driver =static int __init plusb_init (void ) { -return usb_register (&plusb_driver); +return usb_register (&plusb_driver); }module_init (plusb_init); static void __exit plusb_exit(void) { -usb_deregister (&plusb_driver); +usb_deregister (&plusb_driver); }module_exit (plusb_exit);MODULE_AUTHOR ("David Brownell" ); -MODULE_DESCRIPTION ("Prolific PL-2301/2302 USB Host to Host Link Driver" ); +MODULE_DESCRIPTION ("Prolific PL-2301/2302/25A1 USB Host to Host Link Driver" );MODULE_LICENSE ("GPL" );
drivers/net/usb/Kconfig +1 -1
@@ -208,7 +208,7 @@ config USB_NET_NET1080 optionally with LEDs that indicate traffic config USB_NET_PLUSB - tristate "Prolific PL-2301/2302 based cables" + tristate "Prolific PL-2301/2302/25A1 based cables" # if the handshake/init/reset problems, from original 'plusb', # are ever resolved ... then remove "experimental" depends on USB_USBNET && EXPERIMENTAL
Hello,
Sorry to hijack this thread, but today I bought one host-to-host USB cable, and it's a Belkin F5U258.
Quoted 2 lines · David Brownell
Here's a patch with cleanups and without various encoding bugs. Can you verify it still works?
I applied it against my linux 2.6.26 tree, enabled plugged the two ends into two ports of my computer, used "ip l set usb0 up" and "ip l set usb1 up", started an "arping -I usb0 <some address>" and "tcpdump -i usb1", and I see packets.
Then I changed the mac address of usb1, let ipv6 choose a link-local address and pinged it from usb0, it's working too.
I didn't try some more advanced test as I only have one computer at the moment (but it should be possible to do something with iptables, I did it once)
Quoted 3 lines
When you test this, please enable
CONFIG_USB_DEBUGand let us know if those the host software still needs to do that reset ... or at least, whether the diagnostic appears.
The attached file is the dmesg output, I see timeouts when the interface is set to up (at 895 and 985), but nothing else, is this ok?
Signature · 1 line
Damien Thebault
[ 889.041302] usb usb1: usb resume [ 889.041302] ehci_hcd 0000:00:1d.7: resume root hub [ 889.090584] hub 1-0:1.0: hub_resume [ 889.090584] ehci_hcd 0000:00:1d.7: GetStatus port 3 status 001803 POWER sig=j CSC CONNECT [ 889.090584] hub 1-0:1.0: state 7 ports 8 chg 0000 evt 0000 [ 889.090584] ehci_hcd 0000:00:1d.7: GetStatus port 3 status 001803 POWER sig=j CSC CONNECT [ 889.090584] hub 1-0:1.0: port 3, status 0501, change 0001, 480 Mb/s [ 889.251821] hub 1-0:1.0: debounce: port 3: total 100ms stable 100ms status 0x501 [ 889.311664] ehci_hcd 0000:00:1d.7: port 3 high speed [ 889.311678] ehci_hcd 0000:00:1d.7: GetStatus port 3 status 001005 POWER sig=se0 PE CONNECT [ 889.371254] usb 1-3: new high speed USB device using ehci_hcd and address 4 [ 889.429893] ehci_hcd 0000:00:1d.7: port 3 high speed [ 889.429908] ehci_hcd 0000:00:1d.7: GetStatus port 3 status 001005 POWER sig=se0 PE CONNECT [ 889.525184] usb 1-3: default language 0x0409 [ 889.561999] usb 1-3: uevent [ 889.561999] usb 1-3: usb_probe_device [ 889.561999] usb 1-3: configuration #1 chosen from 1 choice [ 889.561999] usb 1-3: adding 1-3:1.0 (config #1, interface 0) [ 889.561999] usb 1-3:1.0: uevent [ 889.561999] plusb 1-3:1.0: usb_probe_interface [ 889.561999] plusb 1-3:1.0: usb_probe_interface - got id [ 889.563640] usb0: register 'plusb' at usb-0000:00:1d.7-3, Prolific PL-2301/PL-2302/PL-25A1, de:42:b3:88:b9:d8 [ 889.563794] drivers/usb/core/inode.c: creating file '004' [ 889.563866] usb 1-3: New USB device found, idVendor=050d, idProduct=258a [ 889.563871] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 889.563877] usb 1-3: Product: Belkin USB Easy Transfer Cable [ 889.563881] usb 1-3: Manufacturer: Belkin Corporation [ 895.753895] usb 1-3: ip timed out on ep0out len=0/0 [ 895.753908] usb0: pl_reset --> -110 [ 895.753910] [ 895.753955] usb0: rxqlen 0 --> 10 [ 895.753983] usb0: rxqlen 10 --> 20 [ 895.754015] usb0: rxqlen 20 --> 30 [ 895.754041] usb0: rxqlen 30 --> 40 [ 895.754068] usb0: rxqlen 40 --> 50 [ 895.754100] usb0: rxqlen 50 --> 60 [ 905.850819] usb0: no IPv6 routers present [ 919.042362] hub 1-0:1.0: state 7 ports 8 chg 0000 evt 0002 [ 919.042362] ehci_hcd 0000:00:1d.7: GetStatus port 1 status 001803 POWER sig=j CSC CONNECT [ 919.042362] hub 1-0:1.0: port 1, status 0501, change 0001, 480 Mb/s [ 919.197547] hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x501 [ 919.257960] ehci_hcd 0000:00:1d.7: port 1 high speed [ 919.257974] ehci_hcd 0000:00:1d.7: GetStatus port 1 status 001005 POWER sig=se0 PE CONNECT [ 919.317406] usb 1-1: new high speed USB device using ehci_hcd and address 5 [ 919.378895] ehci_hcd 0000:00:1d.7: port 1 high speed [ 919.378909] ehci_hcd 0000:00:1d.7: GetStatus port 1 status 001005 POWER sig=se0 PE CONNECT [ 919.487320] usb 1-1: default language 0x0409 [ 919.519888] usb 1-1: uevent [ 919.519888] usb 1-1: usb_probe_device [ 919.519888] usb 1-1: configuration #1 chosen from 1 choice [ 919.519888] usb 1-1: adding 1-1:1.0 (config #1, interface 0) [ 919.519888] usb 1-1:1.0: uevent [ 919.519888] plusb 1-1:1.0: usb_probe_interface [ 919.519888] plusb 1-1:1.0: usb_probe_interface - got id [ 919.519888] usb1: register 'plusb' at usb-0000:00:1d.7-1, Prolific PL-2301/PL-2302/PL-25A1, de:42:b3:88:b9:d8 [ 919.520324] drivers/usb/core/inode.c: creating file '005' [ 919.520577] usb 1-1: New USB device found, idVendor=050d, idProduct=258a [ 919.520583] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 919.520589] usb 1-1: Product: Belkin USB Easy Transfer Cable [ 919.520594] usb 1-1: Manufacturer: Belkin Corporation [ 985.101546] usb 1-1: ip timed out on ep0out len=0/0 [ 985.101546] usb1: pl_reset --> -110 [ 985.101546] [ 985.101546] usb1: rxqlen 0 --> 10 [ 985.101546] usb1: rxqlen 10 --> 20 [ 985.101546] usb1: rxqlen 20 --> 30 [ 985.101546] usb1: rxqlen 30 --> 40 [ 985.101546] usb1: rxqlen 40 --> 50 [ 985.101546] usb1: rxqlen 50 --> 60
A message that is not in the archive (sent off-list or not yet received): 9a4a382a0808261456me05f7b9r7f50dc69c58d25ae-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 19 lines · Damien Thébault
Hello,
Sorry to hijack this thread, but today I bought one host-to-host USB cable, and it's a Belkin F5U258.
Quoted 2 lines · David Brownell
Here's a patch with cleanups and without various encoding bugs. Can you verify it still works?
I applied it against my linux 2.6.26 tree, enabled plugged the two ends into two ports of my computer, used "ip l set usb0 up" and "ip l set usb1 up", started an "arping -I usb0 <some address>" and "tcpdump -i usb1", and I see packets.
Then I changed the mac address of usb1, let ipv6 choose a link-local address and pinged it from usb0, it's working too.
I didn't try some more advanced test as I only have one computer at the moment (but it should be possible to do something with iptables, I did it once)
Quoted 7 lines
Quoted 3 lines
When you test this, please enable
CONFIG_USB_DEBUGand let us know if those the host software still needs to do that reset ... or at least, whether the diagnostic appears.The attached file is the dmesg output, I see timeouts when the interface is set to up (at 895 and 985), but nothing else, is this ok?
By the way, from the very beginning of this thread, the wrong email is
used for "Linux USB mailing list", it's not "[email protected]", but "[email protected]".
So, people from linux-usb should read the previous mail in the available archives [1][2].
(I'm sorry but I know no other way to do this)
[1] http://www.spinics.net/lists/netdev/msg55416.html
[2] http://marc.info/?l=linux-netdev&m=120307070602296&w=2
Regards,
Signature · 5 lines
Damien Thebault -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html