kernel: implement tty driver system
This commit is contained in:
22
dev/fb.c
22
dev/fb.c
@@ -48,14 +48,25 @@ kern_status_t framebuffer_device_register(struct device *dev)
|
||||
return object_namespace_create_link(global_namespace(), path, &dev->dev_base);
|
||||
}
|
||||
|
||||
kern_status_t framebuffer_get_varinfo(struct device *dev, struct framebuffer_varinfo *varinfo)
|
||||
kern_status_t framebuffer_get_fixedinfo(struct device *dev, struct framebuffer_fixedinfo *out)
|
||||
{
|
||||
struct framebuffer_device *fbdev = FRAMEBUFFER_DEVICE(dev);
|
||||
if (!fbdev) {
|
||||
return KERN_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
memcpy(varinfo, &fbdev->fb_varinfo, sizeof *varinfo);
|
||||
memcpy(out, &fbdev->fb_fixedinfo, sizeof *out);
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
kern_status_t framebuffer_get_varinfo(struct device *dev, struct framebuffer_varinfo *out)
|
||||
{
|
||||
struct framebuffer_device *fbdev = FRAMEBUFFER_DEVICE(dev);
|
||||
if (!fbdev) {
|
||||
return KERN_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
memcpy(out, &fbdev->fb_varinfo, sizeof *out);
|
||||
return KERN_OK;
|
||||
}
|
||||
|
||||
@@ -70,7 +81,12 @@ kern_status_t framebuffer_set_varinfo(struct device *dev, const struct framebuff
|
||||
return KERN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return fbdev->fb_ops->set_varinfo(dev, varinfo);
|
||||
kern_status_t status = fbdev->fb_ops->set_varinfo(dev, varinfo);
|
||||
if (status == KERN_OK) {
|
||||
memcpy(&fbdev->fb_varinfo, varinfo, sizeof *varinfo);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
struct device_type_ops framebuffer_type_ops = {
|
||||
|
||||
Reference in New Issue
Block a user