We have 200+ brand new Cisco routers that have USB console ports (but not the old RJ45 serial console ports). This is quite frustrating because the routers didn't ship with console cables and Cisco wants to charge 60ドル for their proprietary USB->RJ45 serial adapters.
When I plug the router in to a computer using a standard USB cable (mini USBb on one end and USB on the other end), it shows up as a virtual com port and allows me to configure the router if I have a VCP driver installed. More specifically it shows up as a "CP2105 Dual USB to UART Bridge Controller". Here's the full lsusb -v
output for the router:
Bus 001 Device 005: ID 10c4:ea70 Cygnal Integrated Products, Inc. CP210x UART Bridge
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x10c4 Cygnal Integrated Products, Inc.
idProduct 0xea70 CP210x UART Bridge
bcdDevice 1.01
iManufacturer 1 Silicon Labs
iProduct 2 CP2105 Dual USB to UART Bridge Controller
iSerial 5 12345678
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 55
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 3 Enhanced Com Port
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 4 Standard Com Port
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)
Is it possible to have an ATtiny85 board (eg Digispark) interface with the router via its USB console port to send several commands over the link to perform a perform basic initial config?
-
That's not how USB works.Ignacio Vazquez-Abrams– Ignacio Vazquez-Abrams2018年04月12日 02:45:46 +00:00Commented Apr 12, 2018 at 2:45
-
why not write a computer program?Juraj– Juraj ♦2018年04月12日 04:58:55 +00:00Commented Apr 12, 2018 at 4:58
-
1"If it can act as a [device], surely it can act as a [host]." You grossly overestimate USB's flexibility. The relation between host and device is not symmetrical, on purpose. It makes USB devices cheaper and easier to implement at the expense of making hosts more complex.Ignacio Vazquez-Abrams– Ignacio Vazquez-Abrams2018年04月12日 05:17:21 +00:00Commented Apr 12, 2018 at 5:17
-
2I have no problem with you writing a software USB host implementation for the ATtiny85 and proving me wrong.Ignacio Vazquez-Abrams– Ignacio Vazquez-Abrams2018年04月12日 05:25:06 +00:00Commented Apr 12, 2018 at 5:25
-
2You'd have to implement USB host. Which I haven't seen done before (but I might have missed it). First, I'd ditch the ATTiny85 idea. It's less powerful than the other Arduino's, and a lot harder to work with/debug. I'd suggest looking into the USB-host shield. The Arduino Due has USB-OTG, so that might maybe be an option. A maybe even better option could be to have an Android phone with a USB-OTG cable and some Serial Console App.Gerben– Gerben2018年04月12日 09:29:40 +00:00Commented Apr 12, 2018 at 9:29
2 Answers 2
It's been a couple of decades since I was programming Cisco routers, firewalls and switches but I appreciate you pain. Like @Gerben says, you need a bigger processor, an ATtiny85 isn't going to be able to hold a lot of config and even the basic configs I used were about 4 to 6KB.
If there is anything in the configs that is different, you idea is going to hit problems. Are the device names and passwords all the same? In which case you probably want the engineer to be able to set some configuration data in you "programmer", could they set this specialisation data using their mobile phone?
I doubt you will have any problem connecting an "Arduino" via serial (RS232) to a Cisco router. However you now have to encapsulate the serial in "USB", which I don't think will be straight forward for an "Arduino".
I can't think of an option that doesn't require power, but as an alternative to your idea what about using a Raspberry Pi to connect to the router via USB. Stick a touch screen on it and a battery pack to power it.
Can I use a ATtiny85 board (eg Digispark) as a USB CDC device?
Yes!
If I have got this right, to be able to communicate with a USB serial device you need to have USB CDC support and if you want it to fake a keyboard/mouse you need HID.
The Digispark have a CDC library https://digistump.com/wiki/digispark/tutorials/digicdc
But it has its limitations, take a lot of RAM ( ~2K) so to use a Arduino Leonard/Arduino Micro make more sens and then you could add a SD card as well so you can have your commands easily modified on a SD card.
I have the same idea, but I fetch the config from a TFTP source so my commands needed on the Digispark/Leonardo/Micro is minimal.
Explore related questions
See similar questions with these tags.