Skip to content

Commit

Permalink
Make the driver transmit data to linux
Browse files Browse the repository at this point in the history
  • Loading branch information
xhero committed Aug 7, 2023
1 parent f886df4 commit 0e4d886
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
KPATH := /usr/src/linux-headers-`uname -r`
#KPATH := /home/ubuntu/linux-5.19
#KPATH := /usr/src/linux-headers-`uname -r`
KPATH := /home/ubuntu/linux-5.19

obj-m := ./src/hello.o

Expand Down
4 changes: 3 additions & 1 deletion boom
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
sudo modprobe appletalk
sudo insmod src/hello.ko
#sudo slattach -s 115200 -p cslip /dev/ttyUSB0
sudo ./discipline
#sudo ./discipline

sudo ldattach -d -s 1000000 PPP /dev/ttyUSB0

#echo 'file hello.c line 327 +p' > /sys/kernel/debug/dynamic_debug/control
8 changes: 4 additions & 4 deletions discipline.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ int tty_open(char *name, const char *speed)



if ((fd = open("/dev/ttyS0", O_RDWR|O_NDELAY)) < 0) {
printf("oops");
if ((fd = open("/dev/ttyUSB0", O_RDWR|O_NDELAY)) < 0) {
perror("oops");
return(-errno);
}
tty_fd = fd;
Expand Down Expand Up @@ -398,7 +398,7 @@ main()



if (tty_open("/dev/ttyS0", "115200") < 0) { return(3); }
if (tty_open("/dev/ttyUSB0", "115200") < 0) { return(3); }


int disc = N_PPP;
Expand All @@ -417,7 +417,7 @@ main()
if (tty_get_name(buff)) { return(3); }
printf(("%s started"), proto);

if (path_dev != NULL) printf((" on /dev/ttyS0"));
if (path_dev != NULL) printf((" on /dev/ttyUSB0"));
printf((" interface %s\n"), buff);


Expand Down
7 changes: 4 additions & 3 deletions src/hello.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,12 @@ static void slip_receive_buf(struct tty_struct *tty, const unsigned char *cp,
}

skb_put_data(skb, cp, count);
skb->dev = dev;
skb->protocol = htons(ETH_P_LOCALTALK);

skb_reset_mac_header(skb); /* Point to entire packet. */
skb_pull(skb,3);
skb_reset_transport_header(skb); /* Point to data (Skip header). */
//skb_reset_mac_header(skb); /* Point to entire packet. */
//skb_pull(skb,3);
//skb_reset_transport_header(skb); /* Point to data (Skip header). */

netif_rx(skb);
dev->stats.rx_packets++;
Expand Down

0 comments on commit 0e4d886

Please sign in to comment.