feat(kernel): add stub device /dev/fb0

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
EnderIce2 2025-02-14 19:57:29 +02:00
parent d9235c6f90
commit e927d93a48
No known key found for this signature in database
GPG Key ID: 2EE20AF089811A5A
2 changed files with 76 additions and 6 deletions

View File

@ -45,14 +45,19 @@ namespace Driver
* 4 - /dev/random
* 5 - /dev/mem
* 6 - /dev/kcon
* 7 - /dev/tty
* 8 - /dev/ptmx
* 7 - /dev/tty
* 8 - /dev/ptmx
*
* maj = 1
* min:
* 0 - /dev/input/keyboard
* 1 - /dev/input/mouse
* ..- /dev/input/eventX
* 0 - /dev/input/keyboard
* 1 - /dev/input/mouse
* ..- /dev/input/eventN
*
* maj = 2
* min:
* 0 - /dev/fb0
* ..- /dev/fbN
*/
TTY::PTMXDevice *ptmx = nullptr;
@ -205,6 +210,16 @@ namespace Driver
return -ENOENT;
};
}
case 2:
{
switch (Node->GetMinor())
{
case 0: /* /dev/fb0 */
return -EINVAL;
default:
return -ENOENT;
}
}
default:
{
std::unordered_map<dev_t, Driver::DriverObject> &drivers =
@ -283,6 +298,16 @@ namespace Driver
return -ENOENT;
};
}
case 2:
{
switch (Node->GetMinor())
{
case 0: /* /dev/fb0 */
return -EINVAL;
default:
return -ENOENT;
}
}
default:
{
std::unordered_map<dev_t, Driver::DriverObject> &drivers =
@ -467,6 +492,32 @@ namespace Driver
return -ENOENT;
};
}
case 2:
{
switch (Node->GetMinor())
{
case 0: /* /dev/fb0 */
{
switch (Request)
{
case FBIOGET_SCREEN_INFO:
{
FramebufferScreenInfo *info = (FramebufferScreenInfo *)Argp;
info->Width = Display->GetWidth;
info->Height = Display->GetHeight;
info->Pitch = Display->GetPitch();
info->Bpp = Display->GetBitsPerPixel();
info->Size = Display->GetSize;
return 0;
}
default:
return -ENOSYS;
}
}
default:
return -ENOENT;
}
}
default:
{
std::unordered_map<dev_t, Driver::DriverObject> &drivers =
@ -870,7 +921,6 @@ namespace Driver
createDevice(_dev, devNode, "ptmx", 0, MinorID++, mode);
/* ------------------------------------------------------ */
MinorID = 0;
/* c rw- r-- --- */
@ -886,5 +936,14 @@ namespace Driver
S_IFCHR;
createDevice(input, devInputNode, "mouse", 1, MinorID++, mode);
/* ------------------------------------------------------ */
MinorID = 0;
/* c rw- r-- --- */
mode = S_IRUSR | S_IWUSR |
S_IRGRP |
S_IFCHR;
createDevice(_dev, devNode, "fb0", 2, MinorID++, mode);
}
}

View File

@ -531,6 +531,17 @@ static_assert((int)__SYS_SIG_IGN == (int)___SYS_SIG_IGN, "SIG_IGN values do not
typedef int __SYS_clockid_t;
typedef unsigned int __SYS_socklen_t;
typedef struct FramebufferScreenInfo
{
__UINT32_TYPE__ Width;
__UINT32_TYPE__ Height;
__UINT32_TYPE__ Pitch;
__UINT32_TYPE__ Bpp;
__UINT32_TYPE__ Size;
} FramebufferScreenInfo;
#define FBIOGET_SCREEN_INFO 0xf0
/**
* @brief List of syscalls
*