그렇게 하자면, 새로운 system call 을 만들거나,
혹은, ioctl 시스템 콜에 새로운 ioctl 명령어(?)를 추가하거나 하시면
됩니다.
새로운 system call 을 만드는 방법은 추천하고 싶지 않습니다. (사실 그
렇게 하는 방법을 자세히 모릅니다 -_-;;)
간단한 문자 장치 드라이버의 소스에서 ioctl 을 구현한 부분을
참조하시면 됩니다. 매직넘버의 선택에 약간만 신경을 쓰면, 나머지는 쉽
게 만들 수 있을 겁니다.
뭐... 다음과 같이 만들면 됩니다
static int seestack_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)
{
unsigned long size;
int retval;
uint8_t comport_number;
Re: [질문]커널의 드라이버 부분 함수 호출해서 사용하기에 대하
그렇게 하자면, 새로운 system call 을 만들거나,
혹은, ioctl 시스템 콜에 새로운 ioctl 명령어(?)를 추가하거나 하시면
됩니다.
새로운 system call 을 만드는 방법은 추천하고 싶지 않습니다. (사실 그
렇게 하는 방법을 자세히 모릅니다 -_-;;)
간단한 문자 장치 드라이버의 소스에서 ioctl 을 구현한 부분을
참조하시면 됩니다. 매직넘버의 선택에 약간만 신경을 쓰면, 나머지는 쉽
게 만들 수 있을 겁니다.
뭐... 다음과 같이 만들면 됩니다
static int seestack_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)
{
unsigned long size;
int retval;
uint8_t comport_number;
FNAMETTY("seestack_ioctl");
down(&seestack_ioctl_sem);
retval = 0;
size = _IOC_SIZE(cmd);
comport_number = MINOR(tty->device) - tty->driver.minor_start;
SEEDBG("ioctl cmd = %d\n", cmd);
switch (cmd)
{
case SEESTACK_GAP_SET_DICOVERY_MODE
{
/*
* int ioctl(fd, SEESTACK_GAP_SET_DISCOVERY_MODE, seestack_gap_req_in * in);
*/
seestack_gap_req_in in;
Bt_Status st;
copy_from_user((void *) &in, (const void *) arg, size);
SEEDBG("ioctl GAP_SET_DISCOVERY_MODE %02x, %02x, %02x\n", in.mode, in.interval, in.window);
st = GAP_set_discoverable_mode(in.mode, in.interval, in.window);
SEEDBG("ioctl Bt_Status = %d\n", st);
}
break;
case SEESTACK_GAP_SET_CONNECTABLE_MODE
{
.
.
.
댓글 달기