phonet / capabilities

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

phonet / capabilities

Raphaël Droz
$ sudo getcap /usr/bin/gnokii
> /usr/bin/gnokii = cap_net_raw,cap_sys_admin+ep

# as unpriviledged user:

$ LANG=C strace gnokii --phone nokiausb2 --identify 2>&1|grep -i socket
> socket(0x23 /* PF_??? */, SOCK_DGRAM, 0) = -1 EPERM (Operation not permitted)
> write(2, "socket: Operation not permitted\n", 32socket: Operation not permitted

# as root

# LANG=C strace gnokii --phone nokiausb2  --identify 2>&1|grep -i socket
> socket(0x23 /* PF_??? */, SOCK_DGRAM, 0) = 4
> setsockopt(4, SOL_SOCKET, SO_BINDTODEVICE, "1", 1) = -1 ENODEV (No such device)


Question 1:
Granted here that as root, it can't find the device:
I don't know how to check for whether or not the phonet module got a
device attached, how to ?

Question 2:
the setcap does not seem sufficient. Does phonet depends upon another
permission amongs those from man 7 capabilities ?



thanks


Additional infos:
> linux-image-686-pae                   3.13+56
> gnokii                                0.6.30+dfsg-1

$ lsusb -d 0421:0264
> Bus 002 Device 002: ID 0421:0264 Nokia Mobile Phones

=> phone is plugged and is 0x0421

$ sudo modinfo cdc-phonet|grep alias
> alias:          usb:v0421p*d*dc*dsc*dp*ic02iscFEip*in*

=> phonet announce supporting this vendor id

$ lsmod|grep cdc
> cdc_phonet             12681  0
> phonet                 27101  1 cdc_phonet
> usbcore               133957  6 uhci_hcd,uvcvideo,usb_storage,ehci_hcd,ehci_pci,cdc_phonet

=> no other cdc* modules were loaded

_______________________________________________
gnokii-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/gnokii-users
Reply | Threaded
Open this post in threaded view
|

Re: phonet / capabilities

Raphaël Droz
Please excuse me, as I forget two things:

THe first one was to attach the config use:
> [phone_nokiausb2]
>         model = series40
>         port = 1
>         connection = phonet


The second one was that I didn't set the capabilities to the strace
binary too and why I got confused.

So: setting cap_net_raw (for setsockopt()) and cap_sys_admin (for
socket()) is sufficient.


Then I hit:
$ LANG=C strace gnokii --phone nokiausb2  --identify 2>&1|grep -i socket
> socket(0x23 /* PF_??? */, SOCK_DGRAM, 0) = 4
> setsockopt(4, SOL_SOCKET, SO_BINDTODEVICE, "1", 1) = -1 ENODEV (No such device)

## permission/capabilities problem solved

Reading through
http://lists.nongnu.org/archive/html/gnokii-users/2011-11/msg00007.html
it appears that the wiki (advising port = 1) is very misleading, thus I tried:

> [phone_nokiausb2]
>         model = series40
>         port = usbpn0
>         connection = phonet

which seems far more better:
I now get:
> $ LANG=C strace gnokii --phone nokiausb3  --identify 2>&1|grep -i socket
> socket(0x23 /* PF_??? */, SOCK_DGRAM, 0) = 4
> setsockopt(4, SOL_SOCKET, SO_BINDTODEVICE, "usbpn0", 6) = 0

(as unpriviledged user).

Note that using:
port = 0 or port = usbpn1 both results in setsockopt returning ENODEV.
usbpn0 is thus a good bet.

## phonet port settings solved


But I know get:
> Serial device: opening device usbpn0
> Getting model...
> Message sent: 0x1b / 0x0006
> 00 01 00 07 01 00                               |                
> sendto: No route to host

and more exactly:
> sendto(4, "\0\7\1\0", 4, 0, {sa_family=0x23 /* AF_??? */, sa_data="\0\0\33\0\0\0\0\0\0\0\0\0\0\0"}, 16) = -1 EHOSTUNREACH (No route to host)


And I don't know how to troubleshoot that...






On Mon, Sep 29, 2014 at 04:42:18PM -0300, Raphaël Droz wrote:

> $ sudo getcap /usr/bin/gnokii
> > /usr/bin/gnokii = cap_net_raw,cap_sys_admin+ep
>
> # as unpriviledged user:
>
> $ LANG=C strace gnokii --phone nokiausb2 --identify 2>&1|grep -i socket
> > socket(0x23 /* PF_??? */, SOCK_DGRAM, 0) = -1 EPERM (Operation not permitted)
> > write(2, "socket: Operation not permitted\n", 32socket: Operation not permitted
>
> # as root
>
> # LANG=C strace gnokii --phone nokiausb2  --identify 2>&1|grep -i socket
> > socket(0x23 /* PF_??? */, SOCK_DGRAM, 0) = 4
> > setsockopt(4, SOL_SOCKET, SO_BINDTODEVICE, "1", 1) = -1 ENODEV (No such device)
>
>
> Question 1:
> Granted here that as root, it can't find the device:
> I don't know how to check for whether or not the phonet module got a
> device attached, how to ?
>
> Question 2:
> the setcap does not seem sufficient. Does phonet depends upon another
> permission amongs those from man 7 capabilities ?
>
>
>
> thanks
>
>
> Additional infos:
> > linux-image-686-pae                   3.13+56
> > gnokii                                0.6.30+dfsg-1
>
> $ lsusb -d 0421:0264
> > Bus 002 Device 002: ID 0421:0264 Nokia Mobile Phones
>
> => phone is plugged and is 0x0421
>
> $ sudo modinfo cdc-phonet|grep alias
> > alias:          usb:v0421p*d*dc*dsc*dp*ic02iscFEip*in*
>
> => phonet announce supporting this vendor id
>
> $ lsmod|grep cdc
> > cdc_phonet             12681  0
> > phonet                 27101  1 cdc_phonet
> > usbcore               133957  6 uhci_hcd,uvcvideo,usb_storage,ehci_hcd,ehci_pci,cdc_phonet
>
> => no other cdc* modules were loaded

--
GPG id: 0xD7F62B21

_______________________________________________
gnokii-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/gnokii-users
Reply | Threaded
Open this post in threaded view
|

Re: phonet / capabilities

Daniele Forsi-2
2014-09-29 22:14 GMT+02:00 Raphaël Droz:

> sendto: No route to host

on some (most?) systems you need
ifconfig usbpn0 up
this is documented only in Docs/README-6510

better use dku2libusub because some commands currently fail with
connection=phonet (--getfile and --putfile and so --getsms doesn't
work on S40 3rd) and it's more secure on a multiuser system

--
Daniele Forsi

_______________________________________________
gnokii-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/gnokii-users
Reply | Threaded
Open this post in threaded view
|

Re: phonet / capabilities

Raphaël Droz
On Mon, Sep 29, 2014 at 10:55:14PM +0200, Daniele Forsi wrote:
> 2014-09-29 22:14 GMT+02:00 Raphaël Droz:
>
> > sendto: No route to host
>
> on some (most?) systems you need
> ifconfig usbpn0 up
> this is documented only in Docs/README-6510

indeed... --identify now works !
thank you !


As I now have both bluetooth, AT and phonet working, I noted these small
differences between AT (ttyACM) and phonet:


=========== using cdc-acm:

> IMEI         : X
> Manufacturer : Nokia
> Model        : Nokia 7230-1c
> Product name : Nokia 7230-1c
> Revision     : V 10.81

while the logs show:

> write: [AT+CGMR<cr>]
> read : [AT+CGMR<cr><cr><lf>V 10.81<cr><lf>28-02-11<cr><lf>RM-598<cr><lf>(c) Nokia            <cr><lf><cr><lf>OK<cr><lf>]

--identify lacks firmware date and RM-type although they are returned by
the phone.


=========== using cdc-phonet:

> IMEI         : X
> Manufacturer : Nokia
> Model        : RM-598
> Product name : RM-598
> Revision     : V 10.81

while the logs shows:

> Message sent: 0x1b / 0x0006
> 00 01 00 07 01 00                               |                
> Message received: 0x1b / 0x003a
> 00 00 00 08 00 01 58 34 00 30 56 20 31 30 2e 38 |       X4 0V 10.8
> 31 0a 32 38 2d 30 32 2d 31 31 0a 52 4d 2d 35 39 | 1 28-02-11 RM-59
> 38 0a 28 63 29 20 4e 6f 6b 69 61 20 20 20 20 20 | 8 (c) Nokia    
> 20 20 20 20 20 20 20 0a 4c 00                   |         L

--identify lacks firmware date too.
Sadly the model can't be determined (it does not show up in the message
returned by the phone).


regards

_______________________________________________
gnokii-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/gnokii-users
Reply | Threaded
Open this post in threaded view
|

Re: dku2libusub timeout

Raphaël Droz
In reply to this post by Daniele Forsi-2
On Mon, Sep 29, 2014 at 10:55:14PM +0200, Daniele Forsi wrote:
> better use dku2libusub because some commands currently fail with
> connection=phonet

I'd like to, especially since it theoretically allow more powerful phone
interactions but I can't get it to work.
usb/* permissions are ok, message is sent, but timeouts occurs and no
response arises.

[...]
> model = series40
> port = 2
> connection = dku2libusb
> initlength = default
> serial_baudrate = 19200
[...]
> Serial device: opening device USB
> Ignoring extra header, type 171, length 5
> Found FBUS interface
> Ignoring extra header, type 171, length 5
> Found FBUS interface
> Ignoring extra header, type 171, length 5
> Found FBUS interface
> Getting model...
> Message sent: 0x1b / 0x0006


Using strace and given that the correct bus is the usb/002/002
I should first note that, very strangely since I set the gnokii "port"
setting, all usb ports are tried in both O_RDWR then O_RDONLY, and all
fail (except 002/002) on EACCES because udev # didn't set them to the
"audio" group.
Anyway...


# [ other usb > 002 are tried]

> open("/dev/bus/usb/002", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 5
> getdents(5, /* 4 entries */, 32768)     = 64
> open("/dev/bus/usb/002/002", O_RDWR)    = 6
> ioctl(6, USBDEVFS_CONNECTINFO, 0xbf904050) = 0
> read(6, "\22\1\0\2\2\0\0@!\4d\2\201\20\1\2\3\3", 18) = 18
> read(6, "\t\2\377\1\20\1\0\200", 8)     = 8
> read(6, "\372\t\4\0\0\3\377\0\0\0\7\5\201\2@\0\0\7\5\1\2@\0\0\7\5\202\3@\0@\t"..., 503) = 503
> read(6, "\t\2\377\1\20\2\0\300", 8)     = 8
> read(6, "2\t\4\0\0\3\377\0\0\0\7\5\201\2@\0\0\7\5\1\2@\0\0\7\5\202\3@\0@\t"..., 503) = 503
> read(6, "\t\2\377\1\20\3\0\300", 8)     = 8
> read(6, "\4\t\4\0\0\3\377\0\0\0\7\5\201\2@\0\0\7\5\1\2@\0\0\7\5\202\3@\0@\t"..., 503) = 503
> close(6)

