Re: [Dorset] Distinguishing USB Devices. (Was: Things discussed and results:)

2016-12-10 Thread Terry Coles
On Saturday, 10 December 2016 10:53:46 GMT Ralph Corderoy wrote:
> What's the vendor:product ID shown by lsusb?  Some things offer a means
> to set the serial number.  It's unlikely in this case, but worth a
> Google.

I only found examples of the output of lsusb for these devices (Vendor:Product 
0x0d8c:0x013c (C-Media Electronics, Inc :  CM108 Audio Controller)).  These 
examples all said that iSerial was 0, so it looks like that's universal.

> And I think you said in a sealed box, so no switch whereby an operator
> can flip them around if they're wrong after a boot?  Or request a test
> play, etc.  And they're off the network.

We do have switches to control the playback modes and other features of the 
system, so we could use something like that (I had wondered myself).  The 
problem that I see is that the two devices may not just be flipped around, they 
may actually have been allocated to a totally different port, so it could be 
quite a laborious process
 
> I think the port may not change if you don't physically move the USB
> connector?  But it can be assigned a varying device name and that's the
> problem.  Investigate the tree of USB devices, `lsusb -t'.  `find
> /dev/bus/usb | sort' will show the ports you have available to use, I
> think.  Understanding this particular answer may help:
> http://www.linux-usb.org/FAQ.html#i6  Ah, here's someone showing how to
> walk the path to find the port numbers.  http://superuser.com/a/974522

The idea of using the physical connection from the last link looks promising.

> Pick randomly, play a test on reset, and have them power cycle if it's
> wrong.  It has to be random since Linux's allocation may be consistent
> for a good few goes in a row.  Sourcing randomness might be a problem.
> 
> Put the output of `sudo lsusb -v' into a file.  Copy it.  And cut each
> down so one of the adapters is in each.  Then compare, e.g. diff(1), to
> see if anything else might consistently be different.

I won't be able to get hold of the other two devices (one's a spare) until 
Monday, but I'll certainly have a look then.

It'll need extensive testing to be sure of the solution though.

Thanks for the ideas.

-- 



Terry Coles

-- 
Next meeting:  Bournemouth, Tuesday, 2017-01-03 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR

[Dorset] Distinguishing USB Devices. (Was: Things discussed and results:)

2016-12-10 Thread Ralph Corderoy
Hi Terry,

> My cunning plan thereby comes crashing around my ears.

Yeah, hardware, only ever causes problems.  :-)

> I only have one of the devices here at the moment, but it advertises
> iSerial as '0', so I've no doubt the others will also be called that.

What's the vendor:product ID shown by lsusb?  Some things offer a means
to set the serial number.  It's unlikely in this case, but worth a
Google.

> The system will be run headless except when the code is being
> developed or debugged

And I think you said in a sealed box, so no switch whereby an operator
can flip them around if they're wrong after a boot?  Or request a test
play, etc.  And they're off the network.

> so how can I find a foolproof way to identify which channel is which?

I think the port may not change if you don't physically move the USB
connector?  But it can be assigned a varying device name and that's the
problem.  Investigate the tree of USB devices, `lsusb -t'.  `find
/dev/bus/usb | sort' will show the ports you have available to use, I
think.  Understanding this particular answer may help:
http://www.linux-usb.org/FAQ.html#i6  Ah, here's someone showing how to
walk the path to find the port numbers.  http://superuser.com/a/974522

Pick randomly, play a test on reset, and have them power cycle if it's
wrong.  It has to be random since Linux's allocation may be consistent
for a good few goes in a row.  Sourcing randomness might be a problem.

Put the output of `sudo lsusb -v' into a file.  Copy it.  And cut each
down so one of the adapters is in each.  Then compare, e.g. diff(1), to
see if anything else might consistently be different.

Cheers, Ralph.

-- 
Next meeting:  Bournemouth, Tuesday, 2017-01-03 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR