tools/testing/selftests/media_tests/media_dev_allocator.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/media_tests/media_dev_allocator.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/media_tests/media_dev_allocator.sh- Extension
.sh- Size
- 1969 bytes
- Lines
- 86
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Media Device Allocator API test script
# Copyright (c) 2019 Shuah Khan <shuah@kernel.org>
echo "Media Device Allocator testing: unbind and bind"
echo "media driver $1 audio driver $2"
MDRIVER=/sys/bus/usb/drivers/$1
cd $MDRIVER
MDEV=$(ls -d *\-*)
ADRIVER=/sys/bus/usb/drivers/$2
cd $ADRIVER
ADEV=$(ls -d *\-*.1)
echo "=================================="
echo "Test unbind both devices - start"
echo "Running unbind of $MDEV from $MDRIVER"
echo $MDEV > $MDRIVER/unbind;
echo "Media device should still be present!"
ls -l /dev/media*
echo "sound driver is at: $ADRIVER"
echo "Device is: $ADEV"
echo "Running unbind of $ADEV from $ADRIVER"
echo $ADEV > $ADRIVER/unbind;
echo "Media device should have been deleted!"
ls -l /dev/media*
echo "Test unbind both devices - end"
echo "=================================="
echo "Test bind both devices - start"
echo "Running bind of $MDEV from $MDRIVER"
echo $MDEV > $MDRIVER/bind;
echo "Media device should be present!"
ls -l /dev/media*
echo "Running bind of $ADEV from $ADRIVER"
echo $ADEV > $ADRIVER/bind;
echo "Media device should be there!"
ls -l /dev/media*
echo "Test bind both devices - end"
echo "=================================="
echo "Test unbind $MDEV - bind $MDEV - unbind $ADEV - bind $ADEV start"
echo "Running unbind of $MDEV from $MDRIVER"
echo $MDEV > $MDRIVER/unbind;
echo "Media device should be there!"
ls -l /dev/media*
sleep 1
echo "Running bind of $MDEV from $MDRIVER"
echo $MDEV > $MDRIVER/bind;
echo "Media device should be there!"
ls -l /dev/media*
echo "Running unbind of $ADEV from $ADRIVER"
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.