# [ other usb < 002 are tried ]
# then

> open("/dev/bus/usb/002/002", O_RDWR)    = 5
> ioctl(5, USBDEVFS_CONTROL or USBDEVFS_CONTROL32, 0xbf905f30) = 4
> ioctl(5, USBDEVFS_CONTROL or USBDEVFS_CONTROL32, 0xbf905f30) = 12
> ioctl(5, USBDEVFS_CONTROL or USBDEVFS_CONTROL32, 0xbf905f30) = 4
> ioctl(5, USBDEVFS_CONTROL or USBDEVFS_CONTROL32, 0xbf905f30) = 28
> ioctl(5, USBDEVFS_CONTROL or USBDEVFS_CONTROL32, 0xbf905f30) = 4
> ioctl(5, USBDEVFS_CONTROL or USBDEVFS_CONTROL32, 0xbf905f30) = 32
> close(5)                                = 0

> open("/dev/bus/usb/002/002", O_RDWR)    = 5
> ioctl(5, USBDEVFS_SETCONFIGURATION, 0xbf906114) = 0
> ioctl(5, USBDEVFS_CLAIMINTERFACE, 0xbf906114) = 0
> ioctl(5, USBDEVFS_SETINTERFACE, 0xbf9060e8) = 0
> ioctl(5, USBDEVFS_CLAIMINTERFACE, 0xbf906114) = 0
> ioctl(5, USBDEVFS_SETINTERFACE, 0xbf9060e8) = 0

