Re: [Dorset] Things discussed and results:
On Saturday, 10 December 2016 11:45:03 GMT William R Sowerbutts wrote: > You can write a udev rule to name the device according to the USB port it is > plugged into (either on the host or a downstream hub). This should allows > you to give them persistent names. > > Here's an example for serial ports, I assume the same can be done for audio > devices: > > http://askubuntu.com/questions/49910/how-to-distinguish-between-identical-us > b-to-serial-adapters Thanks. From this and the link provided by Ralph, it looks like I should be able to do what I want, based on the physical USB socket that the device is plugged in to. This is ideal, because if the device ever fails, we don't want to have to reprogram the code, just because someone substitutes the spare. We just have to ensure that the User Manual makes it clear that it is important that the correct socket is used. -- 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
Re: [Dorset] Things discussed and results:
You can write a udev rule to name the device according to the USB port it is plugged into (either on the host or a downstream hub). This should allows you to give them persistent names. Here's an example for serial ports, I assume the same can be done for audio devices: http://askubuntu.com/questions/49910/how-to-distinguish-between-identical-usb-to-serial-adapters W On Sat, Dec 10, 2016 at 10:14:35AM +, Terry Coles wrote: >On Saturday, 10 December 2016 00:44:51 GMT Ralph Corderoy wrote: >> Terry has two USB audio adapters plugged in and wants to always play one >> track so it comes out of the "left" one and the other track to emit from >> the "right" regardless of the order they were enumerated by Linux. >> They're the same product from the same vendor. Terry, there is a >> "serial number" field in the USB descriptor, but you may find it's not >> set to a unique value by the manufacturer. `sudo lsusb -v' will show it >> as `iSerial'. > >My cunning plan thereby comes crashing around my ears. 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. > >The system will be run headless except when the code is being developed or >debugged, so how can I find a foolproof way to identify which channel is >which? >The alternatives to using these devices work out at £30 - £40 per channel >because they are aimed at the hi-fi market. These devices are about £3 each. > >I've already considered using the hdmi audio channel and putting one track on >the left channel and one on the right, but that would require that the >Wimborne Model Town Staff have a means to create the specially crafted mp3 >files. I'd rather not go down that path. > >Any other 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 _ William R Sowerbutts w...@sowerbutts.com "Carpe post meridiem" http://sowerbutts.com main(){char*s=">#=0> ^#X@#@^7=",c=0,m;for(;c<15;c++)for (m=-1;m<7;putchar(m++/6%3/2?10:s[c]-31&1<
Re: [Dorset] Things discussed and results:
On Saturday, 10 December 2016 10:14:35 GMT Terry Coles wrote: > My cunning plan thereby comes crashing around my ears. 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. > > The system will be run headless except when the code is being developed or > debugged, so how can I find a foolproof way to identify which channel is > which? The alternatives to using these devices work out at £30 - £40 per > channel because they are aimed at the hi-fi market. These devices are > about £3 each. > > I've already considered using the hdmi audio channel and putting one track > on the left channel and one on the right, but that would require that the > Wimborne Model Town Staff have a means to create the specially crafted mp3 > files. I'd rather not go down that path. > > Any other ideas? Answering myself, I suppose that the obvious answer is to play one track into the hdmi audio channel and the other track into the USB audio device, (which I can identify from its vendor ID). It seems a bit of a kludge though, so suggestions will still be gratefully received!! -- 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
Re: [Dorset] Things discussed and results:
On Saturday, 10 December 2016 00:44:51 GMT Ralph Corderoy wrote: > Terry has two USB audio adapters plugged in and wants to always play one > track so it comes out of the "left" one and the other track to emit from > the "right" regardless of the order they were enumerated by Linux. > They're the same product from the same vendor. Terry, there is a > "serial number" field in the USB descriptor, but you may find it's not > set to a unique value by the manufacturer. `sudo lsusb -v' will show it > as `iSerial'. My cunning plan thereby comes crashing around my ears. 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. The system will be run headless except when the code is being developed or debugged, so how can I find a foolproof way to identify which channel is which? The alternatives to using these devices work out at £30 - £40 per channel because they are aimed at the hi-fi market. These devices are about £3 each. I've already considered using the hdmi audio channel and putting one track on the left channel and one on the right, but that would require that the Wimborne Model Town Staff have a means to create the specially crafted mp3 files. I'd rather not go down that path. Any other 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
Re: [Dorset] Things discussed and results:
Hi, Peter wrote: > And from the discussions with Ralph [and Tim] about my HTML > program/CSS and Javascript, I have taken out a whole pile of stuff and > it works just the same. The stuff before the braces is a CSS selector that specifies what the braces' contents affect. https://www.w3.org/TR/css3-selectors/#selectors is a brief summary of the syntax, explained afterwards. > Then I took out those .HIGH and .LOW statements and got different > colours. Yes, that's because they those class selectors were having an effect. You said that they were working at the pub giving us a sample of a correct selector compared to the ones that weren't working for the width and height. They're the "E.warning" entry in the above table. You also had some "E#myid" ones too. > And that was just my little corner. Nick was showing his Qt program's handling of filesystem directory entries using the wide-character wchar_t type. There followed a discussion of Unicode and locales. In brief..! A character set maps characters onto the numbers used to identify them. Unicode has numbers, AKA codepoints, for many characters, AKA runes, e.g. U+0041 is a capital letter `A'. A single byte with value 0x41 is also the letter `A' in ASCII, but Unicode defines far more runes than a byte could describe. There are various ways of encoding this larger range as one or more bytes. The popular way today is UTF-8, co-invented by Unix's creator. It uses one or more bytes per rune. How many depends on the number being encoded. Small numbers, common in English and European languages, take one or two bytes. And the 128 bytes that comprise the ASCII character set have an identical encoding in ASCII and UTF-8. This makes it backward compatible with ASCII; it's a superset of ASCII. Another rune in Unicode is U+1F631; an example of a Unicode emoticon, `'. When encoded as UTF-8 it's the four bytes 0xf0 0x9f 0x98 0xb1. Nick's program was taking four bytes like these and displaying them as a emoticon using the library routines that use the wchar_t type; wide character. Those routines blindly assume the encoding used by the bytes from the "locale" of the program. The locale(1) program display details of the current locale. $ locale LANG=en_GB.utf8 LC_CTYPE="en_GB.utf8" LC_NUMERIC="en_GB.utf8" LC_TIME="en_GB.utf8" LC_COLLATE="en_GB.utf8" LC_MONETARY="en_GB.utf8" LC_MESSAGES="en_GB.utf8" LC_PAPER="en_GB.utf8" LC_NAME="en_GB.utf8" LC_ADDRESS="en_GB.utf8" LC_TELEPHONE="en_GB.utf8" LC_MEASUREMENT="en_GB.utf8" LC_IDENTIFICATION="en_GB.utf8" LC_ALL= $ en_GB.utf8 is the name of a locale for English in Great Britain using the UTF-8 encoding. locale(1) can list the locales available. $ locale -a C en_GB en_GB.iso88591 en_GB.utf8 en_US en_US.iso88591 en_US.utf8 POSIX $ C, AKA POSIX, is the original behaviour of the C programming language before locales were invented. It is always available and can be considered "ASCII". Depending on the Linux distribution, extra locales might be available as packages, or built by a program like locale-gen(1). A locale has various attributes than can be configured separately, e.g. how to format telephone numbers, and the standard paper size. The easiest way to change them all en masse is to set the environment variable LC_ALL. $ LC_ALL=C locale LANG=en_GB.utf8 LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C" LC_PAPER="C" LC_NAME="C" LC_ADDRESS="C" LC_TELEPHONE="C" LC_MEASUREMENT="C" LC_IDENTIFICATION="C" LC_ALL=C $ (LANG not changing doesn't matter as it's overridden by the others.) To make the change permanent for that shell and its descendents, export the environment variable. The locale affects things other than how bytes are interpreted as characters, e.g. the collating order of strings. $ printf '%s\n' abc abcdef 'abc def' | LC_COLLATE=C sort abc abc def abcdef $ $ printf '%s\n' abc abcdef 'abc def' | LC_COLLATE=en_GB sort abc abcdef abc def $ In the C locale, a space, byte 32, comes before `d', byte 100, but not in the English locale. ASCII is a single-byte character encoding; one byte per character. UTF-8 is variable length. There are many others. ISO-8859-1, AKA Latin1, is single-byte, and another superset of ASCII. A pound sign is 0xa3 is ISO-8859-1, but 0xc2 0xa3 in UTF-8. Notice how the second byte in UTF-8 is the same value as the single ISO-8859-1 byte. The other byte, 0xc2, is part of the encoding of the single `£' character in UTF-8, but is a `Â' in ISO-8859-1. You'll have seen them when a file or web page has the bytes 0xc2 0xa3 and instead of it being decoded as UTF-8, giving a single `£', it's decoded as ISO-8859-1, giving `£'. To decode bytes into text, a program has to know the encoding used. A similar problem occurs with sexy
[Dorset] Things discussed and results:
Only from my point of view. As discussed with CPK I have found out how to use Dolphin in Kubuntu to sftp into my Raspberry Pi. At the moment it is taking forever, but I will try again later. And from the discussions with Ralph about my HTML program/CSS and Javascript, I have taken out a whole pile of stuff and it works just the same. Then I took out those .HIGH and .LOW statements and got different colours. And I tried the right-click Inspect on the HTML button and found all sorts of interesting stuff, like where the default colours are. I think that Ralph and Tim said that I could edit that stuff so I'll have more fun tomorrow. And that was just my little corner. Peter -- 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