On Thu, Jan 28, 2010 at 6:51 AM, Oliver Schwartz <Oliver.Schwartz at gmx.de> wrote: > Hi all, > > On 26.01.2010, at 15:46, m. allan noah wrote: > >> Seems like an individual backend should not need to parse the device >> string. Isn't there some other way to come up with a unique semaphore, >> like process id? > > > the process id could be used, but it may fail theoretically. One example is > a frontend that uses two (snapscan-)scanners at the same time (not that I > think anybody actually does that). > > The clean solution is a semaphore per device. In the days before libusb the > backend used ftok(). The current code was written by Julien, as far as I > know, because the ftok() call failed miserably and the unique id was always > 0. > > So I guess I'll stay with the device string, but maybe use some sort of crc > instead of parsing it. Other ideas are, of course, welcome.
I would do both- process ID combined with a hash of the device name, unless you have the ability to get a unique serial number out of the hardware... allan -- "The truth is an offense, but not a sin"