On Fri, 23 Nov 2018 05:13:02 +0100, Takashi Sakamoto wrote:
Hi,
Units of TASCAM FireWire series transfer its state in tx isochronous packets. The way to handle change of the state is a longstanding issue since I firstly reveal the mechanism in this list[1].
In this time, Scott Bahling dedicates for further investigation to seek better implementation[2][3][4]. Finally, we identified meaning of the most of bits in the image of state, and decided which changes are worth for userspace applications to handle as events.
This commit adds support notification of the events. Userspace applications can handle the notification via ALSA hwdep interface. Furthermore, they can retrieve image of the latest states via the interface.
Changes from the initial proposal[5]:
- obsolete usage of mmap(2) due to several disadvantages. Instead, use event queue for change notification, and add ioctl command to retrieve image of states.
Changes from the latest work[6]:
- To reduce time in an interrupt context in which tx isochronous packets are handled, data in the event and the image is passed to userspace in big-endian order. Additionally, image of the states are passed to userspace in big-endian order as well. Userspace applications are responsible to convert the data in host-endianness order.
- improve efficiency to copy batch of events to userspace in hwdep interface
- rename structure and macro name.
This patchset is also available in my remote branch for backport purpose to Linux v4.17 or later[7].
I've already prepare userspace implementation; libhinwa. A 'topic/firewire-tascam-pr' remote branch includes patchset for the additional feature[8]. This library produces GObject class to handle the event notification and emits GObject signal, and has a method 'HinawaSndTscm.get_state()', with enough consideration to endianness. Developers can process change of state with these two APIs.
Scott
As the above, I changed method name from 'HinawaSndTscm.get_status()'. I'd like you to change your local implementation for 'hinawa-utils'. Sorry to add further work to you.
[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2015-July/094817.html [2] http://mailman.alsa-project.org/pipermail/alsa-devel/2018-September/140051.h... [3] http://mailman.alsa-project.org/pipermail/alsa-devel/2018-October/140593.htm... [4] http://mailman.alsa-project.org/pipermail/alsa-devel/2018-November/141395.ht... [5] https://github.com/takaswie/snd-firewire-improve/tree/topic/tascam-userspace [6] https://github.com/takaswie/snd-firewire-improve/tree/topic/tascam-userspace... [7] https://github.com/takaswie/snd-firewire-improve/tree/topic/tascam-userspace... [8] https://github.com/takaswie/libhinawa/tree/topic/tascam-userspace-pr
Regards
Takashi Sakamoto (5): ALSA: firewire-tascam: pick up data of state from tx isochronous pakcets ALSA: firewire-tascam: add new hwdep ioctl command to get state image ALSA: firewire-tascam: queue events for change of control surface ALSA: firewire-tascam: apply small refactoring to handle several type of event for hwdep interface ALSA: firewire-tascam: notify events of change of state for userspace applications
Applied all five patches now. Thanks.
Takashi