Skip to content

Commit

Permalink
Remove unused stuff from _blueman
Browse files Browse the repository at this point in the history
  • Loading branch information
cschramm committed Sep 6, 2022
1 parent 558dca2 commit 2371a40
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 76 deletions.
4 changes: 2 additions & 2 deletions module/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ BUILT_SOURCES = _blueman.c

bluemanlibdir = $(pyexecdir)
bluemanlib_LTLIBRARIES = _blueman.la
_blueman_la_CFLAGS = $(BLUEZ_CFLAGS) $(PYGOBJECT_CFLAGS) $(PYTHON_CFLAGS) \
_blueman_la_CFLAGS = $(BLUEZ_CFLAGS) $(PYTHON_CFLAGS) \
-DSN_API_NOT_YET_FROZEN
_blueman_la_LDFLAGS = -module -avoid-version -fPIC
_blueman_la_LIBADD = $(BLUEZ_LIBS) $(PYGOBJECT_LIBS) $(PYTHON_LIBS)
_blueman_la_LIBADD = $(BLUEZ_LIBS) $(PYTHON_LIBS)
_blueman_la_SOURCES = \
_blueman.c \
libblueman.c \
Expand Down
22 changes: 0 additions & 22 deletions module/_blueman.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
# coding=utf-8
#cython: language_level=3
import logging

cdef extern from "malloc.h":
cdef void free(void *ptr)
Expand All @@ -14,7 +13,6 @@ cdef extern from "bluetooth/bluetooth.h":
unsigned char b[6]

int ba2str(bdaddr_t *ba, char *str)
int str2ba(char *str, bdaddr_t *ba)

cdef extern from "bluetooth/hci.h":
cdef struct hci_dev_stats:
Expand Down Expand Up @@ -88,7 +86,6 @@ cdef extern from "libblueman.h":
cdef int get_rfcomm_list(rfcomm_dev_list_req **ret)
cdef int c_create_rfcomm_device "create_rfcomm_device" (char *local_address, char *remote_address, int channel)
cdef int c_release_rfcomm_device "release_rfcomm_device" (int id)
cdef float get_page_timeout(int hdev)
cdef int _create_bridge(char* name)
cdef int _destroy_bridge(char* name)

Expand All @@ -106,8 +103,6 @@ ERR = {
-7:"Read Link quality failed",
-8:"Getting rfcomm list failed",
-9:"ERR_SOCKET_FAILED",
-10:"ERR_CANT_READ_PAGE_TIMEOUT",
-11:"ERR_READ_PAGE_TIMEOUT",
-12: "Can't bind RFCOMM socket",
-13: "Can't connect RFCOMM socket",
-14: "Can't create RFCOMM TTY",
Expand Down Expand Up @@ -269,17 +264,6 @@ cdef class conn_info:

return tpl

def page_timeout(py_hci_name="hci0"):
py_bytes_hci_name = py_hci_name.encode("UTF-8")
cdef char* hci_name = py_bytes_hci_name

dev_id = int(hci_name[3:])
ret = get_page_timeout(dev_id)
if ret < 0:
raise Exception, ERR[ret]
else:
return ret

def device_info(py_hci_name="hci0"):
py_bytes_hci_name = py_hci_name.encode("UTF-8")
cdef char* hci_name = py_bytes_hci_name
Expand Down Expand Up @@ -324,9 +308,3 @@ def device_info(py_hci_name="hci0"):
("stat", dict(x))]

return dict(z)

cdef extern from "glib-object.h":
ctypedef struct GObject

cdef extern from "pygobject.h":
cdef GObject* pygobject_get(object)
49 changes: 2 additions & 47 deletions module/libblueman.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static inline unsigned long __tv_to_jiffies(const struct timeval *tv)

return jif/10000;
}

int _create_bridge(const char* name) {
int sock;
sock = socket(AF_INET, SOCK_STREAM, 0);
Expand Down Expand Up @@ -132,7 +132,7 @@ int _destroy_bridge(const char* name) {
return 0;
}

int find_conn(int s, int dev_id, long arg)
static int find_conn(int s, int dev_id, long arg)
{
struct hci_conn_list_req *cl;
struct hci_conn_info *ci;
Expand Down Expand Up @@ -431,48 +431,3 @@ int release_rfcomm_device(int id) {
return 0;
}
}

float get_page_timeout(int hdev)
{
struct hci_request rq;
int s;
float ret;

if ((s = hci_open_dev(hdev)) < 0) {
ret = ERR_HCI_DEV_OPEN_FAILED;
goto out;
}

memset(&rq, 0, sizeof(rq));

uint16_t timeout;
read_page_timeout_rp rp;

rq.ogf = OGF_HOST_CTL;
rq.ocf = OCF_READ_PAGE_TIMEOUT;
rq.rparam = &rp;
rq.rlen = READ_PAGE_TIMEOUT_RP_SIZE;

if (hci_send_req(s, &rq, 1000) < 0) {
ret = ERR_CANT_READ_PAGE_TIMEOUT;
goto out;
}
if (rp.status) {
ret = ERR_READ_PAGE_TIMEOUT;
goto out;
}

timeout = btohs(rp.timeout);
ret = ((float)timeout * 0.625);

out:
if (s >= 0)
hci_close_dev(s);
return ret;
}






4 changes: 0 additions & 4 deletions module/libblueman.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#define ERR_READ_LQ_FAILED -7
#define ERR_GET_RFCOMM_LIST_FAILED -8
#define ERR_SOCKET_FAILED -9
#define ERR_CANT_READ_PAGE_TIMEOUT -10
#define ERR_READ_PAGE_TIMEOUT -11
#define ERR_BIND_FAILED -12
#define ERR_CONNECT_FAILED -13
#define ERR_CREATE_DEV_FAILED -14
Expand All @@ -20,7 +18,6 @@ struct conn_info_handles {
int dd;
};

int find_conn(int s, int dev_id, long arg);
int connection_init(int dev_id, char *addr, struct conn_info_handles *ci);
int connection_get_rssi(struct conn_info_handles *ci, int8_t *ret_rssi);
int connection_get_lq(struct conn_info_handles *ci, uint8_t *ret_lq);
Expand All @@ -30,7 +27,6 @@ int get_rfcomm_channel(uint16_t uuid, char* btd_addr);
int get_rfcomm_list(struct rfcomm_dev_list_req **result);
int create_rfcomm_device(char *local_address, char *remote_address, int channel);
int release_rfcomm_device(int id);
float get_page_timeout(int hdev);

int _create_bridge(const char* name);
int _destroy_bridge(const char* name);
1 change: 0 additions & 1 deletion stubs/_blueman.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def create_bridge(name: str = "pan1") -> None: ...
def create_rfcomm_device(local_address: str, remote_address: str, channel: int) -> int: ...
def destroy_bridge(name: str = "pan1") -> None: ...
def device_info(hci_name: str = "hci0") -> _HciInfo: ...
def page_timeout(hci_name: str = "hci0") -> float: ...
def get_rfcomm_channel(uuid: int, bdaddr: str) -> Optional[int]: ...
def release_rfcomm_device(id: int) -> int: ...
def rfcomm_list() -> List[_RfcommDev]: ...

0 comments on commit 2371a40

Please sign in to comment.