Link Here
|
1 |
#!/bin/sh |
2 |
# |
3 |
# PROVIDE: webcamd |
4 |
# REQUIRE: FILESYSTEMS netif dbus |
5 |
# BEFORE: devd |
6 |
# KEYWORD: shutdown |
7 |
|
8 |
. /etc/rc.subr |
9 |
|
10 |
name=remarkable |
11 |
rcvar=remarkable_enable |
12 |
load_rc_config $name |
13 |
|
14 |
devd_device=${2} |
15 |
start_cmd="${name}_start" |
16 |
|
17 |
remarkable_start_devd() |
18 |
{ |
19 |
# Find the USB Ethernet for the device |
20 |
# We first grab the total number of interfaces in |
21 |
# the case when all the interfaces are USB Ethernet |
22 |
local total_ifs=`sysctl -n net.link.generic.system.ifcount` |
23 |
local i=0 |
24 |
for i in $(seq 0 $total_ifs) |
25 |
do |
26 |
ueparent=`sysctl -n net.ue.$i.%parent` |
27 |
if [ $? -eq 0 ] && [ $ueparent = $devd_device ]; then |
28 |
/sbin/dhclient ue$i |
29 |
return |
30 |
fi |
31 |
done |
32 |
echo "Couldn't find a remarkable tablet." |
33 |
} |
34 |
|
35 |
remarkable_start() |
36 |
{ |
37 |
if [ "$devd_device" ]; then |
38 |
remarkable_start_devd |
39 |
else |
40 |
echo "Plug in your Remarkable to connect to it" |
41 |
fi |
42 |
} |
43 |
|
44 |
run_rc_command "$1" |
45 |
|