pyftdi icon indicating copy to clipboard operation
pyftdi copied to clipboard

Add support for integer serial number in device URL

Open larsch opened this issue 4 years ago • 8 comments

How about leaving specifier[2] as it is now (serial or device number), but add support for specifier[3] being serial number only. I'd open it with bitbang.open_bitbang_from_url("ftdi://vid:pid::0025/1") instead.

Resolved #209

larsch avatar Jun 30 '20 14:06 larsch

~~The issue is that this syntax breaks backward compatibility...~~

eblot avatar Jun 30 '20 14:06 eblot

Sorry I misread the code. I need to check it does not break the bus:address code though

eblot avatar Jun 30 '20 14:06 eblot

I intended to leave support for current styles (but sort-of deprecate using index field for serial number, since it is unreliable anyway).

larsch avatar Jun 30 '20 14:06 larsch

Maybe it is time to break compatibility with index-based syntax, (re-)using your proposed syntax:

URL scheme: ftdi://[vendor[:product[:serial]]]/interface
URL scheme: ftdi://[vendor[:product[:bus:address]]]/interface
URL scheme: ftdi://[vendor[:product[::@index]]]/interface

?

eblot avatar Jun 30 '20 14:06 eblot

That would certainly work for me, as I don't need the backwards compatibility. And it's much simpler overall.

larsch avatar Jun 30 '20 14:06 larsch

Ok, as index is not really reliable anyway - and that the new bus:address syntax is a far better way to refer to S/N-less devices, I think it is worth reworking this.

I just need to find some spare time to implement it (and test & document it...)

eblot avatar Jun 30 '20 14:06 eblot

I would also prefer prioritizing serial number over index :) I have till now used this field as a serial number, in my organization we use integer serial numbers so I had to add literal prefix to use pyftdi. This causes an inconsistencies with other platforms which do not have such an issue, and questions why devices which work with "python apps" must be marked differently.

f423r avatar Jan 27 '21 10:01 f423r

I'm ok with that. I think I will remove the index support for now...

eblot avatar Jan 27 '21 11:01 eblot