libraw1394: version 2.0.4
Prev | Chapter 3. Data Structures and Program Flow | Next

# 3.6. Generation Numbers

libraw1394 and the kernel code use generation numbers to identify the current bus configuration and increment those on every configuration change. The most important generation number is stored per connected 1394 bus and incremented on every bus reset. There is another number managed by raw1394 which identifies global changes (like a complete port being added or removed), which is used for the `raw1394_set_port()` function to make sure you don't use stale port numbers. This is done transparently to you.

The bus generation number is more relevant for your work. Since nodes can change IDs with every bus reset, it is very likely that you don't want to send a packet you constructed with the old ID before you noticed the bus reset. This does not apply to isochronous transmissions, since they are broadcast and do not depend on bus configuration. Therefore every packet is automatically tagged with the expected generation number, and it will fail to send if that does not match the number managed in the kernel for the port in question.

You get the current generation number through the bus reset handler. If you don't set a custom bus reset handler, the default handler will update the generation number automatically. If you set your own handler, you can update the generation number to be used through `raw1394_update_generation()` directly in the handler or later.

Prev | Home | Next
Handlers | Up | Error and Success Codes