> Getting model...
> Message sent: 0x1b / 0x0006

# and finally

> gettimeofday({1412041037, 789331}, NULL) = 0
> ioctl(5, USBDEVFS_SUBMITURB or USBDEVFS_SUBMITURB32, 0xbf905ae4) = 0
> ioctl(5, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbf905ac8) = -1 EAGAIN (Resource temporarily unavailable)
> select(6, NULL, [5], NULL, {0, 1000})   = 1 (out [5], left {0, 359})
> gettimeofday({1412041037, 790605}, NULL) = 0
> ioctl(5, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbf905ac8) = 0
> gettimeofday({1412041037, 790818}, NULL) = 0
> gettimeofday({1412041037, 790952}, NULL) = 0
> ioctl(5, USBDEVFS_SUBMITURB or USBDEVFS_SUBMITURB32, 0xbf905d24) = 0
> ioctl(5, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbf905d08) = -1 EAGAIN (Resource temporarily unavailable)
> select(6, NULL, [5], NULL, {0, 1000})   = 0 (Timeout)
> gettimeofday({1412041037, 792563}, NULL) = 0
> ioctl(5, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbf905d08) = -1 EAGAIN (Resource temporarily unavailable)
> select(6, NULL, [5], NULL, {0, 1000})   = 0 (Timeout)
> gettimeofday({1412041037, 794043}, NULL) = 0
> ioctl(5, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbf905d08) = -1 EAGAIN (Resource temporarily unavailable)
> select(6, NULL, [5], NULL, {0, 1000})   = 0 (Timeout)
> gettimeofday({1412041037, 795542}, NULL) = 0
> ioctl(5, USBDEVFS_REAPURBNDELAY or USBDEVFS_REAPURBNDELAY32, 0xbf905d08) = -1 EAGAIN (Resource temporarily unavailable)
# [ repeat indefinitely ]


Remember that I use a "DKE-5" cable (more exactly a dumb
USB<->micro-USB cable) connected to a 7230 phone.



> (--getfile and --putfile and so --getsms doesn't
> work on S40 3rd) and it's more secure on a multiuser system

In my case, --getfile (at least) worked using cdc-phonet, didn't test
the other twos

_______________________________________________
gnokii-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/gnokii-users
Reply | Threaded
Open this post in threaded view
|

Re: phonet / capabilities

Raphaël Droz
In reply to this post by Raphaël Droz
On Mon, Sep 29, 2014 at 06:24:32PM -0300, Raphaël Droz wrote:
> =========== using cdc-phonet:
>
> > IMEI         : X
> > Manufacturer : Nokia
> > Model        : RM-598
> > Product name : RM-598
> > Revision     : V 10.81
>
[...]
> Sadly the model can't be determined (it does not show up in the message
> returned by the phone).


sorry...
I now understand why the RM <-> model-name mappings are useful.
Obviously the "Model" is now correct in the git tree.
In my previous test I was still using Debian's 0.6.30.

_______________________________________________
gnokii-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/gnokii-users