Documentation/userspace-api/media/rc/keytable.c.rst
Source file repositories/reference/linux-study-clean/Documentation/userspace-api/media/rc/keytable.c.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/userspace-api/media/rc/keytable.c.rst- Extension
.rst- Size
- 4458 bytes
- Lines
- 177
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
ctype.herrno.hfcntl.hstdio.hstdlib.hstring.hlinux/input.hsys/ioctl.hparse.h
Detected Declarations
function prtcodefunction parse_codefunction main
Annotated Snippet
if (p->value == (unsigned)codes[1]) {
printf("scancode 0x%04x = %s (0x%02x)\\n", codes[0], p->name, codes[1]);
return;
}
}
if (isprint (codes[1]))
printf("scancode %d = '%c' (0x%02x)\\n", codes[0], codes[1], codes[1]);
else
printf("scancode %d = 0x%02x\\n", codes[0], codes[1]);
}
int parse_code(char *string)
{
struct parse_key *p;
for (p=keynames;p->name!=NULL;p++) {
if (!strcasecmp(p->name, string)) {
return p->value;
}
}
return -1;
}
int main (int argc, char *argv[])
{
int fd;
unsigned int i, j;
int codes[2];
if (argc<2 || argc>4) {
printf ("usage: %s <device> to get table; or\\n"
" %s <device> <scancode> <keycode>\\n"
" %s <device> <keycode_file>n",*argv,*argv,*argv);
return -1;
}
if ((fd = open(argv[1], O_RDONLY)) < 0) {
perror("Couldn't open input device");
return(-1);
}
if (argc==4) {
int value;
value=parse_code(argv[3]);
if (value==-1) {
value = strtol(argv[3], NULL, 0);
if (errno)
perror("value");
}
codes [0] = (unsigned) strtol(argv[2], NULL, 0);
codes [1] = (unsigned) value;
if(ioctl(fd, EVIOCSKEYCODE, codes))
perror ("EVIOCSKEYCODE");
if(ioctl(fd, EVIOCGKEYCODE, codes)==0)
prtcode(codes);
return 0;
}
if (argc==3) {
FILE *fin;
int value;
char *scancode, *keycode, s[2048];
fin=fopen(argv[2],"r");
Annotation
- Immediate include surface: `ctype.h`, `errno.h`, `fcntl.h`, `stdio.h`, `stdlib.h`, `string.h`, `linux/input.h`, `sys/ioctl.h`.
- Detected declarations: `function prtcode`, `function parse_code`, `function main`.
- Atlas domain: Support Tooling And Documentation / Documentation.
- 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.