Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions smartlamp-kernel-module/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
obj-m += SUBISTITUA_PELO_NOME_DO_MODULO.o
obj-m += probe.o
PWD := $(CURDIR)

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Empty file.
1 change: 1 addition & 0 deletions smartlamp-kernel-module/modules.order
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/devtitans-1/Hands-On-Linux/smartlamp-kernel-module/probe.ko
4 changes: 2 additions & 2 deletions smartlamp-kernel-module/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ static uint usb_in, usb_out; // Endereços das portas de e
static char *usb_in_buffer, *usb_out_buffer; // Buffers de entrada e saída da USB
static int usb_max_size; // Tamanho máximo de uma mensagem USB

#define VENDOR_ID SUBSTITUA_PELO_VENDORID /* Encontre o VendorID do smartlamp */
#define PRODUCT_ID SUBSTITUA_PELO_PRODUCTID /* Encontre o ProductID do smartlamp */
#define VENDOR_ID 0x10c4 /* Encontre o VendorID do smartlamp */
#define PRODUCT_ID 0xea60 /* Encontre o ProductID do smartlamp */
static const struct usb_device_id id_table[] = { { USB_DEVICE(VENDOR_ID, PRODUCT_ID) }, {} };

static int usb_probe(struct usb_interface *ifce, const struct usb_device_id *id); // Executado quando o dispositivo é conectado na USB
Expand Down
Binary file added smartlamp-kernel-module/probe.ko
Binary file not shown.
2 changes: 2 additions & 0 deletions smartlamp-kernel-module/probe.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/home/devtitans-1/Hands-On-Linux/smartlamp-kernel-module/probe.o

46 changes: 46 additions & 0 deletions smartlamp-kernel-module/probe.mod.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <linux/module.h>
#define INCLUDE_VERMAGIC
#include <linux/build-salt.h>
#include <linux/elfnote-lto.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>

BUILD_SALT;
BUILD_LTO_INFO;

MODULE_INFO(vermagic, VERMAGIC_STRING);
MODULE_INFO(name, KBUILD_MODNAME);

__visible struct module __this_module
__section(".gnu.linkonce.this_module") = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};

#ifdef CONFIG_RETPOLINE
MODULE_INFO(retpoline, "Y");
#endif

static const struct modversion_info ____versions[]
__used __section("__versions") = {
{ 0xdc658e53, "module_layout" },
{ 0xaad01b89, "usb_deregister" },
{ 0xd670cf94, "usb_register_driver" },
{ 0xd0da656b, "__stack_chk_fail" },
{ 0xeb233a45, "__kmalloc" },
{ 0x93c7edeb, "usb_find_common_endpoints" },
{ 0x5b8239ca, "__x86_return_thunk" },
{ 0x37a0cba, "kfree" },
{ 0x92997ed8, "_printk" },
{ 0xbdfb6dbb, "__fentry__" },
};

MODULE_INFO(depends, "");

MODULE_ALIAS("usb:v10C4pEA60d*dc*dsc*dp*ic*isc*ip*in*");

MODULE_INFO(srcversion, "C8D964DC7A4CC1F840A27AB");
Binary file added smartlamp-kernel-module/probe.mod.o
Binary file not shown.
Binary file added smartlamp-kernel-module/probe.o
Binary file not shown.